@cloud-ru/uikit-product-site-navbar 0.2.16 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/components/SiteNavbar.d.ts +12 -1
- package/dist/cjs/components/SiteNavbar.js +6 -2
- package/dist/cjs/components/styles.module.css +4 -0
- package/dist/cjs/helperComponents/NavbarItem/NavbarItem.d.ts +2 -1
- package/dist/cjs/helperComponents/NavbarItem/NavbarItem.js +2 -2
- package/dist/cjs/helperComponents/NavbarItem/styles.module.css +7 -0
- package/dist/esm/components/SiteNavbar.d.ts +12 -1
- package/dist/esm/components/SiteNavbar.js +6 -2
- package/dist/esm/components/styles.module.css +4 -0
- package/dist/esm/helperComponents/NavbarItem/NavbarItem.d.ts +2 -1
- package/dist/esm/helperComponents/NavbarItem/NavbarItem.js +2 -2
- package/dist/esm/helperComponents/NavbarItem/styles.module.css +7 -0
- package/package.json +3 -3
- package/src/components/SiteNavbar.tsx +35 -3
- package/src/components/styles.module.scss +7 -0
- package/src/helperComponents/NavbarItem/NavbarItem.tsx +18 -3
- package/src/helperComponents/NavbarItem/styles.module.scss +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.3.1 (2025-12-08)
|
|
7
|
+
|
|
8
|
+
### Only dependencies have been changed
|
|
9
|
+
* [@cloud-ru/uikit-product-utils@8.0.2](https://gitverse.ru/cloud-ru-tech/uikit-product/-/blob/master/packages/utils/CHANGELOG.md)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# 0.3.0 (2025-12-04)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **SITE-10320:** edit hero main ([a85a31d](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/a85a31d49635867e75ae1dffec8ecb510d95a71e))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## 0.2.16 (2025-11-24)
|
|
7
27
|
|
|
8
28
|
### Only dependencies have been changed
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
2
2
|
import { NavbarItemProps } from '../helperComponents';
|
|
3
|
+
type AppearanceNeutral = {
|
|
4
|
+
colorText: 'neutral';
|
|
5
|
+
dividerBackgroundColor: 'neutral';
|
|
6
|
+
};
|
|
7
|
+
type AppearanceInvert = {
|
|
8
|
+
colorText: 'invert';
|
|
9
|
+
dividerBackgroundColor: 'invert';
|
|
10
|
+
};
|
|
11
|
+
type AppereanceType = AppearanceNeutral | AppearanceInvert;
|
|
3
12
|
export type SiteNavbarProps = WithSupportProps<{
|
|
4
13
|
items: NavbarItemProps[];
|
|
5
14
|
onItemClick(id: string, text: string): void;
|
|
6
15
|
active?: string;
|
|
7
16
|
className?: string;
|
|
8
17
|
topPosition?: number;
|
|
18
|
+
appereance?: AppereanceType;
|
|
9
19
|
}>;
|
|
10
|
-
export declare function SiteNavbar({ items, className, onItemClick, active, topPosition, ...rest }: SiteNavbarProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function SiteNavbar({ items, className, onItemClick, active, topPosition, appereance, ...rest }: SiteNavbarProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -22,7 +22,11 @@ const uikit_product_utils_1 = require("@cloud-ru/uikit-product-utils");
|
|
|
22
22
|
const divider_1 = require("@snack-uikit/divider");
|
|
23
23
|
const helperComponents_1 = require("../helperComponents");
|
|
24
24
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
25
|
+
const APPEARANCE_NEUTRAL = {
|
|
26
|
+
colorText: 'neutral',
|
|
27
|
+
dividerBackgroundColor: 'neutral',
|
|
28
|
+
};
|
|
25
29
|
function SiteNavbar(_a) {
|
|
26
|
-
var { items, className, onItemClick, active, topPosition } = _a, rest = __rest(_a, ["items", "className", "onItemClick", "active", "topPosition"]);
|
|
27
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.navbar, className), style: topPosition ? { top: `${topPosition}px` } : undefined }, (0, uikit_product_utils_1.extractSupportProps)(rest), { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, {}), (0, jsx_runtime_1.jsx)(react_indiana_drag_scroll_1.default, { className: styles_module_scss_1.default.navbarItemsWrapper, children: items.map(item => ((0, jsx_runtime_1.jsx)(helperComponents_1.NavbarItem, Object.assign({}, item, { active: active === item.id, onClick: onItemClick }), item.id))) })] })));
|
|
30
|
+
var { items, className, onItemClick, active, topPosition, appereance = APPEARANCE_NEUTRAL } = _a, rest = __rest(_a, ["items", "className", "onItemClick", "active", "topPosition", "appereance"]);
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(styles_module_scss_1.default.navbar, className), style: topPosition ? { top: `${topPosition}px` } : undefined }, (0, uikit_product_utils_1.extractSupportProps)(rest), { children: [(0, jsx_runtime_1.jsx)(divider_1.Divider, { className: styles_module_scss_1.default.divider, "data-background-color": appereance === null || appereance === void 0 ? void 0 : appereance.dividerBackgroundColor }), (0, jsx_runtime_1.jsx)(react_indiana_drag_scroll_1.default, { className: styles_module_scss_1.default.navbarItemsWrapper, children: items.map(item => ((0, jsx_runtime_1.jsx)(helperComponents_1.NavbarItem, Object.assign({}, item, { active: active === item.id, appereance: appereance === null || appereance === void 0 ? void 0 : appereance.colorText, onClick: onItemClick }), item.id))) })] })));
|
|
28
32
|
}
|
|
@@ -4,10 +4,11 @@ export type NavbarItemProps = {
|
|
|
4
4
|
text: string;
|
|
5
5
|
icon?: ReactElement;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
appereance?: 'neutral' | 'invert';
|
|
7
8
|
};
|
|
8
9
|
type Props = NavbarItemProps & {
|
|
9
10
|
active?: boolean;
|
|
10
11
|
onClick(id: string, text: string): void;
|
|
11
12
|
};
|
|
12
|
-
export declare function NavbarItem({ id, text, icon, onClick, active, disabled }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function NavbarItem({ id, text, icon, appereance, onClick, active, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -9,7 +9,7 @@ const react_1 = require("react");
|
|
|
9
9
|
const typography_1 = require("@snack-uikit/typography");
|
|
10
10
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
11
11
|
const KEYS = ['Space', 'Enter'];
|
|
12
|
-
function NavbarItem({ id, text, icon, onClick, active = false, disabled = false }) {
|
|
12
|
+
function NavbarItem({ id, text, icon, appereance = 'neutral', onClick, active = false, disabled = false, }) {
|
|
13
13
|
const handleClick = (0, react_1.useCallback)(() => {
|
|
14
14
|
onClick(id, text);
|
|
15
15
|
}, [id, onClick, text]);
|
|
@@ -19,5 +19,5 @@ function NavbarItem({ id, text, icon, onClick, active = false, disabled = false
|
|
|
19
19
|
handleClick();
|
|
20
20
|
}
|
|
21
21
|
}, [handleClick]);
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.navbarItem, "data-active": active || undefined, "data-disabled": disabled || undefined, onClick: disabled ? undefined : handleClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: disabled ? undefined : 0, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.background, "data-active": active || undefined, "data-disabled": disabled || undefined }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { family: 'sans', purpose: 'body', size: 'm', tag: 'div', className: styles_module_scss_1.default.text, "data-disabled": disabled || undefined, children: text }), icon && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.iconWrapper, "data-disabled": disabled || undefined, children: icon }))] }));
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.navbarItem, "data-active": active || undefined, "data-disabled": disabled || undefined, onClick: disabled ? undefined : handleClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: disabled ? undefined : 0, children: [(0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.background, "data-background-color": appereance, "data-active": active || undefined, "data-disabled": disabled || undefined }), (0, jsx_runtime_1.jsx)(typography_1.Typography, { family: 'sans', purpose: 'body', size: 'm', tag: 'div', className: styles_module_scss_1.default.text, "data-disabled": disabled || undefined, "data-text-color": appereance, children: text }), icon && ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.iconWrapper, "data-text-color": appereance, "data-disabled": disabled || undefined, children: icon }))] }));
|
|
23
23
|
}
|
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
.background[data-disabled]{
|
|
61
61
|
background-color:transparent;
|
|
62
62
|
}
|
|
63
|
+
.background[data-background-color=invert]:hover{
|
|
64
|
+
background-color:var(--sys-invert-neutral-accent-default, #cfd2dc);
|
|
65
|
+
}
|
|
63
66
|
|
|
64
67
|
.text{
|
|
65
68
|
white-space:nowrap;
|
|
@@ -76,4 +79,8 @@
|
|
|
76
79
|
.text[data-disabled],
|
|
77
80
|
.iconWrapper[data-disabled]{
|
|
78
81
|
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
82
|
+
}
|
|
83
|
+
.text[data-text-color=invert],
|
|
84
|
+
.iconWrapper[data-text-color=invert]{
|
|
85
|
+
color:var(--sys-invert-neutral-text-main, #e6e8ef);
|
|
79
86
|
}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
2
2
|
import { NavbarItemProps } from '../helperComponents';
|
|
3
|
+
type AppearanceNeutral = {
|
|
4
|
+
colorText: 'neutral';
|
|
5
|
+
dividerBackgroundColor: 'neutral';
|
|
6
|
+
};
|
|
7
|
+
type AppearanceInvert = {
|
|
8
|
+
colorText: 'invert';
|
|
9
|
+
dividerBackgroundColor: 'invert';
|
|
10
|
+
};
|
|
11
|
+
type AppereanceType = AppearanceNeutral | AppearanceInvert;
|
|
3
12
|
export type SiteNavbarProps = WithSupportProps<{
|
|
4
13
|
items: NavbarItemProps[];
|
|
5
14
|
onItemClick(id: string, text: string): void;
|
|
6
15
|
active?: string;
|
|
7
16
|
className?: string;
|
|
8
17
|
topPosition?: number;
|
|
18
|
+
appereance?: AppereanceType;
|
|
9
19
|
}>;
|
|
10
|
-
export declare function SiteNavbar({ items, className, onItemClick, active, topPosition, ...rest }: SiteNavbarProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function SiteNavbar({ items, className, onItemClick, active, topPosition, appereance, ...rest }: SiteNavbarProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -16,7 +16,11 @@ import { extractSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
|
16
16
|
import { Divider } from '@snack-uikit/divider';
|
|
17
17
|
import { NavbarItem } from '../helperComponents';
|
|
18
18
|
import styles from './styles.module.css';
|
|
19
|
+
const APPEARANCE_NEUTRAL = {
|
|
20
|
+
colorText: 'neutral',
|
|
21
|
+
dividerBackgroundColor: 'neutral',
|
|
22
|
+
};
|
|
19
23
|
export function SiteNavbar(_a) {
|
|
20
|
-
var { items, className, onItemClick, active, topPosition } = _a, rest = __rest(_a, ["items", "className", "onItemClick", "active", "topPosition"]);
|
|
21
|
-
return (_jsxs("div", Object.assign({ className: cn(styles.navbar, className), style: topPosition ? { top: `${topPosition}px` } : undefined }, extractSupportProps(rest), { children: [_jsx(Divider, {}), _jsx(ScrollContainer, { className: styles.navbarItemsWrapper, children: items.map(item => (_jsx(NavbarItem, Object.assign({}, item, { active: active === item.id, onClick: onItemClick }), item.id))) })] })));
|
|
24
|
+
var { items, className, onItemClick, active, topPosition, appereance = APPEARANCE_NEUTRAL } = _a, rest = __rest(_a, ["items", "className", "onItemClick", "active", "topPosition", "appereance"]);
|
|
25
|
+
return (_jsxs("div", Object.assign({ className: cn(styles.navbar, className), style: topPosition ? { top: `${topPosition}px` } : undefined }, extractSupportProps(rest), { children: [_jsx(Divider, { className: styles.divider, "data-background-color": appereance === null || appereance === void 0 ? void 0 : appereance.dividerBackgroundColor }), _jsx(ScrollContainer, { className: styles.navbarItemsWrapper, children: items.map(item => (_jsx(NavbarItem, Object.assign({}, item, { active: active === item.id, appereance: appereance === null || appereance === void 0 ? void 0 : appereance.colorText, onClick: onItemClick }), item.id))) })] })));
|
|
22
26
|
}
|
|
@@ -4,10 +4,11 @@ export type NavbarItemProps = {
|
|
|
4
4
|
text: string;
|
|
5
5
|
icon?: ReactElement;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
appereance?: 'neutral' | 'invert';
|
|
7
8
|
};
|
|
8
9
|
type Props = NavbarItemProps & {
|
|
9
10
|
active?: boolean;
|
|
10
11
|
onClick(id: string, text: string): void;
|
|
11
12
|
};
|
|
12
|
-
export declare function NavbarItem({ id, text, icon, onClick, active, disabled }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function NavbarItem({ id, text, icon, appereance, onClick, active, disabled, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -3,7 +3,7 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import { Typography } from '@snack-uikit/typography';
|
|
4
4
|
import styles from './styles.module.css';
|
|
5
5
|
const KEYS = ['Space', 'Enter'];
|
|
6
|
-
export function NavbarItem({ id, text, icon, onClick, active = false, disabled = false }) {
|
|
6
|
+
export function NavbarItem({ id, text, icon, appereance = 'neutral', onClick, active = false, disabled = false, }) {
|
|
7
7
|
const handleClick = useCallback(() => {
|
|
8
8
|
onClick(id, text);
|
|
9
9
|
}, [id, onClick, text]);
|
|
@@ -13,5 +13,5 @@ export function NavbarItem({ id, text, icon, onClick, active = false, disabled =
|
|
|
13
13
|
handleClick();
|
|
14
14
|
}
|
|
15
15
|
}, [handleClick]);
|
|
16
|
-
return (_jsxs("div", { className: styles.navbarItem, "data-active": active || undefined, "data-disabled": disabled || undefined, onClick: disabled ? undefined : handleClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: disabled ? undefined : 0, children: [_jsx("div", { className: styles.background, "data-active": active || undefined, "data-disabled": disabled || undefined }), _jsx(Typography, { family: 'sans', purpose: 'body', size: 'm', tag: 'div', className: styles.text, "data-disabled": disabled || undefined, children: text }), icon && (_jsx("div", { className: styles.iconWrapper, "data-disabled": disabled || undefined, children: icon }))] }));
|
|
16
|
+
return (_jsxs("div", { className: styles.navbarItem, "data-active": active || undefined, "data-disabled": disabled || undefined, onClick: disabled ? undefined : handleClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: disabled ? undefined : 0, children: [_jsx("div", { className: styles.background, "data-background-color": appereance, "data-active": active || undefined, "data-disabled": disabled || undefined }), _jsx(Typography, { family: 'sans', purpose: 'body', size: 'm', tag: 'div', className: styles.text, "data-disabled": disabled || undefined, "data-text-color": appereance, children: text }), icon && (_jsx("div", { className: styles.iconWrapper, "data-text-color": appereance, "data-disabled": disabled || undefined, children: icon }))] }));
|
|
17
17
|
}
|
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
.background[data-disabled]{
|
|
61
61
|
background-color:transparent;
|
|
62
62
|
}
|
|
63
|
+
.background[data-background-color=invert]:hover{
|
|
64
|
+
background-color:var(--sys-invert-neutral-accent-default, #cfd2dc);
|
|
65
|
+
}
|
|
63
66
|
|
|
64
67
|
.text{
|
|
65
68
|
white-space:nowrap;
|
|
@@ -76,4 +79,8 @@
|
|
|
76
79
|
.text[data-disabled],
|
|
77
80
|
.iconWrapper[data-disabled]{
|
|
78
81
|
color:var(--sys-neutral-text-disabled, #aaaebd);
|
|
82
|
+
}
|
|
83
|
+
.text[data-text-color=invert],
|
|
84
|
+
.iconWrapper[data-text-color=invert]{
|
|
85
|
+
color:var(--sys-invert-neutral-text-main, #e6e8ef);
|
|
79
86
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/uikit-product-site-navbar",
|
|
3
3
|
"title": "Site Navbar",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
7
7
|
"*.woff",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@cloud-ru/uikit-product-utils": "8.0.
|
|
39
|
+
"@cloud-ru/uikit-product-utils": "8.0.2",
|
|
40
40
|
"@snack-uikit/divider": "3.2.3",
|
|
41
41
|
"@snack-uikit/typography": "0.8.4",
|
|
42
42
|
"classnames": "2.5.1",
|
|
43
43
|
"react-indiana-drag-scroll": "2.2.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "ab61e93fe6f723c522e95a7c5540b3080de6b2de"
|
|
46
46
|
}
|
|
@@ -7,25 +7,57 @@ import { Divider } from '@snack-uikit/divider';
|
|
|
7
7
|
import { NavbarItem, NavbarItemProps } from '../helperComponents';
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
|
|
10
|
+
type AppearanceNeutral = {
|
|
11
|
+
colorText: 'neutral';
|
|
12
|
+
dividerBackgroundColor: 'neutral';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type AppearanceInvert = {
|
|
16
|
+
colorText: 'invert';
|
|
17
|
+
dividerBackgroundColor: 'invert';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type AppereanceType = AppearanceNeutral | AppearanceInvert;
|
|
21
|
+
|
|
22
|
+
const APPEARANCE_NEUTRAL: AppearanceNeutral = {
|
|
23
|
+
colorText: 'neutral',
|
|
24
|
+
dividerBackgroundColor: 'neutral',
|
|
25
|
+
};
|
|
26
|
+
|
|
10
27
|
export type SiteNavbarProps = WithSupportProps<{
|
|
11
28
|
items: NavbarItemProps[];
|
|
12
29
|
onItemClick(id: string, text: string): void;
|
|
13
30
|
active?: string;
|
|
14
31
|
className?: string;
|
|
15
32
|
topPosition?: number;
|
|
33
|
+
appereance?: AppereanceType;
|
|
16
34
|
}>;
|
|
17
35
|
|
|
18
|
-
export function SiteNavbar({
|
|
36
|
+
export function SiteNavbar({
|
|
37
|
+
items,
|
|
38
|
+
className,
|
|
39
|
+
onItemClick,
|
|
40
|
+
active,
|
|
41
|
+
topPosition,
|
|
42
|
+
appereance = APPEARANCE_NEUTRAL,
|
|
43
|
+
...rest
|
|
44
|
+
}: SiteNavbarProps) {
|
|
19
45
|
return (
|
|
20
46
|
<div
|
|
21
47
|
className={cn(styles.navbar, className)}
|
|
22
48
|
style={topPosition ? { top: `${topPosition}px` } : undefined}
|
|
23
49
|
{...extractSupportProps(rest)}
|
|
24
50
|
>
|
|
25
|
-
<Divider />
|
|
51
|
+
<Divider className={styles.divider} data-background-color={appereance?.dividerBackgroundColor} />
|
|
26
52
|
<ScrollContainer className={styles.navbarItemsWrapper}>
|
|
27
53
|
{items.map(item => (
|
|
28
|
-
<NavbarItem
|
|
54
|
+
<NavbarItem
|
|
55
|
+
key={item.id}
|
|
56
|
+
{...item}
|
|
57
|
+
active={active === item.id}
|
|
58
|
+
appereance={appereance?.colorText}
|
|
59
|
+
onClick={onItemClick}
|
|
60
|
+
/>
|
|
29
61
|
))}
|
|
30
62
|
</ScrollContainer>
|
|
31
63
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/components/styles-tokens-element' as ste;
|
|
1
2
|
.navbar {
|
|
2
3
|
display: flex;
|
|
3
4
|
flex-direction: column;
|
|
@@ -12,3 +13,9 @@
|
|
|
12
13
|
max-width: 100%;
|
|
13
14
|
scrollbar-width: none;
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
.divider {
|
|
18
|
+
&[data-background-color='invert'] {
|
|
19
|
+
background-color: ste.$sys-invert-neutral-decor-default;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -9,6 +9,7 @@ export type NavbarItemProps = {
|
|
|
9
9
|
text: string;
|
|
10
10
|
icon?: ReactElement;
|
|
11
11
|
disabled?: boolean;
|
|
12
|
+
appereance?: 'neutral' | 'invert';
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
const KEYS = ['Space', 'Enter'];
|
|
@@ -18,7 +19,15 @@ type Props = NavbarItemProps & {
|
|
|
18
19
|
onClick(id: string, text: string): void;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
export function NavbarItem({
|
|
22
|
+
export function NavbarItem({
|
|
23
|
+
id,
|
|
24
|
+
text,
|
|
25
|
+
icon,
|
|
26
|
+
appereance = 'neutral',
|
|
27
|
+
onClick,
|
|
28
|
+
active = false,
|
|
29
|
+
disabled = false,
|
|
30
|
+
}: Props) {
|
|
22
31
|
const handleClick = useCallback(() => {
|
|
23
32
|
onClick(id, text);
|
|
24
33
|
}, [id, onClick, text]);
|
|
@@ -42,7 +51,12 @@ export function NavbarItem({ id, text, icon, onClick, active = false, disabled =
|
|
|
42
51
|
onKeyDown={disabled ? undefined : handleKeyDown}
|
|
43
52
|
tabIndex={disabled ? undefined : 0}
|
|
44
53
|
>
|
|
45
|
-
<div
|
|
54
|
+
<div
|
|
55
|
+
className={styles.background}
|
|
56
|
+
data-background-color={appereance}
|
|
57
|
+
data-active={active || undefined}
|
|
58
|
+
data-disabled={disabled || undefined}
|
|
59
|
+
/>
|
|
46
60
|
<Typography
|
|
47
61
|
family='sans'
|
|
48
62
|
purpose='body'
|
|
@@ -50,11 +64,12 @@ export function NavbarItem({ id, text, icon, onClick, active = false, disabled =
|
|
|
50
64
|
tag='div'
|
|
51
65
|
className={styles.text}
|
|
52
66
|
data-disabled={disabled || undefined}
|
|
67
|
+
data-text-color={appereance}
|
|
53
68
|
>
|
|
54
69
|
{text}
|
|
55
70
|
</Typography>
|
|
56
71
|
{icon && (
|
|
57
|
-
<div className={styles.iconWrapper} data-disabled={disabled || undefined}>
|
|
72
|
+
<div className={styles.iconWrapper} data-text-color={appereance} data-disabled={disabled || undefined}>
|
|
58
73
|
{icon}
|
|
59
74
|
</div>
|
|
60
75
|
)}
|
|
@@ -79,6 +79,12 @@
|
|
|
79
79
|
&[data-disabled] {
|
|
80
80
|
background-color: transparent;
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
&[data-background-color='invert'] {
|
|
84
|
+
&:hover {
|
|
85
|
+
background-color: var.$sys-invert-neutral-accent-default;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
.text {
|
|
@@ -96,4 +102,8 @@
|
|
|
96
102
|
&[data-disabled] {
|
|
97
103
|
color: var.$sys-neutral-text-disabled;
|
|
98
104
|
}
|
|
105
|
+
|
|
106
|
+
&[data-text-color='invert'] {
|
|
107
|
+
color: var.$sys-invert-neutral-text-main;
|
|
108
|
+
}
|
|
99
109
|
}
|