Skip to content

Commit

Permalink
Format code.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebinside committed Apr 7, 2024
1 parent 73e5763 commit c91e73a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
5 changes: 4 additions & 1 deletion StreamAwesome/src/components/settings/IconSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ function updateStyle(style: string) {
// FIXME: Dirty hack, needs refactoring of icon representation
function updateFamily(family: string) {
currentIcon.fontAwesomeFontFamilySuffix = FontAwesomeIcon.getFontFamilySuffix({ family, style: currentIcon.fontAwesomeFontFamilySuffix === 'Brands' ? 'brands' : 'solid'})
currentIcon.fontAwesomeFontFamilySuffix = FontAwesomeIcon.getFontFamilySuffix({
family,
style: currentIcon.fontAwesomeFontFamilySuffix === 'Brands' ? 'brands' : 'solid'
})
}
defineEmits(['downloadIcon'])
Expand Down
27 changes: 17 additions & 10 deletions StreamAwesome/src/components/settings/StyleSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ defineEmits(['updateStyle', 'updateFamily'])
:value="family"
class="peer hidden"
@change="$emit('updateFamily', family)"
:checked="family === FontAwesomeIcon.getFontFamily(props.icon?.fontAwesomeFontFamilySuffix || FontAwesomeIcon.fontVersionInfo.fontLicense)"
:checked="
family ===
FontAwesomeIcon.getFontFamily(
props.icon?.fontAwesomeFontFamilySuffix || FontAwesomeIcon.fontVersionInfo.fontLicense
)
"
/>
<label
:for="family"
Expand All @@ -42,7 +47,7 @@ defineEmits(['updateStyle', 'updateFamily'])
}"
class="cursor-pointer select-none border border-gray-200 bg-white px-4 py-2 text-lg text-gray-900 hover:bg-gray-100 hover:text-gray-600 focus:z-10 peer-checked:border-blue-600 peer-checked:text-blue-600 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:hover:bg-gray-700 dark:hover:text-gray-300 dark:peer-checked:text-blue-500"
>
{{ family[0].toUpperCase() + family.slice(1) }}
{{ family[0].toUpperCase() + family.slice(1) }}
</label>
</span>
</div>
Expand All @@ -69,20 +74,22 @@ defineEmits(['updateStyle', 'updateFamily'])
}"
class="cursor-pointer select-none border border-gray-200 bg-white px-4 py-2 text-2xl text-gray-900 hover:bg-gray-100 hover:text-gray-600 focus:z-10 peer-checked:border-blue-600 peer-checked:text-blue-600 dark:border-gray-700 dark:bg-gray-800 dark:text-white dark:hover:bg-gray-700 dark:hover:text-gray-300 dark:peer-checked:text-blue-500"
>
<Icon
:iconUnicode="props.icon?.unicode || '3f'"
:isBrandIcon="props.icon?.fontAwesomeFontFamilySuffix === 'Brands'"
:fontWeight="FontAwesomeIcon.getFontWeight(style)"
:fontFamilySuffix="props.icon?.fontAwesomeFontFamilySuffix || FontAwesomeIcon.fontVersionInfo.fontLicense"
:title="style[0].toUpperCase() + style.slice(1)"
/>
<Icon
:iconUnicode="props.icon?.unicode || '3f'"
:isBrandIcon="props.icon?.fontAwesomeFontFamilySuffix === 'Brands'"
:fontWeight="FontAwesomeIcon.getFontWeight(style)"
:fontFamilySuffix="
props.icon?.fontAwesomeFontFamilySuffix || FontAwesomeIcon.fontVersionInfo.fontLicense
"
:title="style[0].toUpperCase() + style.slice(1)"
/>
</label>
</span>
</div>
</template>

<style scoped>
#styleSelector {
max-width:256px;
max-width: 256px;
}
</style>
4 changes: 3 additions & 1 deletion StreamAwesome/src/components/utils/IconDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const unicodeString: ComputedRef<string> = computed(() => {
})
const cssFontString: ComputedRef<string> = computed(() => {
return `"${FontAwesomeIcon.fontVersionInfo.fontFamilyBase} ${
props.isBrandIcon ? 'Brands' : (props.fontFamilySuffix || FontAwesomeIcon.fontVersionInfo.fontLicense)
props.isBrandIcon
? 'Brands'
: props.fontFamilySuffix || FontAwesomeIcon.fontVersionInfo.fontLicense
}"`
})
const cssFontWeight: ComputedRef<FontWeight> = computed(() => {
Expand Down
11 changes: 5 additions & 6 deletions StreamAwesome/src/model/fontAwesomeIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export class FontAwesomeIcon {
}

static getFontFamilySuffix(familyStyle: FontAwesomeFamilyStyle): FontFamilySuffix {
if(familyStyle.style === 'brands') {
if (familyStyle.style === 'brands') {
return 'Brands'
}
}

switch (familyStyle.family) {
case 'classic':
return this.fontVersionInfo.fontLicense
Expand All @@ -51,11 +51,10 @@ export class FontAwesomeIcon {
default:
return this.fontVersionInfo.fontLicense
}

}

static getFontFamily(fontFamilySuffix: FontFamilySuffix): FontAwesomeFamily {
switch(fontFamilySuffix) {
switch (fontFamilySuffix) {
case 'Free':
return 'classic'
case 'Pro':
Expand All @@ -67,7 +66,7 @@ export class FontAwesomeIcon {
case 'Brands':
return 'classic'
default:
return 'classic'
return 'classic'
}
}

Expand Down

0 comments on commit c91e73a

Please sign in to comment.