-
Notifications
You must be signed in to change notification settings - Fork 0
Add a working Navbar #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
0ae0381
3bb9329
339da14
8efcd28
da07781
c6953bb
8eca618
a4c85ac
c839c58
19fe74f
1ae9295
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { | ||
| Navbar, | ||
| NavLinks, | ||
| NavLink, | ||
| type ImageColourSchemeSwitchType, | ||
| } from "@diamondlightsource/sci-react-ui"; | ||
| import { Link } from "react-router-dom"; | ||
| import i24ssx from "../assets/i24ssx.svg"; | ||
|
|
||
| const ssxLogo: ImageColourSchemeSwitchType = { | ||
| src: i24ssx, | ||
| srcDark: i24ssx, | ||
| alt: "i24 ssx", | ||
| width: "100", | ||
| }; | ||
|
|
||
| export function SerialNavBar() { | ||
| return ( | ||
| <Navbar logo={ssxLogo} containerWidth={false}> | ||
| <NavLinks> | ||
| <NavLink linkComponent={Link} to="/"> | ||
| Home | ||
| </NavLink> | ||
| <NavLink linkComponent={Link} to="/fixed-target"> | ||
| Fixed Target | ||
| </NavLink> | ||
| </NavLinks> | ||
| </Navbar> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| import { Box, Tab, Tabs, useTheme } from "@mui/material"; | ||
| import { BeamlineStatsTabPanel } from "../screens/BeamlineStats"; | ||
| import { DetectorMotionTabPanel } from "../screens/DetectorMotion"; | ||
| import { OavMover } from "../screens/OavMover"; | ||
| import React from "react"; | ||
|
|
||
| interface TabPanelProps { | ||
| children?: React.ReactNode; | ||
| index: number; | ||
| value: number; | ||
| } | ||
|
|
||
| function a11yProps(index: number) { | ||
| return { | ||
| id: `simple-tab-${index}`, | ||
| "aria-controls": `simple-tabpanel-${index}`, | ||
| }; | ||
| } | ||
|
|
||
| function CustomTabPanel(props: TabPanelProps) { | ||
| const { children, value, index, ...other } = props; | ||
|
|
||
| return ( | ||
| <div | ||
| role="tabpanel" | ||
| hidden={value !== index} | ||
| id={`simple-tabpanel-${index}`} | ||
| aria-labelledby={`simple-tab-${index}`} | ||
| {...other} | ||
| > | ||
| {value === index && <Box sx={{ p: 3 }}>{children}</Box>} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| export function BeamlineI24() { | ||
| const theme = useTheme(); | ||
| const [value, setValue] = React.useState(0); | ||
|
||
|
|
||
| const handleChange = (_event: React.SyntheticEvent, newValue: number) => { | ||
| setValue(newValue); | ||
| }; | ||
| return ( | ||
| <Box> | ||
| <Box | ||
| component="section" | ||
| sx={{ | ||
| borderBottom: 1, | ||
| borderColor: "divider", | ||
| color: theme.palette.text.secondary, | ||
| }} | ||
| > | ||
| <Tabs | ||
| value={value} | ||
| onChange={handleChange} | ||
| aria-label="basic tabs example" | ||
| textColor="secondary" | ||
| centered | ||
| > | ||
| <Tab label="Beamline info" {...a11yProps(0)} /> | ||
| <Tab label="Detector position" {...a11yProps(1)} /> | ||
| <Tab label="OAV view" {...a11yProps(2)} /> | ||
| </Tabs> | ||
| </Box> | ||
| <CustomTabPanel value={value} index={0}> | ||
| <BeamlineStatsTabPanel /> | ||
| </CustomTabPanel> | ||
| <CustomTabPanel value={value} index={1}> | ||
| <DetectorMotionTabPanel /> | ||
| </CustomTabPanel> | ||
| <CustomTabPanel value={value} index={2}> | ||
| <OavMover /> | ||
| </CustomTabPanel> | ||
| </Box> | ||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.