Skip to content

Commit 9b93356

Browse files
author
Karthik B
authored
Fix mobile nav menu styles in web-components (#373)
- the close icon should be on the left, not right - also remove extra margin for titles that aren't separated by a divider, this no-separator option was added for funder portal but style wasn't adjusted - does not affect the terraware use-case
1 parent 6c97ca8 commit 9b93356

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/components/Navbar/NavSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function NavSection(props: Props): JSX.Element {
1212
return (
1313
<div className='nav-section'>
1414
{separator && <div className='divider' />}
15-
{title && <span className='nav-section--title'>{title}</span>}
15+
{title && <span className={`nav-section--title ${separator ? '' : 'no-separator'}`}>{title}</span>}
1616
</div>
1717
);
1818
}

src/components/Navbar/Navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const useStyles = makeStyles((theme: Theme) => ({
2525
},
2626
navBarTop: {
2727
display: 'flex',
28-
justifyContent: 'end',
28+
justifyContent: 'start',
2929
},
3030
}));
3131

src/components/Navbar/styles.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
color: $tw-clr-txt;
3838
display: block;
3939
margin-top: $tw-spc-base-small;
40+
41+
&.no-separator {
42+
margin-top: 0;
43+
}
4044
}
4145
}
4246

src/stories/Navbar.stories.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ export default {
1414
},
1515
};
1616

17-
const Template: Story<NavbarProps> = (args) => {
17+
const Template = (args: NavbarProps & { title?: boolean }) => {
1818
const [selectedItem, setSelectedItem] = React.useState('accessions');
1919

2020
// tslint:disable-next-line:no-empty
2121
const showNavbar = (show: any) => {};
2222

2323
return (
2424
<Navbar setShowNavBar={showNavbar} backgroundTransparent={args.backgroundTransparent}>
25+
{args.title && <NavSection title='Account' separator={false} />}
2526
<NavItem label='Home' icon='home' selected={selectedItem === 'home'} onClick={() => setSelectedItem('home')} />
2627
<NavItem label='Species' icon='species' selected={selectedItem === 'species'} onClick={() => setSelectedItem('species')} />
2728
<NavSection />
@@ -55,4 +56,9 @@ const Template: Story<NavbarProps> = (args) => {
5556
);
5657
};
5758

58-
export const Default = Template.bind({});
59+
const WithoutTitle: Story<NavbarProps> = (args) => (<Template {...args} />);
60+
const WithTitle: Story<NavbarProps> = (args) => (<Template {...args} title={true} />);
61+
62+
export const Default = WithoutTitle.bind({});
63+
64+
export const Title = WithTitle.bind({});

0 commit comments

Comments
 (0)