Skip to content

Commit

Permalink
fix: prevent undefined in variables + fix typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
caro3801 committed Sep 4, 2024
1 parent 5a22caf commit 1c711fe
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/components/PhosphorIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function findComponentByName(name: string) {
try {
return await import(`node_modules/@phosphor-icons/vue/dist/icons/${filename}.vue.mjs`)
} catch {
// @ts-expect-error Importing not typescript module
// eslint-disable-next-line import/extensions
return import('node_modules/@phosphor-icons/vue/dist/icons/PhSelection.vue.mjs')
}
Expand Down Expand Up @@ -186,10 +187,16 @@ const weight = computed(() => {
})
const color = computed(() => {
let colorVariant = ''
if(props.variant){
colorVariant = `var(--bs-${props.variant}, currentColor)`
}
if (currentHover.value && props.hoverVariant) {
return `var(--bs-${props.hoverVariant}, currentColor)`
colorVariant = `var(--bs-${props.hoverVariant}, ${colorVariant})`
}
return `var(--bs-${props.variant}, currentColor)`
return colorVariant
})
const spinTo = computed(() => {
Expand All @@ -215,8 +222,8 @@ const style = computed(() => {
return {
'--phosphor-icon-color': color.value,
'--phosphor-icon-weight': weight.value,
'--phosphor-icon-raw-size': isRawSize.value ? props.size : null,
'--phosphor-icon-size': hasSize.value ? props.size : null,
'--phosphor-icon-raw-size': isRawSize.value ? props.size : undefined,
'--phosphor-icon-size': hasSize.value ? props.size : undefined,
'--phosphor-icon-scale': props.scale ?? 1,
}
})
Expand Down

0 comments on commit 1c711fe

Please sign in to comment.