-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1337 from nextstrain/feat/web-ui-tweaks
- Loading branch information
Showing
8 changed files
with
136 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
packages_rs/nextclade-web/src/components/Layout/NavigationMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { ReactNode, useCallback, useState } from 'react' | ||
import { | ||
Dropdown as DropdownBase, | ||
DropdownToggle as DropdownToggleBase, | ||
DropdownMenu as DropdownMenuBase, | ||
DropdownProps, | ||
} from 'reactstrap' | ||
import styled from 'styled-components' | ||
import { MdOutlineMenu } from 'react-icons/md' | ||
|
||
export interface NavigationMenuProps extends DropdownProps { | ||
links: ReactNode[] | ||
} | ||
|
||
export function NavigationMenu({ links, ...restProps }: NavigationMenuProps) { | ||
const [dropdownOpen, setDropdownOpen] = useState(false) | ||
const toggle = useCallback(() => setDropdownOpen((prevState) => !prevState), []) | ||
|
||
return ( | ||
<Dropdown inNavbar nav direction="left" isOpen={dropdownOpen} toggle={toggle} {...restProps}> | ||
<DropdownToggle nav> | ||
<MdOutlineMenu size={30} /> | ||
</DropdownToggle> | ||
<DropdownMenu> | ||
<DropdownMenuListWrapper>{links}</DropdownMenuListWrapper> | ||
</DropdownMenu> | ||
</Dropdown> | ||
) | ||
} | ||
|
||
const Dropdown = styled(DropdownBase)` | ||
display: block !important; | ||
margin: 0 !important; | ||
` | ||
|
||
const DropdownToggle = styled(DropdownToggleBase)` | ||
color: ${(props) => props.theme.bodyColor}; | ||
padding: 2px; | ||
margin: 0; | ||
` | ||
|
||
const DropdownMenu = styled(DropdownMenuBase)` | ||
position: absolute !important; | ||
right: 0 !important; | ||
top: 20px !important; | ||
background-color: ${(props) => props.theme.bodyBg}; | ||
box-shadow: 1px 1px 20px 0 #0005; | ||
transition: opacity ease-out 0.25s; | ||
padding: 1rem; | ||
padding-right: 0; | ||
width: 200px; | ||
` | ||
|
||
const DropdownMenuListWrapper = styled.div` | ||
max-height: calc(80vh - 150px); | ||
min-height: 100px; | ||
overflow-y: auto; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2a2fa48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nextclade – ./
nextclade-nextstrain.vercel.app
nextclade-git-master-nextstrain.vercel.app
nextclade.vercel.app