Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
simplify btn-color class declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
ToBinio committed Nov 18, 2023
1 parent 66f46f9 commit a214b18
Showing 1 changed file with 15 additions and 31 deletions.
46 changes: 15 additions & 31 deletions lib/components/base/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ const props = withDefaults(
link?: string
external: boolean
action?: (event: MouseEvent) => void
color: 'default' | 'danger'| 'primary'| 'red'| 'orange'| 'green'| 'blue'| 'purple'| 'gray' | 'secondary' | 'highlight'
color:
| 'default'
| 'danger'
| 'primary'
| 'red'
| 'orange'
| 'green'
| 'blue'
| 'purple'
| 'gray'
| 'secondary'
| 'highlight'
iconOnly: boolean
large: boolean
outline: boolean
Expand Down Expand Up @@ -42,21 +53,12 @@ const accentedButton = computed(() =>
:class="{
'icon-only': iconOnly,
'btn-large': large,
'btn-danger': color === 'danger',
'btn-primary': color === 'primary',
'btn-secondary': color === 'secondary',
'btn-highlight': color === 'highlight',
'btn-red': color === 'red',
'btn-orange': color === 'orange',
'btn-green': color === 'green',
'btn-blue': color === 'blue',
'btn-purple': color === 'purple',
'btn-gray': color === 'gray',
'btn-transparent': transparent,
'btn-hover-filled': hoverFilled,
'btn-hover-filled-only': hoverFilledOnly,
'btn-outline': outline,
'color-accent-contrast': accentedButton,
['btn-' + props.color]: true,
}"
:to="link"
:target="external ? '_blank' : '_self'"
Expand All @@ -71,21 +73,12 @@ const accentedButton = computed(() =>
:class="{
'icon-only': iconOnly,
'btn-large': large,
'btn-danger': color === 'danger',
'btn-primary': color === 'primary',
'btn-secondary': color === 'secondary',
'btn-highlight': color === 'highlight',
'btn-red': color === 'red',
'btn-orange': color === 'orange',
'btn-green': color === 'green',
'btn-blue': color === 'blue',
'btn-purple': color === 'purple',
'btn-gray': color === 'gray',
'btn-transparent': transparent,
'btn-hover-filled': hoverFilled,
'btn-hover-filled-only': hoverFilledOnly,
'btn-outline': outline,
'color-accent-contrast': accentedButton,
['btn-' + props.color]: true,
}"
:href="link"
:target="external ? '_blank' : '_self'"
Expand All @@ -100,21 +93,12 @@ const accentedButton = computed(() =>
:class="{
'icon-only': iconOnly,
'btn-large': large,
'btn-danger': color === 'danger',
'btn-primary': color === 'primary',
'btn-secondary': color === 'secondary',
'btn-highlight': color === 'highlight',
'btn-red': color === 'red',
'btn-orange': color === 'orange',
'btn-green': color === 'green',
'btn-blue': color === 'blue',
'btn-purple': color === 'purple',
'btn-gray': color === 'gray',
'btn-transparent': transparent,
'btn-hover-filled': hoverFilled,
'btn-hover-filled-only': hoverFilledOnly,
'btn-outline': outline,
'color-accent-contrast': accentedButton,
['btn-' + props.color]: true,
}"
@click="action"
>
Expand Down

0 comments on commit a214b18

Please sign in to comment.