Skip to content

Instantly share code, notes, and snippets.

@manniru
Created September 22, 2022 13:27
Show Gist options
  • Save manniru/a96b08d9f379ea458186f0ac46b8def6 to your computer and use it in GitHub Desktop.
Save manniru/a96b08d9f379ea458186f0ac46b8def6 to your computer and use it in GitHub Desktop.
Brilliant Gist
// ** MUI Imports
import Card from '@mui/material/Card'
import Grid from '@mui/material/Grid'
import Typography from '@mui/material/Typography'
import CardHeader from '@mui/material/CardHeader'
import CardContent from '@mui/material/CardContent'
import TextField from '@mui/material/TextField'
import Select from '@mui/material/Select'
import MenuItem from '@mui/material/MenuItem'
import InputLabel from '@mui/material/InputLabel'
import FormControl from '@mui/material/FormControl'
import Button from '@mui/material/Button'
const states = [
"Abia",
"Adamawa",
"Akwa Ibom",
"Anambra",
"Bauchi",
"Bayelsa",
"Benue",
"Borno",
"Cross River",
"Delta",
"Ebonyi",
"Edo",
"Ekiti",
"Enugu",
"FCT - Abuja",
"Gombe",
"Imo",
"Jigawa",
"Kaduna",
"Kano",
"Katsina",
"Kebbi",
"Kogi",
"Kwara",
"Lagos",
"Nasarawa",
"Niger",
"Ogun",
"Ondo",
"Osun",
"Oyo",
"Plateau",
"Rivers",
"Sokoto",
"Taraba",
"Yobe",
"Zamfara"
];
const Form1 = () => {
return (
<Grid container spacing={6}>
<Grid item xs={12}>
<Card>
<CardHeader title='Form1'></CardHeader>
<CardContent>
<form className='demo-space-x' noValidate autoComplete='off'>
<TextField
type="number"
name='name' label='Name'
/>
<TextField
name='age' label='Age'
/>
<FormControl>
<InputLabel id='demo-simple-select-outlined-label'>Gender</InputLabel>
<Select
label='Gender'
defaultValue=''
id='demo-simple-select-outlined'
labelId='demo-simple-select-outlined-label'
>
<MenuItem value={'Male'}>Male</MenuItem>
<MenuItem value={'Female'}>Female</MenuItem>
</Select>
</FormControl>
<FormControl>
<InputLabel id='demo-simple-select-outlined-label'>State</InputLabel>
<Select
label='State'
defaultValue=''
id='demo-simple-select-outlined'
labelId='demo-simple-select-outlined-label'
>
{ states.map(r => { return <MenuItem key={r} value={r}>{r}</MenuItem> }) }
</Select>
</FormControl>
<br />
<Button variant='contained'>Submit</Button>
</form>
</CardContent>
</Card>
</Grid>
</Grid>
)
}
export default Form1
// ** Icon imports
import HomeOutline from 'mdi-material-ui/HomeOutline'
import EmailOutline from 'mdi-material-ui/EmailOutline'
import ShieldOutline from 'mdi-material-ui/ShieldOutline'
const navigation = () => {
return [
{
title: 'Home',
icon: HomeOutline,
path: '/home'
},
{
title: 'Second Page',
icon: EmailOutline,
path: '/second-page'
},
{
title: 'Access Control',
icon: ShieldOutline,
path: '/acl',
action: 'read',
subject: 'acl-page'
},
{
title: 'Page 1',
icon: HomeOutline,
path: '/page1'
},
{
title: 'Form 1',
icon: HomeOutline,
path: '/form1'
},
{
title: 'Table 1',
icon: HomeOutline,
path: '/table1'
},
]
}
export default navigation
import * as React from 'react';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import Paper from '@mui/material/Paper';
function createData(name, calories, fat, carbs, protein) {
return { name, calories, fat, carbs, protein };
}
const rows = [
createData('Frozen yoghurt', 159, 6.0, 24, 4.0),
createData('Ice cream sandwich', 237, 9.0, 37, 4.3),
createData('Eclair', 262, 16.0, 24, 6.0),
createData('Cupcake', 305, 3.7, 67, 4.3),
createData('Gingerbread', 356, 16.0, 49, 3.9),
];
export default function BasicTable() {
return (
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell>Dessert (100g serving)</TableCell>
<TableCell align="right">Calories</TableCell>
<TableCell align="right">Fat&nbsp;(g)</TableCell>
<TableCell align="right">Carbs&nbsp;(g)</TableCell>
<TableCell align="right">Protein&nbsp;(g)</TableCell>
</TableRow>
</TableHead>
<TableBody>
{rows.map((row) => (
<TableRow
key={row.name}
sx={{ '&:last-child td, &:last-child th': { border: 0 } }}
>
<TableCell component="th" scope="row">
{row.name}
</TableCell>
<TableCell align="right">{row.calories}</TableCell>
<TableCell align="right">{row.fat}</TableCell>
<TableCell align="right">{row.carbs}</TableCell>
<TableCell align="right">{row.protein}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment