Skip to content

Commit

Permalink
Merge pull request #83 from kreivi/fix/layout-overflow
Browse files Browse the repository at this point in the history
Fixed layout overflow issues
  • Loading branch information
kreivi committed Aug 6, 2023
2 parents e1b5829 + 7f6ef0f commit 199e015
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
24 changes: 18 additions & 6 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Container, Box, Grid } from "@mui/material";
import { Container, Box, Grid, useMediaQuery } from "@mui/material";
import { useTheme } from "@mui/styles";
import React from "react";

import Header from "../Header";
Expand All @@ -18,6 +19,8 @@ export type LayoutProps = {
* @returns Layout element
*/
const Layout: React.FC<LayoutProps> = ({ main, aside }: LayoutProps) => {
const theme = useTheme();
const enableAside = useMediaQuery(theme.breakpoints.up("md"));
return (
<Box
sx={{
Expand All @@ -34,12 +37,21 @@ const Layout: React.FC<LayoutProps> = ({ main, aside }: LayoutProps) => {
marginBottom: 2,
}}
>
<Grid container direction="row">
<Grid xs={10}>
<Box component="main" sx={{ marginX: 2}}>{main}</Box>
<Grid container direction={enableAside ? "row" : "column-reverse"}>
<Grid xs={enableAside ? 10 : 12}>
<Box component="main" sx={{ marginX: 2 }}>
{main}
</Box>
</Grid>
<Grid xs={2}>
<Box component="aside">{aside}</Box>
<Grid xs={enableAside ? 2 : 12}>
<Box
sx={{
marginX: enableAside ? 0 : 2,
}}
component="aside"
>
{aside}
</Box>
</Grid>
</Grid>
</Container>
Expand Down
28 changes: 19 additions & 9 deletions src/components/Social/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { Box } from "@mui/material";
import { Box, Grid } from "@mui/material";

import LinkedIn from "./linkedin";
import GitHub from "./github";
Expand All @@ -13,19 +13,29 @@ import YouTube from "./youtube";
*/
const Social: React.FC<{}> = () => {
return (
<Box
<Grid
container
sx={{
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<LinkedIn />
<GitHub />
<Mastodon />
<Itch />
<YouTube />
</Box>
<Grid>
<LinkedIn />
</Grid>
<Grid>
<GitHub />
</Grid>
<Grid>
<Mastodon />
</Grid>
<Grid>
<Itch />
</Grid>
<Grid>
<YouTube />
</Grid>
</Grid>
);
};

Expand Down

0 comments on commit 199e015

Please sign in to comment.