Skip to content

Commit

Permalink
Remove pressed variants
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Apr 4, 2023
1 parent a02dc0c commit 97359a2
Show file tree
Hide file tree
Showing 49 changed files with 15 additions and 54 deletions.
29 changes: 5 additions & 24 deletions frontend/src/components/VButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -335,52 +335,33 @@ a.button {
}
.filled-pink {
@apply border-0 bg-pink text-white focus-slim-filled hover:bg-dark-pink hover:text-white;
}
.filled-pink-pressed {
@apply bg-dark-pink;
@apply bg-pink text-white hover:bg-dark-pink hover:text-white;
}
.filled-dark {
@apply bg-dark-charcoal text-white focus-slim-filled hover:bg-dark-charcoal-80 hover:text-white;
}
.filled-dark-pressed {
@apply bg-dark-charcoal text-white hover:border-tx hover:bg-dark-charcoal-90;
@apply bg-dark-charcoal text-white hover:bg-dark-charcoal-80 hover:text-white;
}
.filled-gray {
@apply bg-dark-charcoal-10 text-dark-charcoal hover:bg-dark-charcoal hover:text-white;
}
.filled-gray-pressed {
@apply bg-dark-charcoal-90 text-white hover:border-tx hover:bg-dark-charcoal-80;
}
.filled-white {
@apply bg-white text-dark-charcoal hover:bg-dark-charcoal-10;
}
.filled-white-pressed {
@apply bg-dark-charcoal-10 text-dark-charcoal;
@apply bg-white text-dark-charcoal hover:bg-dark-charcoal hover:text-white;
}
.bordered-white {
@apply border border-white bg-white text-dark-charcoal hover:border-dark-charcoal-20;
}
.bordered-white-pressed {
@apply border;
}
.bordered-gray {
@apply border border-dark-charcoal-20 bg-white text-dark-charcoal hover:border-dark-charcoal;
}
.bordered-gray-pressed {
@apply border-tx bg-dark-charcoal-10 text-dark-charcoal;
}
.transparent-gray {
@apply bg-tx text-dark-charcoal hover:bg-dark-charcoal-10;
@apply bg-white text-dark-charcoal hover:bg-dark-charcoal-10;
}
.transparent-dark {
@apply bg-tx text-dark-charcoal hover:bg-dark-charcoal hover:text-white;
@apply bg-white text-dark-charcoal hover:bg-dark-charcoal hover:text-white;
}
.primary {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/meta/VButton.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export const buttonSizes = allButtonSizes.filter(

export const Template = (args) => ({
template: `
<div id="wrapper" class="w-40 h-16 flex items-center justify-center bg-white">
<VButton v-bind="args" @click="onClick" href="/">
Code is Poetry
</VButton>
</div>
`,
components: { VButton },
methods: {
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/types/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,13 @@ export const buttonVariants = [
"dropdown-label",
"dropdown-label-pressed",
"filled-pink",
"filled-pink-pressed",
"filled-dark",
"filled-dark-pressed",
"filled-gray",
"filled-gray-pressed",
"filled-white",
"filled-white-pressed",
"bordered-white",
"bordered-white-pressed",
"bordered-gray",
"bordered-gray-pressed",
"transparent-gray",
"transparent-gray-pressed",
"transparent-dark",
"transparent-dark-pressed",
] as const
export type ButtonVariant = typeof buttonVariants[number]

Expand Down
2 changes: 1 addition & 1 deletion frontend/test/storybook/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const config: PlaywrightTestConfig = {
baseURL: "http://localhost:54000",
trace: "retain-on-failure",
},
timeout: 2 * 60 * 1e3,
timeout: 60 * 1e3, // 1 minute
expect: {
toMatchSnapshot: {
// To avoid flaky tests, we allow a small amount of pixel difference.
Expand Down
28 changes: 7 additions & 21 deletions frontend/test/storybook/visual-regression/v-button.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { makeGotoWithArgs } from "~~/test/storybook/utils/args"
import { buttonVariants } from "~/types/button"

const buttonLocator = "text=Code is Poetry"
const wrapperLocator = "#wrapper"

test.describe.configure({ mode: "parallel" })

Expand All @@ -23,40 +24,25 @@ test.describe("VButton", () => {
for (const variant of nonPressedVariants) {
test(`${variant} resting`, async ({ page }) => {
await gotoWithArgs(page, { variant })
expect(await page.locator(buttonLocator).screenshot()).toMatchSnapshot({
expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
name: `${variant}-resting.png`,
})
})

test(`${variant} hovered`, async ({ page }) => {
await gotoWithArgs(page, { variant })
await page.hover(buttonLocator)
expect(await page.locator(buttonLocator).screenshot()).toMatchSnapshot({
expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
name: `${variant}-hovered.png`,
})
})

test(`${variant} pressed`, async ({ page }) => {
await gotoWithArgs(page, { variant, pressed: true })
expect(await page.locator(buttonLocator).screenshot()).toMatchSnapshot({
name: `${variant}-pressed.png`,
})
})

test(`${variant} pressed hovered`, async ({ page }) => {
test(`${variant} focused`, async ({ page }) => {
await gotoWithArgs(page, { variant })
await page.hover(buttonLocator)
expect(await page.locator(buttonLocator).screenshot()).toMatchSnapshot({
name: `${variant}-pressed-hovered.png`,
await page.focus(buttonLocator)
expect(await page.locator(wrapperLocator).screenshot()).toMatchSnapshot({
name: `${variant}-focused.png`,
})
})
if (variant.startsWith("action")) {
test(`${variant} disabled`, async ({ page }) => {
await gotoWithArgs(page, { variant, disabled: true })
expect(await page.locator(buttonLocator).screenshot()).toMatchSnapshot({
name: `${variant}-disabled.png`,
})
})
}
}
})
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.

0 comments on commit 97359a2

Please sign in to comment.