Skip to content

Instantly share code, notes, and snippets.

@HomerJSimpson
Created February 3, 2023 23:23
Show Gist options
  • Save HomerJSimpson/d8c4dbc801247a0093317f294a4f8c91 to your computer and use it in GitHub Desktop.
Save HomerJSimpson/d8c4dbc801247a0093317f294a4f8c91 to your computer and use it in GitHub Desktop.
MuiSimple
<div id="container">
</div>
const {
Box,
List,
ListItem,
ListItemButton,
ListItemText,
ThemeProvider,
createTheme,
Typography,
CssBaseline
} = MaterialUI;
const theme = createTheme({});
const root = ReactDOM.createRoot(document.getElementById("container"));
root.render(
<ThemeProvider theme={theme}>
<CssBaseline />
<header>top</header>
<main>
<section id="app">
<List dense>
{Object.keys(window).map((e, i) => {
return (
<ListItem disablePadding>
<ListItemButton component="a" href="#simple-list">
<ListItemText primary={e} />
</ListItemButton>
</ListItem>
);
})}
</List>
</section>
</main>
<footer>bottom</footer>
</ThemeProvider>
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@mui/material@latest/umd/material-ui.development.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/fuzzysort.min.js"></script>
html,
body {
margin: 0;
height: 100%; /* can also use viewport units (height: 100vh) */
}
#container {
display: flex; /* displays flex-items (children) inline */
flex-direction: column; /* stacks them vertically */
height: 100%; /* needs to take the parents height, alternative: body {display: flex} */
}
main {
flex: 1; /* takes the remaining height of the "container" div */
overflow: auto; /* to scroll just the "main" div */
}
section {
height: 100%; /* takes the visible area of the "main" div */
overflow: auto; /* recommended */
border-bottom: 1px solid;
}
header {
}
section:last-child {
border: none;
}
footer {
}
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&amp;display=swap" rel="stylesheet" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment