Skip to content

Commit 5cbbc82

Browse files
committed
WIP(ui-top-nav-bar): add more changes after review
1 parent a97ebf4 commit 5cbbc82

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

packages/__docs__/src/App/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ class App extends Component<AppProps, AppState> {
10251025
>
10261026
<CanvasTopNav
10271027
brand={brandSvg}
1028-
lightMode={true}
1028+
lightMode={false}
10291029
breadcrumb={{
10301030
label: 'You are here:',
10311031
links: [
@@ -1039,11 +1039,13 @@ class App extends Component<AppProps, AppState> {
10391039
mobileButtons={[
10401040
{
10411041
screenReaderLabel: 'Analytics',
1042-
icon: <IconAnalyticsLine />
1042+
icon: <IconAnalyticsLine />,
1043+
onClick: () => alert('Analytics clicked')
10431044
},
10441045
{
10451046
screenReaderLabel: 'Alerts',
1046-
icon: <IconAlertsLine />
1047+
icon: <IconAlertsLine />,
1048+
onClick: () => alert('Alerts clicked')
10471049
}
10481050
]}
10491051
mobileMenuBackNavigation={{ href: '#', label: 'Back' }}

packages/ui-top-nav-bar/src/CanvasTopNav/index.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ const CanvasTopNav = ({
7676
withBackground={false}
7777
withBorder={false}
7878
screenReaderLabel={button.screenReaderLabel}
79-
color={lightMode ? 'secondary' : button.color}
79+
color={lightMode ? 'primary' : 'primary-inverse'}
80+
onClick={button.onClick}
8081
>
8182
{button.icon}
8283
</IconButton>
@@ -87,7 +88,7 @@ const CanvasTopNav = ({
8788
<BreadcrumbLink
8889
href={mobileMenuBackNavigation.href}
8990
isWithinText={false}
90-
color={lightMode ? 'link' : 'link-inverse'}
91+
color={lightMode ? 'link' : 'primary-inverse'}
9192
>
9293
<div
9394
style={{
@@ -101,8 +102,7 @@ const CanvasTopNav = ({
101102
</div>
102103
</BreadcrumbLink>
103104
</Breadcrumb>
104-
<MobileTopNav.Title>{mobileMenuTitle}</MobileTopNav.Title>
105-
<MobileTopNav.ItemList>
105+
<MobileTopNav.ItemList title={mobileMenuTitle}>
106106
{mobileMenu.map((item, index) => (
107107
<MobileTopNav.Item
108108
key={index}
@@ -128,17 +128,19 @@ const CanvasTopNav = ({
128128
>
129129
<IconHamburgerLine />
130130
</IconButton>
131-
<Breadcrumb label={breadcrumb.label}>
132-
{breadcrumb.links.map((link, index) =>
133-
link.href ? (
134-
<Breadcrumb.Link key={index} href={link.href}>
135-
{link.label}
136-
</Breadcrumb.Link>
137-
) : (
138-
<Breadcrumb.Link key={index}>{link.label}</Breadcrumb.Link>
139-
)
140-
)}
141-
</Breadcrumb>
131+
<div style={{ minWidth: '100%' }}>
132+
<Breadcrumb label={breadcrumb.label}>
133+
{breadcrumb.links.map((link, index) =>
134+
link.href ? (
135+
<Breadcrumb.Link key={index} href={link.href}>
136+
{link.label}
137+
</Breadcrumb.Link>
138+
) : (
139+
<Breadcrumb.Link key={index}>{link.label}</Breadcrumb.Link>
140+
)
141+
)}
142+
</Breadcrumb>
143+
</div>
142144
</DesktopTopNav.Start>
143145
<DesktopTopNav.End>
144146
<Button renderIcon={IconAddLine}>IconAddLine</Button>

packages/ui-top-nav-bar/src/MobileTopNav/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const MobileTopNav = ({
7676
withBackground={false}
7777
withBorder={false}
7878
screenReaderLabel="burgir"
79-
color={lightMode ? 'secondary' : 'primary-inverse'}
79+
color={lightMode ? 'primary' : 'primary-inverse'}
8080
onClick={() => setOpen((open) => !open)}
8181
>
8282
{open ? <IconXLine /> : <IconHamburgerLine />}
@@ -105,10 +105,12 @@ Title.displayName = 'Title'
105105

106106
const ItemList = ({
107107
children,
108+
title,
108109
styles
109-
}: PropsWithChildren & { styles: any }) => {
110+
}: PropsWithChildren & { styles: any; title: any }) => {
110111
return (
111112
<Fragment>
113+
{title && <Title>{title}</Title>}
112114
{Children.map(children, (child, index) => (
113115
<Fragment>
114116
{child}

0 commit comments

Comments
 (0)