Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Audit VIconButton sizes and props (#1928)

Olga Bulat94ad95f41b05
diff --git a/src/components/VAudioTrack/VPlayPause.vue b/src/components/VAudioTrack/VPlayPause.vue
index 033c13a21..e6584c370 100644
--- a/src/components/VAudioTrack/VPlayPause.vue
+++ b/src/components/VAudioTrack/VPlayPause.vue
@@ -2,18 +2,18 @@
<VIconButton
v-bind="$attrs"
:tabindex="isTabbable ? 0 : -1"
- class="play-pause flex-shrink-0 border-dark-charcoal bg-dark-charcoal text-white focus-visible:border-pink focus-visible:shadow-ring focus-visible:outline-none disabled:opacity-70"
+ class="play-pause flex-shrink-0 border-dark-charcoal bg-dark-charcoal text-white focus-visible:border-pink focus-visible:shadow-ring focus-visible:outline-none active:shadow-ring disabled:opacity-70"
:icon-props="icon === undefined ? undefined : { iconPath: icon }"
:aria-label="$t(label)"
:button-props="buttonProps"
@click.stop.prevent="handleClick"
@mousedown="handleMouseDown"
>
- <template #default="{ iconSizeClasses }">
+ <template #default="{ iconSize }">
<svg
v-if="isLoading"
class="loading p-2"
- :class="iconSizeClasses"
+ :class="`w-${iconSize} h-${iconSize}`"
xmlns="http://www.w3.org/2000/svg"
overflow="visible"
viewBox="0 0 12 12"
diff --git a/src/components/VAudioTrack/layouts/VFullLayout.vue b/src/components/VAudioTrack/layouts/VFullLayout.vue
index 3f6b1ad8c..f1cc8a741 100644
--- a/src/components/VAudioTrack/layouts/VFullLayout.vue
+++ b/src/components/VAudioTrack/layouts/VFullLayout.vue
@@ -18,7 +18,7 @@
<div
class="items-top mx-auto mt-6 flex flex-row flex-wrap gap-6 px-6 lg:max-w-5xl lg:flex-nowrap"
>
- <slot name="play-pause" :size="isSmall ? 'small' : 'medium'" />
+ <slot name="play-pause" :size="isSmall ? 'small' : 'large'" />
<div
class="audio-info order-2 flex w-full flex-col justify-center lg:order-1 lg:w-auto"
diff --git a/src/components/VAudioTrack/layouts/VGlobalLayout.vue b/src/components/VAudioTrack/layouts/VGlobalLayout.vue
index 424787127..a10c4f731 100644
--- a/src/components/VAudioTrack/layouts/VGlobalLayout.vue
+++ b/src/components/VAudioTrack/layouts/VGlobalLayout.vue
@@ -2,7 +2,7 @@
<div class="global-track flex w-full flex-row">
<div class="flex-shrink-0">
<VAudioThumbnail :audio="audio" />
- <slot name="play-pause" size="medium" layout="global" />
+ <slot name="play-pause" size="large" layout="global" />
</div>
<div class="relative flex-grow">
diff --git a/src/components/VAudioTrack/layouts/VRowLayout.vue b/src/components/VAudioTrack/layouts/VRowLayout.vue
index 2b51c67dc..38aeaf3ed 100644
--- a/src/components/VAudioTrack/layouts/VRowLayout.vue
+++ b/src/components/VAudioTrack/layouts/VRowLayout.vue
@@ -80,7 +80,7 @@
>
<slot
name="play-pause"
- :size="isLarge ? 'medium' : 'large'"
+ :size="isLarge ? 'large' : 'extra-large'"
:layout="'row'"
:is-tabbable="false"
/>
diff --git a/src/components/VAudioTrack/meta/VAudioTrack.stories.mdx b/src/components/VAudioTrack/meta/VAudioTrack.stories.mdx
index 952ef2d31..ceb0be346 100644
--- a/src/components/VAudioTrack/meta/VAudioTrack.stories.mdx
+++ b/src/components/VAudioTrack/meta/VAudioTrack.stories.mdx
@@ -40,7 +40,7 @@ import wavWaveform from './wav-waveform.json'
/>
export const commonAttrs = () => ({
- id: Math.floor(Math.random() * 1e9),
+ id: Math.floor(Math.random() * 1e9).toString(),
creator: 'Wolfgang Amadeus Mozart',
creator_url: 'https://en.wikipedia.org/wiki/Wolfgang_Amadeus_Mozart',
category: 'music',
@@ -134,7 +134,7 @@ specifying a `layout`. The layout can further be customised by the `size` prop.
size: 's',
}}
parameters={{
- viewport: { defaultViewport: 'mob' },
+ viewport: { defaultViewport: 'sm' },
}}
>
{Template.bind({})}
@@ -181,7 +181,7 @@ specifying a `layout`. The layout can further be customised by the `size` prop.
size: 's',
}}
parameters={{
- viewport: { defaultViewport: 'mob' },
+ viewport: { defaultViewport: 'sm' },
}}
>
{Template.bind({})}
@@ -226,7 +226,7 @@ dimension.
size: 's',
}}
parameters={{
- viewport: { defaultViewport: 'mob' },
+ viewport: { defaultViewport: 'sm' },
}}
>
{Template.bind({})}
@@ -245,7 +245,7 @@ across pages when navigating.
layout: 'global',
}}
parameters={{
- viewport: { defaultViewport: 'mob' },
+ viewport: { defaultViewport: 'sm' },
}}
>
{Template.bind({})}
diff --git a/src/components/VAudioTrack/meta/VPlayPause.stories.mdx b/src/components/VAudioTrack/meta/VPlayPause.stories.mdx
index 072e3d6d4..34b1bceed 100644
--- a/src/components/VAudioTrack/meta/VPlayPause.stories.mdx
+++ b/src/components/VAudioTrack/meta/VPlayPause.stories.mdx
@@ -19,7 +19,7 @@ import VPlayPause from '~/components/VAudioTrack/VPlayPause.vue'
},
size: {
defaultValue: 'medium',
- options: ['tiny', 'small', 'medium', 'large'],
+ options: ['tiny', 'small', 'medium', 'extra-large'],
control: 'select',
},
toggle: {
diff --git a/src/components/VContentReport/VContentReportPopover.vue b/src/components/VContentReport/VContentReportPopover.vue
index 6c5cc8071..1514925d3 100644
--- a/src/components/VContentReport/VContentReportPopover.vue
+++ b/src/components/VContentReport/VContentReportPopover.vue
@@ -12,12 +12,8 @@
<div class="relative" data-testid="content-report-popover">
<VIconButton
class="absolute top-0 border-none text-dark-charcoal-70 end-0"
- size="search-medium"
:icon-props="{ iconPath: icons.closeSmall }"
- :button-props="{
- 'aria-label': $t('modal.close').toString(),
- variant: 'plain',
- }"
+ :aria-label="$t('modal.close').toString()"
@click="close"
/>
<VContentReportForm
diff --git a/src/components/VExternalSearch/VExternalSourceList.vue b/src/components/VExternalSearch/VExternalSourceList.vue
index a3626a43b..0bda9a805 100644
--- a/src/components/VExternalSearch/VExternalSourceList.vue
+++ b/src/components/VExternalSearch/VExternalSourceList.vue
@@ -27,12 +27,8 @@
>
<VIconButton
class="absolute top-0 border-none text-dark-charcoal-70 end-0"
- size="search-medium"
:icon-props="{ iconPath: icons.closeSmall }"
- :button-props="{
- 'aria-label': $t('modal.close').toString(),
- variant: 'plain',
- }"
+ :aria-label="$t('modal.close').toString()"
@click="close"
/>
<h2 class="description-bold mb-2 px-4 pt-5 text-start">
diff --git a/src/components/VGlobalAudioSection/VGlobalAudioSection.vue b/src/components/VGlobalAudioSection/VGlobalAudioSection.vue
index 3da8b10fe..91ebc6081 100644
--- a/src/components/VGlobalAudioSection/VGlobalAudioSection.vue
+++ b/src/components/VGlobalAudioSection/VGlobalAudioSection.vue
@@ -4,6 +4,7 @@
<VIconButton
v-if="audio"
class="absolute top-0 z-20 border-none ltr:right-0 rtl:left-0"
+ size="large"
:icon-props="{ iconPath: icons.closeIcon }"
@click="handleClose"
/>
diff --git a/src/components/VHeader/VHeaderDesktop.vue b/src/components/VHeader/VHeaderDesktop.vue
index 3dd07d129..273845f5a 100644
--- a/src/components/VHeader/VHeaderDesktop.vue
+++ b/src/components/VHeader/VHeaderDesktop.vue
@@ -16,9 +16,12 @@
size="medium"
@submit="handleSearch"
>
- <VClearButton
+ <VSearchBarButton
v-show="searchTerm !== ''"
- class="hidden me-2 group-focus-within:flex"
+ :icon-path="closeIcon"
+ :aria-label="$t('browse-page.search-form.clear')"
+ inner-area-classes="bg-white hover:bg-dark-charcoal-10"
+ class="hidden group-focus-within:flex"
@click="clearSearchTerm"
/>
<span
@@ -78,22 +81,24 @@ import { Focus } from '~/utils/focus-management'
import { ensureFocus } from '~/utils/reakit-utils/focus'
-import VClearButton from '~/components/VHeader/VSearchBar/VClearButton.vue'
import VFilterButton from '~/components/VHeader/VFilterButton.vue'
import VSearchBar from '~/components/VHeader/VSearchBar/VSearchBar.vue'
import VLogoButton from '~/components/VHeader/VLogoButton.vue'
+import VSearchBarButton from '~/components/VHeader/VHeaderMobile/VSearchBarButton.vue'
import VSearchGridFilter from '~/components/VFilters/VSearchGridFilter.vue'
import VSearchTypePopover from '~/components/VContentSwitcher/VSearchTypePopover.vue'
+import closeIcon from '~/assets/icons/close-small.svg'
+
/**
* The desktop search header.
*/
export default defineComponent({
name: 'VHeaderDesktop',
components: {
- VClearButton,
VFilterButton,
VLogoButton,
+ VSearchBarButton,
VSearchGridFilter,
VSearchTypePopover,
VSearchBar,
@@ -239,6 +244,7 @@ export default defineComponent({
}
return {
+ closeIcon,
filterButtonRef,
searchBarRef,
isFetching,
diff --git a/src/components/VHeader/VHeaderInternal.vue b/src/components/VHeader/VHeaderInternal.vue
index 42d447ea6..596430935 100644
--- a/src/components/VHeader/VHeaderInternal.vue
+++ b/src/components/VHeader/VHeaderInternal.vue
@@ -19,11 +19,9 @@
<VIconButton
ref="menuButtonRef"
:icon-props="{ iconPath: menuIcon }"
- :button-props="{ variant: 'plain' }"
:aria-label="$t('header.aria.menu')"
v-bind="a11yProps"
class="border-tx hover:bg-dark-charcoal hover:text-white"
- size="search-medium"
/>
</template>
@@ -34,9 +32,7 @@
<VHomeLink variant="light" />
<VIconButton
ref="closeButton"
- :button-props="{ variant: 'plain' }"
:icon-props="{ iconPath: closeIcon }"
- size="search-medium"
class="border-tx text-white focus-visible:ring-offset-tx"
:aria-label="$t('modal.close')"
@click="closeModal"
diff --git a/src/components/VHeader/VHeaderMobile/VContentSettingsModal.vue b/src/components/VHeader/VHeaderMobile/VContentSettingsModal.vue
index 46fa1f752..67b322124 100644
--- a/src/components/VHeader/VHeaderMobile/VContentSettingsModal.vue
+++ b/src/components/VHeader/VHeaderMobile/VContentSettingsModal.vue
@@ -30,7 +30,6 @@
}}</VTab>
<VIconButton
class="self-center ms-auto hover:bg-dark-charcoal hover:text-white"
- size="search-medium"
:icon-props="{ iconPath: closeIcon }"
:aria-label="$t('modal.aria-close')"
@click="closeModal"
diff --git a/src/components/VHeader/VHeaderMobile/VSearchBarButton.vue b/src/components/VHeader/VHeaderMobile/VSearchBarButton.vue
index ab52170ae..1ad79f94e 100644
--- a/src/components/VHeader/VHeaderMobile/VSearchBarButton.vue
+++ b/src/components/VHeader/VHeaderMobile/VSearchBarButton.vue
@@ -1,6 +1,5 @@
<template>
<VIconButton
- size="search-medium"
class="border-tx bg-tx"
:button-props="{ variant: 'plain--avoid' }"
v-on="$listeners"
@@ -16,6 +15,7 @@
class="pointer-events-none"
:size="iconSize"
/>
+ <!-- @slot The element that can show a notification label for the button, can be absolutely positioned -->
<slot name="notification" />
</span>
</template>
@@ -27,22 +27,41 @@ import { defineComponent, PropType } from '@nuxtjs/composition-api'
import VIcon from '~/components/VIcon/VIcon.vue'
import VIconButton from '~/components/VIconButton/VIconButton.vue'
+/**
+ * The buttons placed inside the mobile search bar in the header.
+ * They are based on the VIconButton, look like they have a smallish focus area
+ * (32x32px), but actually have a larger tappable area of 48x48px to comply with
+ * accessibility requirements.
+ */
export default defineComponent({
name: 'VSearchBarButton',
components: { VIcon, VIconButton },
props: {
+ /**
+ * The path for the icon.
+ */
iconPath: {
type: String,
required: true,
},
+ /**
+ * The size of the inner area that has a different color,
+ * sometimes only when interactive.
+ */
innerSize: {
type: Number as PropType<6 | 8>,
default: 8,
},
+ /**
+ * The classes to apply to the inner area for styling resting/hover states.
+ */
innerAreaClasses: {
type: String,
default: '',
},
+ /**
+ * Whether the icon should be flipped when the page is in RTL mode.
+ */
rtlFlip: {
type: Boolean,
default: false,
diff --git a/src/components/VHeader/VSearchBar/VClearButton.vue b/src/components/VHeader/VSearchBar/VClearButton.vue
deleted file mode 100644
index 6ddfa75ff..000000000
--- a/src/components/VHeader/VSearchBar/VClearButton.vue
+++ /dev/null
@@ -1,25 +0,0 @@
-<template>
- <VIconButton
- :button-props="{ variant: 'plain' }"
- :icon-props="{ iconPath: closeIcon }"
- size="smaller"
- class="border-tx text-dark-charcoal-70"
- :aria-label="$t('browse-page.search-form.clear')"
- @click="$emit('click')"
- />
-</template>
-
-<script lang="ts">
-import { defineComponent } from '@nuxtjs/composition-api'
-
-import closeIcon from '~/assets/icons/close-small.svg'
-
-export default defineComponent({
- name: 'VClearButton',
- setup() {
- return {
- closeIcon,
- }
- },
-})
-</script>
diff --git a/src/components/VHeader/meta/VContentSettingsButton.stories.mdx b/src/components/VHeader/meta/VContentSettingsButton.stories.mdx
deleted file mode 100644
index e08f4a8d7..000000000
--- a/src/components/VHeader/meta/VContentSettingsButton.stories.mdx
+++ /dev/null
@@ -1,45 +0,0 @@
-import {
- ArgsTable,
- Canvas,
- Description,
- Meta,
- Story,
-} from '@storybook/addon-docs'
-import VContentSettingsButton from '~/components/VHeader/VHeaderMobile/VContentSettingsButton.vue'
-
-<Meta
- title="Components/VHeader/VHeaderMobile/VContentSettingsButton"
- component={VContentSettingsButton}
- decorators={[
- () => ({
- template: '<div class="bg-dark-charcoal-20 p-10"><story /></div>',
- }),
- ]}
- argTypes={{
- click: {
- action: 'click',
- },
- }}
-/>
-
-export const Template = (args, { argTypes }) => ({
- template: `<VContentSettingsButton v-bind="args" v-on="args" />`,
- components: { VContentSettingsButton },
- props: Object.keys(argTypes),
- setup() {
- return { args }
- },
-})
-
-# Content Settings button
-
-<Description of={VContentSettingsButton} />
-
-<ArgsTable of={VContentSettingsButton} />
-
-The button that opens the content settings modal on screens up to `lg` breakpoint.
-If any filters are selected, it shows a pink dot in the top right corner.
-
-<Canvas>
- <Story name="Default">{Template.bind({})}</Story>
-</Canvas>
diff --git a/src/components/VHeader/meta/VSearchBarButton.stories.mdx b/src/components/VHeader/meta/VSearchBarButton.stories.mdx
new file mode 100644
index 000000000..88207eef6
--- /dev/null
+++ b/src/components/VHeader/meta/VSearchBarButton.stories.mdx
@@ -0,0 +1,117 @@
+import {
+ ArgsTable,
+ Canvas,
+ Description,
+ Meta,
+ Story,
+} from '@storybook/addon-docs'
+import VContentSettingsButton from '~/components/VHeader/VHeaderMobile/VContentSettingsButton'
+import VSearchBarButton from '~/components/VHeader/VHeaderMobile/VSearchBarButton.vue'
+
+import closeIcon from '~/assets/icons/close-small.svg'
+import chevronLeftIcon from '~/assets/icons/chevron-left.svg'
+import sourceIcon from '~/assets/icons/source.svg'
+
+<Meta
+ title="Components/VHeader/VHeaderMobile/VSearchBarButton"
+ component={VSearchBarButton}
+ argTypes={{
+ iconPath: {
+ control: {
+ type: 'select',
+ options: [closeIcon, chevronLeftIcon, sourceIcon],
+ default: closeIcon,
+ },
+ },
+ innerSize: {
+ control: {
+ type: 'select',
+ options: [6, 8],
+ },
+ },
+ rtlFlip: {
+ control: {
+ type: 'boolean',
+ },
+ },
+ innerAreaClasses: {
+ control: {
+ type: 'text',
+ },
+ },
+ click: {
+ action: 'click',
+ },
+ }}
+/>
+
+export const Template = (args) => ({
+ template: `<div class="bg-white"><VSearchBarButton v-bind="args" v-on="args" /></div>`,
+ components: { VSearchBarButton },
+ setup() {
+ if (!args.iconPath) {
+ args.iconPath = closeIcon
+ }
+ return { args, closeIcon, chevronLeftIcon, sourceIcon }
+ },
+})
+
+# Content Settings button
+
+<Description of={VSearchBarButton} />
+
+<ArgsTable of={VSearchBarButton} />
+
+<Canvas>
+ <Story name="Default">{Template.bind({})}</Story>
+</Canvas>
+
+export const contentSettingsTemplate = (args) => ({
+ template: `
+ <div class="bg-dark-charcoal-10 rounded-sm flex justify-end">
+ <VContentSettingsButton :are-filters-selected="true" v-bind="args" />
+ </div>
+ `,
+ components: { VContentSettingsButton },
+ setup() {
+ return { args }
+ },
+})
+
+## Content Settings button with filters selected
+
+The button that opens the content settings modal on screens up to `lg` breakpoint.
+If any filters are selected, it shows a pink dot in the top right corner.
+
+<Canvas>
+ <Story name="Content Settings Button with filters selected">
+ {contentSettingsTemplate.bind({})}
+ </Story>
+</Canvas>
+
+## Clear button and Back button
+
+export const activeButtonsTemplate = (args) => ({
+ template: `<div class="wrapper rounded-sm bg-white flex justify-between ring ring-pink">
+ <VSearchBarButton
+ :icon-path="chevronLeftIcon"
+ :inner-size="8"
+ :aria-label="$t('header.back-button')"
+ inner-area-classes="hover:bg-dark-charcoal hover:text-white"
+ :rtl-flip="true"
+ />
+ <VSearchBarButton
+ :icon-path="closeIcon"
+ :aria-label="$t('browse-page.search-form.clear')"
+ inner-area-classes="bg-white hover:bg-dark-charcoal-10"
+ />
+</div>`,
+ components: { VContentSettingsButton },
+ setup() {
+ return { args, closeIcon, chevronLeftIcon }
+ },
+})
+
+<Canvas>
+ <Story name="Clear and Back Buttons">{activeButtonsTemplate.bind({})}</Story>
+</Canvas>
diff --git a/src/components/VIcon/VIcon.vue b/src/components/VIcon/VIcon.vue
index 50b1815b1..a8f4e1b72 100644
--- a/src/components/VIcon/VIcon.vue
+++ b/src/components/VIcon/VIcon.vue
@@ -59,14 +59,14 @@ export default defineComponent({
},
/**
* The size of the icon based on tailwind values. Possible values:
- * 4 - 1rem, 5 - 1.25rem, 6 - 1.5rem.
+ * 4 - 1rem, 5 - 1.25rem, 6 - 1.5rem, 8 - 2rem, 12 - 3rem.
*
* @default 6
*/
size: {
type: Number,
default: 6,
- validator: (val: number) => [4, 5, 6].includes(val),
+ validator: (val: number) => [4, 5, 6, 8, 12].includes(val),
},
/**
* whether to flip the icon for RTL languages; This generally makes sense
diff --git a/src/components/VIconButton/VIconButton.vue b/src/components/VIconButton/VIconButton.vue
index 2feb4de23..3d9a5ea92 100644
--- a/src/components/VIconButton/VIconButton.vue
+++ b/src/components/VIconButton/VIconButton.vue
@@ -2,16 +2,16 @@
<VButton
v-bind="buttonProps"
size="disabled"
- class="icon-button flex flex-shrink-0 items-center justify-center border-1.5 active:shadow-ring"
+ class="icon-button flex flex-shrink-0 items-center justify-center border-1.5"
:class="buttonSizeClasses"
:type="type"
v-on="$listeners"
>
- <slot name="default" :icon-size-classes="iconSizeClasses" />
+ <slot name="default" :icon-size="iconSize" />
<VIcon
v-if="iconProps"
class="pointer-events-none"
- :class="iconSizeClasses"
+ :size="iconSize"
v-bind="iconProps"
/>
</VButton>
@@ -26,23 +26,11 @@ import VIcon, { type IconProps } from '~/components/VIcon/VIcon.vue'
import VButton, { type ButtonProps } from '~/components/VButton.vue'
const SIZE_MAP = Object.freeze({
- tiny: { icon: 'w-6 h-6', button: 'w-6 h-6' },
- small: { icon: 'w-6 h-6', button: 'w-10 h-10' },
- smaller: { icon: 'w-6 h-6', button: 'w-8 h-8' },
- // TODO: audit the sizes after new header is done.
- 'new-small': { icon: 'w-4 h-4', button: 'w-8 h-8' },
- 'search-small': {
- icon: 'w-6 h-6',
- button: 'w-10 md:w-12 h-10 md:h-12',
- },
- 'search-medium': { icon: 'w-6 h-6', button: 'w-12 h-12' },
- 'search-large': { icon: 'w-6 h-6', button: 'w-14 h-14' },
- 'search-standalone': {
- icon: 'w-6 h-6',
- button: 'w-14 md:w-[69px] h-14 md:h-[69px]',
- },
- medium: { icon: 'w-8 h-8', button: 'w-14 h-14' },
- large: { icon: 'w-12 h-12', button: 'w-20 h-20' },
+ tiny: { icon: 6, button: 'w-6 h-6' },
+ small: { icon: 6, button: 'w-10 h-10' },
+ medium: { icon: 6, button: 'w-12 h-12' },
+ large: { icon: 8, button: 'w-14 h-14' },
+ 'extra-large': { icon: 12, button: 'w-20 h-20' },
} as const)
type Size = keyof typeof SIZE_MAP
@@ -80,13 +68,13 @@ export default defineComponent({
const type = (attrs['type'] ?? 'button') as ButtonType
const buttonSizeClasses = computed(() => SIZE_MAP[props.size].button)
- const iconSizeClasses = computed(() => SIZE_MAP[props.size].icon)
+ const iconSize = computed(() => SIZE_MAP[props.size].icon)
return {
type,
buttonSizeClasses,
- iconSizeClasses,
+ iconSize,
}
},
})
diff --git a/src/components/VIconButton/meta/VIconButton.stories.mdx b/src/components/VIconButton/meta/VIconButton.stories.mdx
index d3d3f109d..637470ee6 100644
--- a/src/components/VIconButton/meta/VIconButton.stories.mdx
+++ b/src/components/VIconButton/meta/VIconButton.stories.mdx
@@ -16,7 +16,7 @@ import replayIcon from '~/assets/icons/replay.svg'
argTypes={{
size: {
defaultValue: 'medium',
- options: ['tiny', 'small', 'search', 'medium', 'large'],
+ options: ['tiny', 'small', 'medium', 'large', 'extra-large'],
control: 'select',
},
}}
@@ -32,6 +32,23 @@ export const Template = (args) => ({
},
})
+export const sizesTemplate = (args) => ({
+ template: `
+ <div class="flex gap-x-2">
+ <div v-for="size in ['tiny', 'small', 'medium', 'large', 'extra-large']" :key="size" class="flex flex-col items-center p-2">
+ <p>{{ size }}</p>
+ <VIconButton
+ class="text-white bg-dark-charcoal border-dark-charcoal"
+ :size="size" v-bind="args" />
+ </div>
+ </div>
+ `,
+ components: { VIconButton },
+ setup() {
+ return { args }
+ },
+})
+
# Icon Button
<Description of={VIconButton} />
@@ -50,3 +67,18 @@ export const Template = (args) => ({
{Template.bind({})}
</Story>
</Canvas>
+
+## Sizes
+
+<Canvas>
+ <Story
+ name="Sizes"
+ args={{
+ iconProps: {
+ iconPath: replayIcon,
+ },
+ }}
+ >
+ {sizesTemplate.bind({})}
+ </Story>
+</Canvas>
diff --git a/src/components/VNotificationBanner.vue b/src/components/VNotificationBanner.vue
index 6cd2e9faa..d0b577d4e 100644
--- a/src/components/VNotificationBanner.vue
+++ b/src/components/VNotificationBanner.vue
@@ -12,8 +12,6 @@
<slot name="buttons">
<VIconButton
:class="variant === 'announcement' && 'text-white'"
- class="border-none"
- :button-props="{ variant: 'plain' }"
size="small"
:aria-label="closeLabel"
:icon-props="{
diff --git a/tailwind.safelist.txt b/tailwind.safelist.txt
index 86be84af1..a3a4ec33a 100644
--- a/tailwind.safelist.txt
+++ b/tailwind.safelist.txt
@@ -4,7 +4,11 @@ that they are generated by Tailwind.
w-4
w-5
w-6
+w-8
+w-12
h-4
h-5
h-6
+h-8
+h-12
diff --git a/test/storybook/visual-regression/v-icon-button.spec.ts b/test/storybook/visual-regression/v-icon-button.spec.ts
new file mode 100644
index 000000000..2007090f1
--- /dev/null
+++ b/test/storybook/visual-regression/v-icon-button.spec.ts
@@ -0,0 +1,12 @@
+import { expect, test } from '@playwright/test'
+
+test.describe('VIconButton', () => {
+ const url = '/iframe.html?id=components-viconbutton--sizes'
+
+ test('icon button sizes', async ({ page }) => {
+ await page.goto(url)
+ expect(await page.screenshot()).toMatchSnapshot({
+ name: 'v-icon-button-sizes.png',
+ })
+ })
+})
diff --git a/test/storybook/visual-regression/v-icon-button.spec.ts-snapshots/v-icon-button-sizes-linux.png b/test/storybook/visual-regression/v-icon-button.spec.ts-snapshots/v-icon-button-sizes-linux.png
new file mode 100644
index 000000000..0b4a76996
Binary files /dev/null and b/test/storybook/visual-regression/v-icon-button.spec.ts-snapshots/v-icon-button-sizes-linux.png differ
diff --git a/test/storybook/visual-regression/v-search-bar-button.spec.ts b/test/storybook/visual-regression/v-search-bar-button.spec.ts
new file mode 100644
index 000000000..553167d83
--- /dev/null
+++ b/test/storybook/visual-regression/v-search-bar-button.spec.ts
@@ -0,0 +1,41 @@
+import { expect, test } from '@playwright/test'
+
+test.describe.configure({ mode: 'parallel' })
+const wrapperLocator = '.wrapper'
+test.describe('VSearchBarButton', () => {
+ test.beforeEach(async ({ page }) => {
+ await page.goto(
+ '/iframe.html?id=components-vheader-vheadermobile-vsearchbarbutton--clear-and-back-buttons'
+ )
+ })
+ test('Clear and back buttons resting', async ({ page }) => {
+ expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
+ name: `clear-back-buttons-resting.png`,
+ })
+ })
+
+ test(`Back button hovered`, async ({ page }) => {
+ await page.hover('.wrapper>button:nth-child(1)')
+ expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
+ name: `back-button-hovered.png`,
+ })
+ })
+ test(`Back button focused`, async ({ page }) => {
+ await page.focus('.wrapper>button:nth-child(1)')
+ expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
+ name: `back-button-focused.png`,
+ })
+ })
+ test(`Clear button hovered`, async ({ page }) => {
+ await page.hover('.wrapper>button:nth-child(2)')
+ expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
+ name: `clear-button-hovered.png`,
+ })
+ })
+ test(`Clear button focused`, async ({ page }) => {
+ await page.hover('.wrapper>button:nth-child(2)')
+ expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
+ name: `clear-button-focused.png`,
+ })
+ })
+})
diff --git a/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/back-button-focused-linux.png b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/back-button-focused-linux.png
new file mode 100644
index 000000000..418b850cc
Binary files /dev/null and b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/back-button-focused-linux.png differ
diff --git a/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/back-button-hovered-linux.png b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/back-button-hovered-linux.png
new file mode 100644
index 000000000..fe1f04ade
Binary files /dev/null and b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/back-button-hovered-linux.png differ
diff --git a/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-back-buttons-resting-linux.png b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-back-buttons-resting-linux.png
new file mode 100644
index 000000000..9f631b1c2
Binary files /dev/null and b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-back-buttons-resting-linux.png differ
diff --git a/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-button-focused-linux.png b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-button-focused-linux.png
new file mode 100644
index 000000000..f76a2413c
Binary files /dev/null and b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-button-focused-linux.png differ
diff --git a/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-button-hovered-linux.png b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-button-hovered-linux.png
new file mode 100644
index 000000000..f76a2413c
Binary files /dev/null and b/test/storybook/visual-regression/v-search-bar-button.spec.ts-snapshots/clear-button-hovered-linux.png differ