Skip to content

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

Remove primary button variant and make variant required (#1188)

Olga Bulat1d6540ef95b5
diff --git a/frontend/src/components/VButton.vue b/frontend/src/components/VButton.vue
index 336efb8e8..511edfcd2 100644
--- a/frontend/src/components/VButton.vue
+++ b/frontend/src/components/VButton.vue
@@ -97,12 +97,10 @@ const VButton = defineComponent({
*
* Plain removes all styles except the focus ring.
* Plain--avoid removes _all_ styles including the focus ring.
- *
- * @default 'primary'
*/
variant: {
type: String as PropType<ButtonVariant>,
- default: "primary",
+ required: true,
},
/**
* Allows for programmatically setting the pressed state of a button,
@@ -368,13 +366,6 @@ a.button {
@apply border-tx bg-tx text-dark-charcoal hover:bg-dark-charcoal hover:text-white;
}
-.primary {
- @apply border-tx bg-pink text-white hover:border-tx hover:bg-dark-pink hover:text-white;
-}
-.primary-pressed {
- @apply bg-dark-pink;
-}
-
.secondary {
@apply border-tx bg-tx hover:bg-dark-charcoal hover:text-white focus-visible:ring focus-visible:ring-pink;
}
diff --git a/frontend/src/components/VFilters/VSearchGridFilter.vue b/frontend/src/components/VFilters/VSearchGridFilter.vue
index a4c09291e..77f5ecf8a 100644
--- a/frontend/src/components/VFilters/VSearchGridFilter.vue
+++ b/frontend/src/components/VFilters/VSearchGridFilter.vue
@@ -27,14 +27,6 @@
@toggle-filter="toggleFilter"
/>
</form>
- <footer
- v-if="showFilterHeader && isAnyFilterApplied"
- class="flex justify-between md:hidden"
- >
- <VButton variant="primary" @click="$emit('close')">
- {{ $t("filter-list.show") }}
- </VButton>
- </footer>
</section>
</template>
diff --git a/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue b/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue
index dcfb4f792..29400c4a1 100644
--- a/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue
+++ b/frontend/src/components/VHeader/VSearchBar/VSearchButton.vue
@@ -2,8 +2,8 @@
<VButton
:aria-label="$t('search.search')"
size="disabled"
- :variant="route === 'home' ? 'primary' : 'plain'"
- class="heading-6 h-full flex-shrink-0 rounded-s-none transition-none"
+ :variant="route === 'home' ? 'filled-pink' : 'plain'"
+ class="heading-6 h-full flex-shrink-0 rounded-s-none"
:class="[
route === 'home'
? 'w-[57px] whitespace-nowrap md:w-auto md:px-10 md:py-6'
diff --git a/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue b/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue
index 77ff75aff..07937a775 100644
--- a/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue
+++ b/frontend/src/components/VHeader/VSearchBar/VStandaloneSearchBar.vue
@@ -32,8 +32,8 @@
type="submit"
:aria-label="$t('search.search').toString()"
size="disabled"
- :variant="isHomeRoute ? 'primary' : 'plain'"
- class="h-full w-14 flex-shrink-0 rounded-s-none transition-none sm:w-16"
+ :variant="isHomeRoute ? 'filled-pink' : 'plain'"
+ class="h-full w-14 flex-shrink-0 rounded-s-none sm:w-16"
:class="{
'search-button border !border-black p-0.5px ps-1.5px hover:bg-pink hover:text-white focus:!border-tx focus-visible:bg-pink focus-visible:text-white group-focus-within:!border-tx group-focus-within:bg-pink group-focus-within:text-white group-focus-within:hover:bg-dark-pink group-hover:!border-tx group-hover:bg-pink group-hover:text-white group-focus:!border-tx':
!isHomeRoute,
diff --git a/frontend/src/components/VSkipToContentContainer.vue b/frontend/src/components/VSkipToContentContainer.vue
index 6315c63fb..4341b4013 100644
--- a/frontend/src/components/VSkipToContentContainer.vue
+++ b/frontend/src/components/VSkipToContentContainer.vue
@@ -3,6 +3,7 @@
<slot />
<VTeleport to="skip-to-content">
<VButton
+ variant="filled-pink"
class="z-50 ms-2 mt-2 focus:fixed focus:absolute"
:class="$style.skipButton"
@click="skipToContent"
diff --git a/frontend/src/types/button.ts b/frontend/src/types/button.ts
index 8c0ae3206..53419a78c 100644
--- a/frontend/src/types/button.ts
+++ b/frontend/src/types/button.ts
@@ -3,7 +3,6 @@ export const buttonForms = ["VLink", "button"] as const
export type ButtonForm = typeof buttonForms[number]
export const buttonVariants = [
- "primary",
"secondary",
"secondary-bordered",
"secondary-filled",
diff --git a/frontend/test/unit/specs/components/v-button.spec.js b/frontend/test/unit/specs/components/v-button.spec.js
index e862d01e9..2a684f0ad 100644
--- a/frontend/test/unit/specs/components/v-button.spec.js
+++ b/frontend/test/unit/specs/components/v-button.spec.js
@@ -20,6 +20,7 @@ describe("VButton", () => {
})
it('should render a `button` by default with type="button" and no tabindex', async () => {
render(VButton, {
+ props: { variant: "filled-white" },
slots: { default: "Code is Poetry" },
})
@@ -32,7 +33,7 @@ describe("VButton", () => {
it("should allow passing an explicit type", async () => {
render(VButton, {
- props: { type: "submit" },
+ props: { type: "submit", variant: "filled-white" },
slots: { default: "Code is Poetry" },
})
@@ -44,7 +45,7 @@ describe("VButton", () => {
it("should render an anchor with no type attribute", async () => {
render(VButton, {
attrs: { href: "http://localhost" },
- props: { as: "VLink" },
+ props: { as: "VLink", variant: "filled-white" },
slots: { default: "Code is Poetry" },
})
await nextTick()
@@ -57,7 +58,11 @@ describe("VButton", () => {
it("should render the disabled attribute on a button when the element is explicitly unfocusableWhenDisabled and is disabled", async () => {
render(VButton, {
- props: { disabled: true, focusableWhenDisabled: false },
+ props: {
+ disabled: true,
+ focusableWhenDisabled: false,
+ variant: "filled-white",
+ },
slots: { default: "Code is Poetry" },
})
@@ -69,7 +74,11 @@ describe("VButton", () => {
it("should not render the disabled attribute if the element is focusableWhenDisabled", async () => {
render(VButton, {
- props: { disabled: true, focusableWhenDisabled: true },
+ props: {
+ disabled: true,
+ focusableWhenDisabled: true,
+ variant: "filled-white",
+ },
slots: { default: "Code is Poetry" },
})
@@ -86,6 +95,7 @@ describe("VButton", () => {
disabled: true,
focusableWhenDisabled: true,
href: "https://wordpress.org",
+ variant: "filled-white",
},
slots: { default: "Code is Poetry" },
})
diff --git a/frontend/test/unit/specs/components/v-modal.spec.js b/frontend/test/unit/specs/components/v-modal.spec.js
index 2ab7e4c12..6c8e86a2f 100644
--- a/frontend/test/unit/specs/components/v-modal.spec.js
+++ b/frontend/test/unit/specs/components/v-modal.spec.js
@@ -22,7 +22,7 @@ const TestWrapper = Vue.component("TestWrapper", {
<div>
<VModal label="modal label" :initial-focus-element="resolvedInitialFocusElement">
<template #trigger="{ a11yProps, visible }">
- <VButton v-bind="a11yProps">{{ visible }}</VButton>
+ <VButton variant="filled-white" v-bind="a11yProps">{{ visible }}</VButton>
</template>
<div>Code is Poetry</div>
diff --git a/frontend/test/unit/specs/components/v-popover.spec.js b/frontend/test/unit/specs/components/v-popover.spec.js
index d156ed17e..faf9fc1c3 100644
--- a/frontend/test/unit/specs/components/v-popover.spec.js
+++ b/frontend/test/unit/specs/components/v-popover.spec.js
@@ -31,7 +31,7 @@ const TestWrapper = Vue.component("TestWrapper", {
<div>External area</div>
<VPopover label="Test label" v-bind="popoverProps">
<template #trigger="{ visible, a11yProps }">
- <VButton :pressed="visible" v-bind="a11yProps">{{ visible ? 'Close' : 'Open' }}</VButton>
+ <VButton variant="bordered-white" :pressed="visible" v-bind="a11yProps">{{ visible ? 'Close' : 'Open' }}</VButton>
</template>
<div :tabindex="popoverContentTabIndex">Code is Poetry</div>
</VPopover>