-
Notifications
You must be signed in to change notification settings - Fork 0
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 #199 from aodn/feature/5760-update-search-bar-to-l…
…atest-UI-design Feature/5760 update search bar to latest UI design
- Loading branch information
Showing
42 changed files
with
626 additions
and
625 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Badge } from "@mui/material"; | ||
import { styled } from "@mui/material/styles"; | ||
import { color as colors } from "../../../styles/constants"; | ||
|
||
export enum Position { | ||
TopRight = "topRight", | ||
Right = "right", | ||
Left = "left", | ||
} | ||
|
||
type PositionStyle = { | ||
top?: string; | ||
right?: string; | ||
bottom?: string; | ||
left?: string; | ||
}; | ||
|
||
const badgePosition: Record<Position, PositionStyle> = { | ||
right: { top: "50%", right: " -10%" }, | ||
topRight: { top: " 20%", right: " 10%" }, | ||
left: { top: " 50px", left: " -10%" }, | ||
}; | ||
|
||
interface StyledBadgeProps { | ||
position?: Position; | ||
color?: string; | ||
} | ||
|
||
const StyledBadge = styled(Badge)<StyledBadgeProps>( | ||
({ sx, position = Position.Left, color = colors.brightBlue.dark }) => ({ | ||
"& .MuiBadge-badge": { | ||
padding: "0 4px", | ||
border: `2px solid ${color}`, | ||
color: "white", | ||
backgroundColor: color, | ||
...badgePosition[position], | ||
...sx, | ||
}, | ||
}) | ||
); | ||
|
||
export default StyledBadge; |
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
File renamed without changes.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,51 @@ | ||
import { FC } from "react"; | ||
import { FC, useState } from "react"; | ||
import MenuIcon from "@mui/icons-material/Menu"; | ||
import PlainMenu, { type Menu } from "../../menu/PlainMenu"; | ||
import { Stack } from "@mui/material"; | ||
import { IconButton, Stack } from "@mui/material"; | ||
import StyledMenu from "../../menu/StyledMenu"; | ||
|
||
// TODO: implement items abd handlers once the menu function is designed | ||
const MAIN_MENUS: Menu[] = [ | ||
{ menuName: "DATA", items: [{ name: "item 1", handler: () => {} }] }, | ||
{ menuName: "LEARN", items: [{ name: "item 1", handler: () => {} }] }, | ||
{ menuName: "ENGAGE", items: [{ name: "item 1", handler: () => {} }] }, | ||
{ menuName: "CONTACT", items: [{ name: "item 1", handler: () => {} }] }, | ||
{ menuName: "ABOUT", items: [{ name: "item 1", handler: () => {} }] }, | ||
{ menuName: "NEWS", items: [{ name: "item 1", handler: () => {} }] }, | ||
]; | ||
|
||
const Menu: FC = () => { | ||
return ( | ||
<Stack | ||
direction="row" | ||
justifyContent="center" | ||
alignItems="center" | ||
spacing={8} | ||
> | ||
{MAIN_MENUS.map((menu, index) => ( | ||
<PlainMenu menu={menu} key={index} /> | ||
))} | ||
</Stack> | ||
); | ||
interface MainMenuProps { | ||
isCollapsed?: boolean; | ||
} | ||
|
||
const renderMenu = () => ( | ||
<Stack direction="row" justifyContent="end" alignItems="center" spacing={1}> | ||
{MAIN_MENUS.map((menu, index) => ( | ||
<PlainMenu menu={menu} key={index} /> | ||
))} | ||
</Stack> | ||
); | ||
|
||
const Menu: FC<MainMenuProps> = ({ isCollapsed }) => { | ||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); | ||
const open = Boolean(anchorEl); | ||
const handleClick = (event: React.MouseEvent<HTMLElement>) => { | ||
setAnchorEl(event.currentTarget); | ||
}; | ||
const handleClose = () => { | ||
setAnchorEl(null); | ||
}; | ||
|
||
if (isCollapsed) | ||
return ( | ||
<> | ||
<IconButton onClick={handleClick} color="primary"> | ||
<MenuIcon /> | ||
</IconButton> | ||
<StyledMenu anchorEl={anchorEl} open={open} onClose={handleClose}> | ||
{renderMenu()} | ||
</StyledMenu> | ||
</> | ||
); | ||
return renderMenu(); | ||
}; | ||
|
||
export default Menu; |
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
Oops, something went wrong.