diff --git a/src/components/IconButton.vue b/src/components/IconButton.vue index 4ceaa7e959..3843dfb7eb 100644 --- a/src/components/IconButton.vue +++ b/src/components/IconButton.vue @@ -1,10 +1,10 @@ @@ -36,12 +36,61 @@ const props = defineProps({ }, to: { type: Object + }, + variant: { + type: String, + default: 'secondary' + }, + size: { + type: String, + default: 'md' + }, + block: { + type: Boolean + }, + pill: { + type: Boolean + }, + pressed: { + type: Boolean + }, + tag: { + type: String, + default: 'button' + }, + type: { + type: String, + default: 'button' + }, + loading: { + type: Boolean + } +}) + +const classList = computed(() => { + return { + 'icon-button--square': props.square, + 'icon-button--loading': props.loading } }) -const classList = computed(() => ({ - 'icon-button--square': props.square -})) +const iconLeftOrLoading = computed(() => { + return props.loading ? 'circle-notch' : props.iconLeft +}) + +const iconRightOrLoading = computed(() => { + return props.loading ? 'circle-notch' : props.iconRight +}) + +const buttonProps = { + block: props.block, + pill: props.pill, + pressed: props.pressed, + size: props.size, + tag: props.tag, + type: props.type, + variant: props.variant +} diff --git a/src/stories/components/IconButtons.stories.js b/src/stories/components/IconButtons.stories.js index 5e057fba3d..aaa760468b 100644 --- a/src/stories/components/IconButtons.stories.js +++ b/src/stories/components/IconButtons.stories.js @@ -16,12 +16,16 @@ export default { }, pill: { control: { type: 'boolean' } + }, + loading: { + control: { type: 'boolean' } } }, args: { variant: 'primary', size: 'md', - pill: false + pill: false, + loading: false }, render: (args) => ({ components: {