Skip to content

Commit

Permalink
switch to material ui
Browse files Browse the repository at this point in the history
  • Loading branch information
sudojacob committed Sep 23, 2024
1 parent 26bda22 commit 1bd376a
Show file tree
Hide file tree
Showing 9 changed files with 772 additions and 298 deletions.
587 changes: 533 additions & 54 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
},
"dependencies": {
"@aws-amplify/ui-react": "^6.3.0",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/material": "^6.1.1",
"aws-amplify": "^6.5.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand Down
61 changes: 3 additions & 58 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,62 +1,7 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;

}

nav {
display: flex; /* 1 */
justify-content: space-between; /* 2 */
padding: 1rem 2rem; /* 3 */
background: #cfd8dc; /* 4 */
}

nav ul {
display: flex; /* 5 */
list-style: none; /* 6 */
}

nav li {
padding-left: 1rem; /* 7! */
}


.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}

@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}

.card {
padding: 2em;
}

.read-the-docs {
color: #888;
width: 100%;
height: 100%;
margin: 0;
}

[data-amplify-authenticator]{
Expand Down
94 changes: 46 additions & 48 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,72 +1,70 @@

import { Authenticator,
Flex,
Button,
} from '@aws-amplify/ui-react';
import { Amplify } from 'aws-amplify';
import outputs from '../amplify_outputs.json';
import '@aws-amplify/ui-react/styles.css';
import { ThemeProvider } from '@aws-amplify/ui-react';
import theme from './theme';
//import '@aws-amplify/ui-react/styles.css';
import Dashboard from './components/Dashboard';
import * as React from 'react';
import {
Card,
Text,
ToggleButton,
ToggleButtonGroup,
} from '@aws-amplify/ui-react';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import theme from './theme'
import AppBar from '@mui/material/AppBar';
import Toolbar from '@mui/material/Toolbar';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import { Button } from '@mui/material';

Amplify.configure(outputs);

/*
export default function App() {
return (
<ThemeProvider theme={theme} colorMode='dark'>
<main>
<nav id='navbar'>
<h2>Detroit Weather Dashboard</h2>
<ul>
<li><Button onClick={signOut}>Log Out</Button></li>
</ul>
</nav>
<Dashboard/>
</main>
</ThemeProvider>
<ThemeProvider theme={theme}>
<CssBaseline />
<Box height="100%" justifyContent="center">
<Box alignItems="center" display="flex" justifyContent="space-between" height="70px">
<AppBar position="fixed" top="0">
<Toolbar>
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
Detroit Weather Dashboard
</Typography>
<Button variant="outlined" color="inherit" sx="margin-right: 40px">Download PDF</Button>
<Button variant="outlined" color="inherit">Log Out</Button>
</Toolbar>
</AppBar>
</Box>
<Dashboard/>
</Box>
</ThemeProvider>
);
};
*/

export default function App() {
const [colorMode, setColorMode] = React.useState('system');
return (
<ThemeProvider theme={theme} colorMode={colorMode}>
<Authenticator>
{({ signOut, user }) => (
<main>
<nav id='navbar'>
<h2>Detroit Weather Dashboard</h2>
<ul>
<li>

<ToggleButtonGroup
value={colorMode}
isExclusive
onChange={(value) => setColorMode(value)}
>
<ToggleButton value="light">Light</ToggleButton>
<ToggleButton value="dark">Dark</ToggleButton>
<ToggleButton value="system">System</ToggleButton>
</ToggleButtonGroup>

</li>
<li><Button onClick={signOut}>Log Out</Button></li>
</ul>
</nav>
<Dashboard/>
</main>
<ThemeProvider theme={theme}>
<CssBaseline />
<Box height="100%" justifyContent="center">
<Box alignItems="center" display="flex" justifyContent="space-between" height="70px">
<AppBar position="fixed" top="0">
<Toolbar>
<Typography variant="h6" component="div" sx={{ flexGrow: 1 }}>
Detroit Weather Dashboard
</Typography>
<Button variant="outlined" color="inherit" sx="margin-right: 40px">Download PDF</Button>
<Button onClick={signOut} variant="outlined" color="inherit">Log Out</Button>
</Toolbar>
</AppBar>

</Box>
<Dashboard/>
</Box>
</ThemeProvider>
)}
</Authenticator>
</ThemeProvider>

);
};
13 changes: 7 additions & 6 deletions src/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import {
Flex,
Image
} from "@aws-amplify/ui-react";

import { Box } from "@mui/material";
import Sentry7Day from "./Sentry7Day";
import NOAAForecast from "./NOAAForecast";

export default function Dashboard() {
return(
<Flex id="dash-container">
<Flex id="dash-row-1" maxWidth={"80vw"}>
<Box display="flex" flexDirection="column" maxWidth="90vw" justifyContent="center" alignItems="center" margin="auto">
<Box display="flex" justifyContent="center" alignItems="center" width="90vw">
<Sentry7Day/>
<Image src="https://www.weather.gov/images/dtx/wxstory/Tab2FileL.png"></Image>
</Flex>
<img src="https://www.weather.gov/images/dtx/wxstory/Tab2FileL.png" style={{maxWidth: "40vw", marginLeft: "30px"}}></img>
</Box>
<NOAAForecast/>
<h1>Dash Comtainer</h1>
</Flex>
</Box>
);
}
110 changes: 85 additions & 25 deletions src/components/NOAAForecast.jsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,93 @@
import { Flex, Tabs, Image } from "@aws-amplify/ui-react";
import * as React from 'react';
import Box from '@mui/material/Box';
import Tab from '@mui/material/Tab';
import { Tabs } from '@mui/material';
import PropTypes from 'prop-types';


function CustomTabPanel(props) {
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>
);
}

