Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Delete unused VOldIconButton (#3613)
Olga Bulatcd5a4c6ad95e
diff --git a/frontend/src/components/VIconButton/VOldIconButton.vue b/frontend/src/components/VIconButton/VOldIconButton.vuedeleted file mode 100644index f58711f70..000000000--- a/frontend/src/components/VIconButton/VOldIconButton.vue+++ /dev/null@@ -1,100 +0,0 @@-<template>- <VButton- v-bind="buttonProps"- :aria-label="label"- size="disabled"- class="icon-button flex flex-none items-center justify-center"- :class="[buttonSizeClasses, { 'border-1.5': !borderless }]"- :type="type"- v-on="$listeners"- >- <slot name="default" :icon-size="iconSize" />- <VIcon- v-if="iconProps"- class="pointer-events-none"- :size="iconSize"- v-bind="iconProps"- />- </VButton>-</template>--<script lang="ts">-import { computed, defineComponent, PropType } from "vue"--import type { ButtonType } from "~/types/button"--import VIcon, { type IconProps } from "~/components/VIcon/VIcon.vue"-import VButton, { type ButtonProps } from "~/components/VButton.vue"--import type { TranslateResult } from "vue-i18n"--const SIZE_MAP = Object.freeze({- tiny: { icon: 6, button: "w-6 h-6" },- close: { icon: 6, button: "w-8 h-8" },- 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--export default defineComponent({- name: "VOldIconButton",- components: { VIcon, VButton },- props: {- /**- * the size of the button; The size affects both the size of the button- * itself and the icon inside it.- */- size: {- type: String as PropType<Size>,- default: "medium",- validator: (val: string) => Object.keys(SIZE_MAP).includes(val),- },- /**- * props to pass down to the `VIcon` component nested inside the button; See- * documentation on `VIcon`.- */- iconProps: {- type: Object as PropType<IconProps>,- required: false,- },- /**- * props to pass down to the `VButton` component nested inside the button;- * See documentation on `VButton`.- */- buttonProps: {- type: Object as PropType<Omit<ButtonProps, "size">>,- default: () => ({ variant: "transparent-tx" }),- },- /**- * the label for the button; This is used for accessibility purposes.- */- label: {- type: [String, Object] as PropType<string | TranslateResult>,- required: true,- },- /**- * whether the button should have a border or not.- * The `focus-` custom TW classes don't always work well with border.- */- borderless: {- type: Boolean,- default: false,- },- },- setup(props, { attrs }) {- const type = (attrs["type"] ?? "button") as ButtonType-- const buttonSizeClasses = computed(() => SIZE_MAP[props.size].button)- const iconSize = computed(() => SIZE_MAP[props.size].icon)-- return {- type,-- buttonSizeClasses,- iconSize,- }- },-})-</script>diff --git a/frontend/src/components/VIconButton/meta/VOldIconButton.stories.mdx b/frontend/src/components/VIconButton/meta/VOldIconButton.stories.mdxdeleted file mode 100644index 173f6be94..000000000--- a/frontend/src/components/VIconButton/meta/VOldIconButton.stories.mdx+++ /dev/null@@ -1,83 +0,0 @@-import {- ArgsTable,- Canvas,- Description,- Meta,- Story,-} from "@storybook/addon-docs"--import VOldIconButton from "~/components/VIconButton/VOldIconButton.vue"--<Meta- title="Components/VOldIconButton"- component={VOldIconButton}- argTypes={{- size: {- defaultValue: "medium",- options: ["tiny", "small", "medium", "large", "extra-large"],- control: "select",- },- }}-/>--export const Template = (args) => ({- template: `- <VOldIconButton class="text-white bg-dark-charcoal border-dark-charcoal" v-bind="args" label="v-icon-button" />- `,- components: { VOldIconButton },- setup() {- return { 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>- <VOldIconButton- class="text-white bg-dark-charcoal border-dark-charcoal"- label="v-icon-button"- :size="size" v-bind="args" />- </div>- </div>- `,- components: { VOldIconButton },- setup() {- return { args }- },-})--# Icon Button--<Description of={VOldIconButton} />--<ArgsTable of={VOldIconButton} />--<Canvas>- <Story- name="Default"- args={{- iconProps: {- name: "replay",- },- }}- >- {Template.bind({})}- </Story>-</Canvas>--## Sizes--<Canvas>- <Story- name="Sizes"- args={{- iconProps: {- name: "replay",- },- }}- >- {sizesTemplate.bind({})}- </Story>-</Canvas>diff --git a/frontend/test/storybook/visual-regression/v-old-icon-button.spec.ts b/frontend/test/storybook/visual-regression/v-old-icon-button.spec.tsdeleted file mode 100644index 226c63941..000000000--- a/frontend/test/storybook/visual-regression/v-old-icon-button.spec.ts+++ /dev/null@@ -1,12 +0,0 @@-import { expect, test } from "@playwright/test"--test.describe("VOldIconButton", () => {- const url = "/iframe.html?id=components-voldiconbutton--sizes"-- test("old icon button sizes", async ({ page }) => {- await page.goto(url)- expect(await page.screenshot()).toMatchSnapshot({- name: "v-old-icon-button-sizes.png",- })- })-})diff --git a/frontend/test/storybook/visual-regression/v-old-icon-button.spec.ts-snapshots/v-old-icon-button-sizes-linux.png b/frontend/test/storybook/visual-regression/v-old-icon-button.spec.ts-snapshots/v-old-icon-button-sizes-linux.pngdeleted file mode 100644index 6a8a22dd9..000000000Binary files a/frontend/test/storybook/visual-regression/v-old-icon-button.spec.ts-snapshots/v-old-icon-button-sizes-linux.png and /dev/null differ