diff --git a/packages/vkui/src/components/SubnavigationButton/Readme.md b/packages/vkui/src/components/SubnavigationButton/Readme.md index e96830b9db..c35ec28ef8 100644 --- a/packages/vkui/src/components/SubnavigationButton/Readme.md +++ b/packages/vkui/src/components/SubnavigationButton/Readme.md @@ -7,6 +7,7 @@ ```jsx { "props": { "layout": false, "iframe": false } } const SubnavigationButtonExample = () => { + const [appearance, setAppearance] = useState('accent'); const [textLevel, setTextLevel] = useState('2'); const [sizeY, setSizeY] = useState('compact'); const [size, setSize] = useState('m'); @@ -29,11 +30,12 @@ const SubnavigationButtonExample = () => { width: '100%', }} > - {['primary', 'tertiary', 'outline'].map((mode) => ( + {['primary', 'outline', 'tertiary'].map((mode) => (
{
+ + ], mode: ['primary', 'outline', 'tertiary'], + appearance: ['accent', 'neutral'], after: [ 3 diff --git a/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.module.css b/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.module.css index 7128a3301c..fe9fca02ae 100644 --- a/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.module.css +++ b/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.module.css @@ -109,6 +109,15 @@ box-shadow: inset 0 0 0 var(--vkui_internal--thin_border) var(--vkui--color_field_border_alpha); } +/** + * appearance + */ + +.SubnavigationButton--appearance-neutral .SubnavigationButton__expandableIcon, +.SubnavigationButton--appearance-neutral .SubnavigationButton__before { + color: var(--vkui--color_icon_primary); +} + /** * selected */ @@ -120,14 +129,19 @@ border: 0; } -.SubnavigationButton--selected.SubnavigationButton--mode-tertiary { +.SubnavigationButton--selected.SubnavigationButton--mode-tertiary, +.SubnavigationButton--selected.SubnavigationButton--appearance-neutral { background-color: var(--vkui--color_transparent--active); color: var(--vkui--color_text_primary); } -.SubnavigationButton--selected:not(.SubnavigationButton--mode-tertiary) +.SubnavigationButton--selected.SubnavigationButton--appearance-accent:not( + .SubnavigationButton--mode-tertiary + ) .SubnavigationButton__before, -.SubnavigationButton--selected:not(.SubnavigationButton--mode-tertiary) +.SubnavigationButton--selected.SubnavigationButton--appearance-accent:not( + .SubnavigationButton--mode-tertiary + ) .SubnavigationButton__expandableIcon { color: var(--vkui--color_icon_contrast_themed); } @@ -142,11 +156,18 @@ --vkui_internal--counter_inherit_color: var(--vkui--color_text_contrast_themed); } -.SubnavigationButton--selected:not(.SubnavigationButton--mode-tertiary) { +.SubnavigationButton--selected.SubnavigationButton--appearance-accent:not( + .SubnavigationButton--mode-tertiary + ) { --vkui_internal--counter_inherit_background: var(--vkui--color_background_content); --vkui_internal--counter_inherit_color: var(--vkui--color_text_accent_themed); } +.SubnavigationButton--selected.SubnavigationButton--appearance-neutral { + --vkui_internal--counter_inherit_background: var(--vkui--color_background_content); + --vkui_internal--counter_inherit_color: var(--vkui--color_text_primary); +} + :global(.vkuiInternalSubnavigationBar--mode-fixed) .SubnavigationButton { flex: 1; min-width: 0; diff --git a/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.tsx b/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.tsx index 80ef776f1c..aa0afefd8c 100644 --- a/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.tsx +++ b/packages/vkui/src/components/SubnavigationButton/SubnavigationButton.tsx @@ -9,6 +9,23 @@ import { Caption } from '../Typography/Caption/Caption'; import { Subhead } from '../Typography/Subhead/Subhead'; import styles from './SubnavigationButton.module.css'; +const appearanceStyles = { + accent: styles['SubnavigationButton--appearance-accent'], + neutral: styles['SubnavigationButton--appearance-neutral'], +}; + +const modeStyles = { + primary: styles['SubnavigationButton--mode-primary'], + outline: styles['SubnavigationButton--mode-outline'], + tertiary: styles['SubnavigationButton--mode-tertiary'], +}; + +const sizeStyles = { + s: styles['SubnavigationButton--size-s'], + m: styles['SubnavigationButton--size-m'], + l: styles['SubnavigationButton--size-l'], +}; + const sizeYClassNames = { none: styles['SubnavigationButton--sizeY-none'], [SizeType.COMPACT]: styles['SubnavigationButton--sizeY-compact'], @@ -16,6 +33,7 @@ const sizeYClassNames = { export interface SubnavigationButtonProps extends Omit { mode?: 'primary' | 'outline' | 'tertiary'; + appearance?: 'accent' | 'neutral'; size?: 's' | 'm' | 'l'; selected?: boolean; /** @@ -56,6 +74,7 @@ const SubnavigationButtonTypography = ({ */ export const SubnavigationButton = ({ mode = 'primary', + appearance = 'accent', size = 'm', selected, textLevel = '1', @@ -75,16 +94,9 @@ export const SubnavigationButton = ({ focusVisibleMode="outside" className={classNames( styles['SubnavigationButton'], - { - s: styles['SubnavigationButton--size-s'], - m: styles['SubnavigationButton--size-m'], - l: styles['SubnavigationButton--size-l'], - }[size], - { - primary: styles['SubnavigationButton--mode-primary'], - outline: styles['SubnavigationButton--mode-outline'], - tertiary: styles['SubnavigationButton--mode-tertiary'], - }[mode], + sizeStyles[size], + modeStyles[mode], + appearanceStyles[appearance], selected && styles['SubnavigationButton--selected'], sizeY !== SizeType.REGULAR && sizeYClassNames[sizeY], className, diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-dark-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-dark-1-snap.png index 3db974cea5..194988b027 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-dark-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1778a44e686debd97e929fe8071e3849605a84debc94009b606578e5054c90c -size 263118 +oid sha256:839d95039788be224aa93c3202639b33aeecf607a9d26378f741a76567b5ab85 +size 320278 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-light-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-light-1-snap.png index fe43c6d7bf..1ee16269df 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-light-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-android-chromium-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3cce46df31107cca531b27d30bc29af46d650b7c754f794ac9eb8a6e6f7dab8c -size 277785 +oid sha256:393d32b0fc013f6e1ecd22d0dedea94f4d447fd69997207e152f5bfc47c0dffc +size 335824 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-dark-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-dark-1-snap.png index 427c961259..1d24ad06a5 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-dark-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1c47bfadd18292e0399804cbefd3ac21238e7363dceecc3e4544f8db157fa51 -size 246276 +oid sha256:8c586c5ad4e670c00997fd2c5a8a0aba6f419ad28c906b8dccc8d064f41cb2d6 +size 299862 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-light-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-light-1-snap.png index 76faf68ae0..bc8be9b162 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-light-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-ios-webkit-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3549e3fdd55e0ec986a414afba447e7f47e07cdcddf9f537086edde17c85cec9 -size 260730 +oid sha256:d6ae8f3e9aa0c38bffca1b23501f71e860dfd35ca27fc011604fa64053c22f00 +size 315412 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-dark-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-dark-1-snap.png index 1c0ea370b6..3dedcf5f80 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-dark-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb2ad49a1dd3e293302320dc07881f847effc83622e10408615a8368ca567122 -size 185233 +oid sha256:7e79cf37e9d93c92c4f2bb2a9e29b3868a17dd020a0e95108a9face7a6e5c885 +size 238666 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-light-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-light-1-snap.png index 7ec85d186d..564e2d649c 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-light-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-chromium-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c02b43c9e2826ed63fb8ebde9f3facd14e6cbd81f124e42e4be6db630ec55d84 -size 195264 +oid sha256:4e6f689c8069a907199a855da4a0597326ce66acd7d0798efdd1d39800794864 +size 249585 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-dark-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-dark-1-snap.png index f540b09ea5..194d1996d1 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-dark-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7a3150c42d067601acb6628de2285f6a3b09169eebd0a89a5de8323c898e47ae -size 226645 +oid sha256:6b71137fb40ec5866c3845b85ab38b438d8d78c8c132bd94989bdaa32c6c8b74 +size 307712 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-light-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-light-1-snap.png index 35db7d3367..51dd69d67b 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-light-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-firefox-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e708a327c29af953a093fb55d99a0d0b2a4e6109f9c48f6a1d897650f594aac5 -size 238624 +oid sha256:ed6b9826b228d48e5c49ed983e2aefa8134db4678528c93e4a02d06836d24c43 +size 320376 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-dark-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-dark-1-snap.png index cf45457955..248c84e8d6 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-dark-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-dark-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:130c0e497814554ad100d75a2985d60b18e85bd029a72be611428e5c6979985a -size 168845 +oid sha256:439c964b698f5d464ddf02fedae66f4d5da32f139382afb00ea9c63fc4c297e6 +size 217439 diff --git a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-light-1-snap.png b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-light-1-snap.png index c7f9e87fde..e28dc7445a 100644 --- a/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-light-1-snap.png +++ b/packages/vkui/src/components/SubnavigationButton/__image_snapshots__/subnavigationbutton-vkcom-webkit-light-1-snap.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:03e0628716f62232828e15626bd18b7052b8089c4de382c58dc187b2124f2f67 -size 179818 +oid sha256:182fde661c93cae2c567361c244be33a9c6ceae29f118e9cca848db1c12b9e12 +size 230021