-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update styles of outlined buttons and more (#1978)
* selected state for Button * tests * fix menu filter button hover issue * update screenshots * try to fix SearchBar recent keywords test
- Loading branch information
Showing
123 changed files
with
363 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,75 @@ | ||
import { Button } from '@chakra-ui/react'; | ||
import { Box, Button, Flex } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import { test, expect } from 'playwright/lib'; | ||
|
||
test.use({ viewport: { width: 150, height: 350 } }); | ||
|
||
[ | ||
{ variant: 'solid' }, | ||
{ variant: 'solid', colorScheme: 'gray', withDarkMode: true }, | ||
{ variant: 'outline', colorScheme: 'gray', withDarkMode: true }, | ||
{ variant: 'outline', colorScheme: 'gray-dark', withDarkMode: true }, | ||
{ variant: 'outline', colorScheme: 'blue', withDarkMode: true }, | ||
{ variant: 'simple', withDarkMode: true }, | ||
{ variant: 'ghost', withDarkMode: true }, | ||
{ variant: 'subtle' }, | ||
{ variant: 'subtle', colorScheme: 'gray', withDarkMode: true }, | ||
].forEach(({ variant, colorScheme, withDarkMode }) => { | ||
{ variant: 'solid', states: [ 'default', 'disabled', 'hovered', 'active' ] }, | ||
{ variant: 'outline', colorScheme: 'gray', withDarkMode: true, states: [ 'default', 'disabled', 'hovered', 'active', 'selected' ] }, | ||
{ variant: 'outline', colorScheme: 'blue', withDarkMode: true, states: [ 'default', 'disabled', 'hovered', 'active', 'selected' ] }, | ||
{ variant: 'simple', withDarkMode: true, states: [ 'default', 'hovered' ] }, | ||
{ variant: 'ghost', withDarkMode: true, states: [ 'default', 'hovered', 'active' ] }, | ||
{ variant: 'subtle', states: [ 'default', 'hovered' ] }, | ||
{ variant: 'subtle', colorScheme: 'gray', states: [ 'default', 'hovered' ], withDarkMode: true }, | ||
].forEach(({ variant, colorScheme, withDarkMode, states }) => { | ||
test.describe(`variant ${ variant }${ colorScheme ? ` with ${ colorScheme } color scheme` : '' }${ withDarkMode ? ' +@dark-mode' : '' }`, () => { | ||
test('base', async({ render }) => { | ||
const component = await render(<Button variant={ variant } colorScheme={ colorScheme }>Click me</Button>); | ||
await expect(component.locator('button')).toHaveScreenshot(); | ||
}); | ||
|
||
test('disabled', async({ render }) => { | ||
const component = await render(<Button variant={ variant } colorScheme={ colorScheme } isDisabled>Click me</Button>); | ||
await expect(component.locator('button')).toHaveScreenshot(); | ||
}); | ||
|
||
test('hovered', async({ render }) => { | ||
const component = await render(<Button variant={ variant } colorScheme={ colorScheme }>Click me</Button>); | ||
await component.getByText(/click/i).hover(); | ||
await expect(component.locator('button')).toHaveScreenshot(); | ||
}); | ||
test('', async({ render }) => { | ||
const component = await render( | ||
<Flex p={ 2 } flexDir="column" rowGap={ 3 }> | ||
{ states?.map((state) => { | ||
switch (state) { | ||
case 'default': { | ||
return ( | ||
<Box> | ||
<Box color="text_secondary" fontSize="sm">Default:</Box> | ||
<Button variant={ variant } colorScheme={ colorScheme }>Click me</Button> | ||
</Box> | ||
); | ||
} | ||
case 'disabled': { | ||
return ( | ||
<Box> | ||
<Box color="text_secondary" fontSize="sm">Disabled:</Box> | ||
<Button variant={ variant } colorScheme={ colorScheme } isDisabled>Click me</Button> | ||
</Box> | ||
); | ||
} | ||
case 'active': { | ||
return ( | ||
<Box> | ||
<Box color="text_secondary" fontSize="sm">Active:</Box> | ||
<Button variant={ variant } colorScheme={ colorScheme } isActive>Click me</Button> | ||
</Box> | ||
); | ||
} | ||
case 'hovered': { | ||
return ( | ||
<Box> | ||
<Box color="text_secondary" fontSize="sm">Hovered:</Box> | ||
<Button variant={ variant } colorScheme={ colorScheme }>Hover me</Button> | ||
</Box> | ||
); | ||
} | ||
case 'selected': { | ||
return ( | ||
<Box> | ||
<Box color="text_secondary" fontSize="sm">Selected:</Box> | ||
<Button variant={ variant } colorScheme={ colorScheme } data-selected="true">Click me</Button> | ||
</Box> | ||
); | ||
} | ||
|
||
test('active', async({ render }) => { | ||
const component = await render(<Button variant={ variant } colorScheme={ colorScheme } isActive>Click me</Button>); | ||
await expect(component.locator('button')).toHaveScreenshot(); | ||
default: { | ||
return null; | ||
} | ||
} | ||
}) } | ||
</Flex>, | ||
); | ||
await component.getByText('Hover me').hover(); | ||
await expect(component).toHaveScreenshot(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+7.5 KB
...ton/__screenshots__/Button.pw.tsx_dark-color-mode_variant-ghost-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.67 KB
...creenshots__/Button.pw.tsx_dark-color-mode_variant-ghost-dark-mode-active-1.png
Binary file not shown.
Binary file removed
BIN
-1.44 KB
..._screenshots__/Button.pw.tsx_dark-color-mode_variant-ghost-dark-mode-base-1.png
Binary file not shown.
Binary file removed
BIN
-1.25 KB
...eenshots__/Button.pw.tsx_dark-color-mode_variant-ghost-dark-mode-disabled-1.png
Binary file not shown.
Binary file removed
BIN
-1.65 KB
...reenshots__/Button.pw.tsx_dark-color-mode_variant-ghost-dark-mode-hovered-1.png
Binary file not shown.
Binary file added
BIN
+14.1 KB
...n.pw.tsx_dark-color-mode_variant-outline-with-blue-color-scheme-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.74 KB
...x_dark-color-mode_variant-outline-with-blue-color-scheme-dark-mode-active-1.png
Binary file not shown.
Binary file removed
BIN
-1.87 KB
...tsx_dark-color-mode_variant-outline-with-blue-color-scheme-dark-mode-base-1.png
Binary file not shown.
Binary file removed
BIN
-1.42 KB
...dark-color-mode_variant-outline-with-blue-color-scheme-dark-mode-disabled-1.png
Binary file not shown.
Binary file removed
BIN
-1.86 KB
..._dark-color-mode_variant-outline-with-blue-color-scheme-dark-mode-hovered-1.png
Binary file not shown.
Binary file added
BIN
+14 KB
...n.pw.tsx_dark-color-mode_variant-outline-with-gray-color-scheme-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.74 KB
...x_dark-color-mode_variant-outline-with-gray-color-scheme-dark-mode-active-1.png
Binary file not shown.
Binary file removed
BIN
-1.86 KB
...tsx_dark-color-mode_variant-outline-with-gray-color-scheme-dark-mode-base-1.png
Binary file not shown.
Binary file removed
BIN
-1.45 KB
...dark-color-mode_variant-outline-with-gray-color-scheme-dark-mode-disabled-1.png
Binary file not shown.
Binary file removed
BIN
-1.86 KB
..._dark-color-mode_variant-outline-with-gray-color-scheme-dark-mode-hovered-1.png
Binary file not shown.
Binary file removed
BIN
-1.74 KB
...k-color-mode_variant-outline-with-gray-dark-color-scheme-dark-mode-active-1.png
Binary file not shown.
Binary file removed
BIN
-1.86 KB
...ark-color-mode_variant-outline-with-gray-dark-color-scheme-dark-mode-base-1.png
Binary file not shown.
Binary file removed
BIN
-1.45 KB
...color-mode_variant-outline-with-gray-dark-color-scheme-dark-mode-disabled-1.png
Binary file not shown.
Binary file removed
BIN
-1.86 KB
...-color-mode_variant-outline-with-gray-dark-color-scheme-dark-mode-hovered-1.png
Binary file not shown.
Binary file added
BIN
+4.56 KB
...on/__screenshots__/Button.pw.tsx_dark-color-mode_variant-simple-dark-mode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-1.43 KB
...reenshots__/Button.pw.tsx_dark-color-mode_variant-simple-dark-mode-active-1.png
Binary file not shown.
Binary file removed
BIN
-1.43 KB
...screenshots__/Button.pw.tsx_dark-color-mode_variant-simple-dark-mode-base-1.png
Binary file not shown.
Binary file removed
BIN
-1.26 KB
...enshots__/Button.pw.tsx_dark-color-mode_variant-simple-dark-mode-disabled-1.png
Binary file not shown.
Binary file removed
BIN
-1.41 KB
...eenshots__/Button.pw.tsx_dark-color-mode_variant-simple-dark-mode-hovered-1.png
Binary file not shown.
Binary file removed
BIN
-1.66 KB
...tsx_dark-color-mode_variant-solid-with-gray-color-scheme-dark-mode-active-1.png
Binary file not shown.
Binary file removed
BIN
-1.67 KB
...w.tsx_dark-color-mode_variant-solid-with-gray-color-scheme-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.43 KB
...x_dark-color-mode_variant-solid-with-gray-color-scheme-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.66 KB
...sx_dark-color-mode_variant-solid-with-gray-color-scheme-dark-mode-hovered-1.png
Diff not rendered.
Binary file added
BIN
+5.15 KB
...on.pw.tsx_dark-color-mode_variant-subtle-with-gray-color-scheme-dark-mode-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.69 KB
...sx_dark-color-mode_variant-subtle-with-gray-color-scheme-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.69 KB
....tsx_dark-color-mode_variant-subtle-with-gray-color-scheme-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.42 KB
..._dark-color-mode_variant-subtle-with-gray-color-scheme-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.64 KB
...x_dark-color-mode_variant-subtle-with-gray-color-scheme-dark-mode-hovered-1.png
Diff not rendered.
Binary file added
BIN
+7.25 KB
...ents/Button/__screenshots__/Button.pw.tsx_default_variant-ghost-dark-mode-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.59 KB
...tton/__screenshots__/Button.pw.tsx_default_variant-ghost-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.43 KB
...Button/__screenshots__/Button.pw.tsx_default_variant-ghost-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.3 KB
...on/__screenshots__/Button.pw.tsx_default_variant-ghost-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.5 KB
...ton/__screenshots__/Button.pw.tsx_default_variant-ghost-dark-mode-hovered-1.png
Diff not rendered.
Binary file added
BIN
+13.5 KB
...__/Button.pw.tsx_default_variant-outline-with-blue-color-scheme-dark-mode-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.67 KB
...on.pw.tsx_default_variant-outline-with-blue-color-scheme-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.83 KB
...tton.pw.tsx_default_variant-outline-with-blue-color-scheme-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.45 KB
....pw.tsx_default_variant-outline-with-blue-color-scheme-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.75 KB
...n.pw.tsx_default_variant-outline-with-blue-color-scheme-dark-mode-hovered-1.png
Diff not rendered.
Binary file added
BIN
+13.3 KB
...__/Button.pw.tsx_default_variant-outline-with-gray-color-scheme-dark-mode-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.67 KB
...on.pw.tsx_default_variant-outline-with-gray-color-scheme-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.79 KB
...tton.pw.tsx_default_variant-outline-with-gray-color-scheme-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.38 KB
....pw.tsx_default_variant-outline-with-gray-color-scheme-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.75 KB
...n.pw.tsx_default_variant-outline-with-gray-color-scheme-dark-mode-hovered-1.png
Diff not rendered.
Binary file removed
BIN
-1.67 KB
....tsx_default_variant-outline-with-gray-dark-color-scheme-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.79 KB
...pw.tsx_default_variant-outline-with-gray-dark-color-scheme-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.38 KB
...sx_default_variant-outline-with-gray-dark-color-scheme-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.75 KB
...tsx_default_variant-outline-with-gray-dark-color-scheme-dark-mode-hovered-1.png
Diff not rendered.
Binary file added
BIN
+4.52 KB
...nts/Button/__screenshots__/Button.pw.tsx_default_variant-simple-dark-mode-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.42 KB
...ton/__screenshots__/Button.pw.tsx_default_variant-simple-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.42 KB
...utton/__screenshots__/Button.pw.tsx_default_variant-simple-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.27 KB
...n/__screenshots__/Button.pw.tsx_default_variant-simple-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.37 KB
...on/__screenshots__/Button.pw.tsx_default_variant-simple-dark-mode-hovered-1.png
Diff not rendered.
Binary file added
BIN
+10.3 KB
theme/components/Button/__screenshots__/Button.pw.tsx_default_variant-solid-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.7 KB
...ponents/Button/__screenshots__/Button.pw.tsx_default_variant-solid-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.68 KB
...omponents/Button/__screenshots__/Button.pw.tsx_default_variant-solid-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.32 KB
...nents/Button/__screenshots__/Button.pw.tsx_default_variant-solid-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.63 KB
...onents/Button/__screenshots__/Button.pw.tsx_default_variant-solid-hovered-1.png
Diff not rendered.
Binary file removed
BIN
-1.66 KB
...tton.pw.tsx_default_variant-solid-with-gray-color-scheme-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.62 KB
...Button.pw.tsx_default_variant-solid-with-gray-color-scheme-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.46 KB
...on.pw.tsx_default_variant-solid-with-gray-color-scheme-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.66 KB
...ton.pw.tsx_default_variant-solid-with-gray-color-scheme-dark-mode-hovered-1.png
Diff not rendered.
Binary file added
BIN
+4.93 KB
theme/components/Button/__screenshots__/Button.pw.tsx_default_variant-subtle-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.61 KB
...onents/Button/__screenshots__/Button.pw.tsx_default_variant-subtle-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.61 KB
...mponents/Button/__screenshots__/Button.pw.tsx_default_variant-subtle-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.35 KB
...ents/Button/__screenshots__/Button.pw.tsx_default_variant-subtle-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.52 KB
...nents/Button/__screenshots__/Button.pw.tsx_default_variant-subtle-hovered-1.png
Diff not rendered.
Binary file added
BIN
+4.94 KB
...s__/Button.pw.tsx_default_variant-subtle-with-gray-color-scheme-dark-mode-1.png
Oops, something went wrong.
Binary file removed
BIN
-1.6 KB
...ton.pw.tsx_default_variant-subtle-with-gray-color-scheme-dark-mode-active-1.png
Diff not rendered.
Binary file removed
BIN
-1.6 KB
...utton.pw.tsx_default_variant-subtle-with-gray-color-scheme-dark-mode-base-1.png
Diff not rendered.
Binary file removed
BIN
-1.37 KB
...n.pw.tsx_default_variant-subtle-with-gray-color-scheme-dark-mode-disabled-1.png
Diff not rendered.
Binary file removed
BIN
-1.51 KB
...on.pw.tsx_default_variant-subtle-with-gray-color-scheme-dark-mode-hovered-1.png
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.