CustomTabPanel.propTypes = {
children: PropTypes.node,
index: PropTypes.number.isRequired,
value: PropTypes.number.isRequired,
};

function a11yProps(index) {
return {
id: `simple-tab-${index}`,
'aria-controls': `simple-tabpanel-${index}`,
};
}


export default function NOAAForecast() {
const [valueMap, setValueMap] = React.useState(0);
const [valueHourly, setValueHourly] = React.useState(0);

const handleChangeMap = (event, newValue) => {
setValueMap(newValue);
};
const handleChangeHourly = (event, newValue) => {
setValueHourly(newValue);
};

return(
<Flex>
<Flex direction={"column"} justifyContent={"center"} alignItems={"center"} width={"40vw"}>
<Box display="flex" alignItems="flex-start">
<Box display="flex" flexDirection="column" justifyContent="center" alignItems="center" width="40vw" marginRight="30px">
<h2>Map Forecast</h2>
<Tabs.Container defaultValue="1">
<Tabs.List spacing="equal">
<Tabs.Item value="1">4-5 Day Forecast</Tabs.Item>
<Tabs.Item value="2">Excess Rain</Tabs.Item>
</Tabs.List>
<Tabs.Panel value="1"><Image src="https://www.wpc.ncep.noaa.gov/qpf/95ep48iwbg_fill.gif"></Image></Tabs.Panel>
<Tabs.Panel value="2"><Image src="https://www.wpc.ncep.noaa.gov/qpf/94ewbg.gif"></Image></Tabs.Panel>
</Tabs.Container>
</Flex>
<Flex direction={"column"} justifyContent={"center"} alignItems={"center"} width={"40vw"}>

<Box width="inherit">
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<Tabs value={valueMap} onChange={handleChangeMap} aria-label="basic tabs example">
<Tab label="4-5 Day Forecast" {...a11yProps(0)} />
<Tab label="Excess Rain" {...a11yProps(1)} />
</Tabs>
</Box>
<CustomTabPanel value={valueMap} index={0} width="inherit">
<img src="https://www.wpc.ncep.noaa.gov/qpf/95ep48iwbg_fill.gif" width="100%"></img>
</CustomTabPanel>
<CustomTabPanel value={valueMap} index={1} width="inherit">
<img src="https://www.wpc.ncep.noaa.gov/qpf/94ewbg.gif" width="100%"></img>
</CustomTabPanel>
</Box>
</Box>
<Box display="flex" flexDirection="column" justifyContent="center" alignItems="center" width="40vw">
<h2>Hourly Forecast</h2>
<Tabs.Container defaultValue="1">
<Tabs.List spacing="equal">
<Tabs.Item value="1">Macomb</Tabs.Item>
<Tabs.Item value="2">Oakland</Tabs.Item>
<Tabs.Item value="3">Wayne</Tabs.Item>
</Tabs.List>
<Tabs.Panel value="1"><Image src="https://www.weather.gov/images/dtx/dot/hrqpf1h_paramguide_prob_Macomb.png"></Image></Tabs.Panel>
<Tabs.Panel value="2"><Image src="https://www.weather.gov/images/dtx/dot/hrqpf1h_paramguide_prob_North-Metro.png"></Image></Tabs.Panel>
<Tabs.Panel value="3"><Image src="https://www.weather.gov/images/dtx/dot/hrqpf1h_paramguide_prob_South-Metro.png"></Image></Tabs.Panel>
</Tabs.Container>
</Flex>
</Flex>
<Box width="inherit">
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
<Tabs value={valueHourly} onChange={handleChangeHourly} aria-label="basic tabs example">
<Tab label="Macomb" {...a11yProps(0)} />
<Tab label="Oakland" {...a11yProps(1)} />
<Tab label="Wayne" {...a11yProps(2)} />
</Tabs>
</Box>
<CustomTabPanel value={valueHourly} index={0} width="inherit">
<img src="https://www.weather.gov/images/dtx/dot/hrqpf1h_paramguide_prob_Macomb.png" width="100%"></img>
</CustomTabPanel>
<CustomTabPanel value={valueHourly} index={1} width="inherit">
<img src="https://www.weather.gov/images/dtx/dot/hrqpf1h_paramguide_prob_North-Metro.png" width="100%"></img>
</CustomTabPanel>
<CustomTabPanel value={valueHourly} index={2} width="inherit">
<img src="https://www.weather.gov/images/dtx/dot/hrqpf1h_paramguide_prob_South-Metro.png" width="100%"></img>
</CustomTabPanel>
</Box>
</Box>
</Box>

);
}
Loading

0 comments on commit 1bd376a

Please sign in to comment.