-
Notifications
You must be signed in to change notification settings - Fork 2
#14_Letter City table #32
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
base: a_master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,43 @@ | ||
| import { Outlet, Link } from 'react-router-dom'; | ||
| import Box from '@mui/material/Box'; | ||
| import List from '@mui/material/List'; | ||
| import ListItem from '@mui/material/ListItem'; | ||
| import ListItemIcon from '@mui/material/ListItemIcon'; | ||
| import ListItemText from '@mui/material/ListItemText'; | ||
| import Star from '@mui/icons-material/Star'; | ||
| import { paths } from '../../paths'; | ||
| import Sidebar from './Sidebar'; | ||
| import { Outlet, Link } from "react-router-dom"; | ||
| import Box from "@mui/material/Box"; | ||
| import List from "@mui/material/List"; | ||
| import ListItem from "@mui/material/ListItem"; | ||
| import ListItemIcon from "@mui/material/ListItemIcon"; | ||
| import ListItemText from "@mui/material/ListItemText"; | ||
| import Star from "@mui/icons-material/Star"; | ||
| import { paths } from "../../paths"; | ||
| import Sidebar from "./Sidebar"; | ||
| import TableCellCities from "../TableCellCities/TableCellCities"; | ||
|
|
||
| const rows = [{ | ||
| id: 1, | ||
| city: "Kraków", | ||
| }, | ||
| { id: 2, city: "Pokhara" }, | ||
| { id: 3, city: "Den Haag" }, | ||
| { id: 4, city: "Praha" },] | ||
|
|
||
| const AppLayout = () => { | ||
| return ( | ||
| <Box sx={{ display: "flex" }}> | ||
| <Sidebar> | ||
| <List component="nav"> | ||
| {paths.map(({ path, label, iconComponent }) => ( | ||
| <ListItem component={Link} key={path} to={path}> | ||
| <ListItemIcon sx={{ minWidth: "36px"}}>{iconComponent ? iconComponent : <Star />}</ListItemIcon> | ||
| <ListItemText primary={label} /> | ||
| </ListItem> | ||
| ))} | ||
| </List> | ||
| </Sidebar> | ||
| <Box sx={{ flexGrow: 1 , display: "flex", flexDirection: "column" }}> | ||
| <Outlet /> | ||
| </Box> | ||
| const AppLayout = () => ( | ||
| <Box sx={{ display: "flex" }}> | ||
| <Sidebar> | ||
| <List component="nav"> | ||
| {paths.map(({ path, label, iconComponent }) => ( | ||
| <ListItem component={Link} key={path} to={path}> | ||
| <ListItemIcon sx={{ minWidth: "36px" }}> | ||
| {iconComponent ? iconComponent : <Star />} | ||
| </ListItemIcon> | ||
| <ListItemText primary={label} /> | ||
| </ListItem> | ||
| ))} | ||
| </List> | ||
| </Sidebar> | ||
| <Box sx={{ flexGrow: 1, display: "flex", flexDirection: "column" }}> | ||
| <> | ||
| <Outlet /> | ||
| <TableCellCities>{rows}</TableCellCities> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. w |
||
| </> | ||
| </Box> | ||
| ) | ||
| } | ||
| </Box> | ||
| ); | ||
|
|
||
| export default AppLayout | ||
| export default AppLayout; | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||
| import { | ||||||
| TableContainer, | ||||||
| Paper, | ||||||
| Table, | ||||||
| TableHead, | ||||||
| TableRow, | ||||||
| TableBody, | ||||||
| } from "@mui/material"; | ||||||
| import TableCell from "@mui/material/TableCell"; | ||||||
|
|
||||||
| interface TableCellCitiesProps { | ||||||
| children: Array<{ id: number; city: string }>; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| const TableCellCities = ({ children }: TableCellCitiesProps) => { | ||||||
| return ( | ||||||
| <TableContainer component={Paper}> | ||||||
| <Table sx={{ minWidth: 650 }} aria-label="simple table"> | ||||||
| <TableHead> | ||||||
| <TableRow> | ||||||
| <TableCell align="left">Cities</TableCell> | ||||||
| </TableRow> | ||||||
| </TableHead> | ||||||
| <TableBody> | ||||||
| {children.map(({id, city}) => ( | ||||||
| <TableRow key={id}> | ||||||
| <TableCell component="th" scope="row"> | ||||||
| {city} | ||||||
| </TableCell> | ||||||
| </TableRow> | ||||||
| ))} | ||||||
| </TableBody> | ||||||
| </Table> | ||||||
| </TableContainer> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
| // const Test = () => { | ||||||
| // return ( | ||||||
| // <> | ||||||
| // <TableCellCities>Krakow</TableCellCities> | ||||||
| // <TableCellCities>Rzeszow</TableCellCities> | ||||||
| // <TableCellCities>Warszawa</TableCellCities> | ||||||
| // </> | ||||||
| // ); | ||||||
|
Comment on lines
+38
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. można usunąć :D |
||||||
| // }; | ||||||
| export default TableCellCities; | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.