forked from uber/baseweb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-nav-bar-icon-overrides.scenario.tsx
More file actions
88 lines (80 loc) · 2.25 KB
/
Copy pathapp-nav-bar-icon-overrides.scenario.tsx
File metadata and controls
88 lines (80 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
Copyright (c) Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import { ThemeProvider } from '../../styles';
import { LightTheme } from '../../themes';
import type { NavItem } from '../types';
import AppNavBar from '../app-nav-bar';
import { setItemActive } from '../utils';
import type { IconProps } from '../../icon/types';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const XSmallFilled = ({ title, size, color, ...props }: IconProps) => {
return (
<svg width={size} height={size} viewBox="0 0 24 24" fill="none">
<title>{title}</title>
<path
d="M18.1 8.1l-2.2-2.2-3.9 4-3.9-4-2.2 2.2 4 3.9-4 3.9 2.2 2.2 3.9-4 3.9 4 2.2-2.2-4-3.9 4-3.9z"
fill={color}
/>
</svg>
);
};
export function Scenario() {
const [mainItems, setMainItems] = React.useState<NavItem[]>([
{ label: 'Primary A' },
{ label: 'Primary B' },
{
label: 'Primary C',
children: [
{ label: 'Secondary A' },
{ label: 'Secondary B' },
{ label: 'Secondary C' },
{ label: 'Secondary D' },
],
},
{
label: 'Primary D',
children: [
{
label: 'Secondary E',
children: [{ label: 'Tertiary A' }, { label: 'Tertiary B' }],
},
{ label: 'Secondary F' },
],
},
]);
const userItems = [
{ label: 'Account item1' },
{ label: 'Account item2' },
{ label: 'Account item3' },
{ label: 'Account item4' },
];
function handleMainItemSelect(item) {
setMainItems((prev) => setItemActive(prev, item));
}
return (
<ThemeProvider
theme={{
...LightTheme,
icons: {
ChevronDown: (p) => <XSmallFilled {...p} color="pink" />,
ChevronUp: (p) => <XSmallFilled {...p} color="green" />,
},
}}
>
<AppNavBar
title="Uber Something"
mainItems={mainItems}
userItems={userItems}
onMainItemSelect={handleMainItemSelect}
onUserItemSelect={(item) => console.log('user', item)}
username="Umka Marshmallow"
usernameSubtitle="5.0"
userImgUrl=""
/>
</ThemeProvider>
);
}