Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 39 additions & 28 deletions src/components/AppLayout/AppLayout.tsx
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>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<TableCellCities>{rows}</TableCellCities>
<TableCellCities rows={rows} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w paths/pages/Letters.tsx

</>
</Box>
)
}
</Box>
);

export default AppLayout
export default AppLayout;
47 changes: 47 additions & 0 deletions src/components/TableCellCities/TableCellCities.tsx
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 }>;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
children: Array<{ id: number; city: string }>;
rows: Array<{ id: number; city: string }>;

}

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

można usunąć :D

// };
export default TableCellCities;