Skip to content

Commit 9f18ef9

Browse files
committed
refactor: print media query
1 parent 02a32d2 commit 9f18ef9

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/components/legal/CookiesBanner.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const CookiesBanner = () => {
2424
left: 0,
2525
padding: "0.5rem",
2626
boxShadow: 10,
27+
displayPrint: "none",
2728
}}
2829
>
2930
<Container>

src/layouts/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const Footer = () => {
1919
const itemStyles = { justifyContent: small ? "right" : "left" };
2020

2121
return (
22-
<Paper square component="footer" sx={{ marginTop: "auto" }}>
22+
<Paper square component="footer" sx={{ marginTop: "auto", displayPrint: "none" }}>
2323
<Container maxWidth="md">
2424
<Grid container sx={{ p: 2 }}>
2525
<Grid size={{ sm: 6, xs: 12 }}>

src/layouts/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { NavBarContents } from "./navigation/NavBarContents";
55

66
const Header = () => {
77
return (
8-
<AppBar position="static">
8+
<AppBar position="static" sx={{ displayPrint: "none" }}>
99
<Toolbar>
1010
<HeaderLogo />
1111

src/layouts/Layout.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type ReactNode } from "react";
22

3-
import { Box, LinearProgress, NoSsr, useMediaQuery } from "@mui/material";
3+
import { Box, LinearProgress, NoSsr } from "@mui/material";
44

55
import { CookiesBanner } from "../components/legal/CookiesBanner";
66
import { useIsTransitioning } from "../hooks/useIsTransitioning";
@@ -12,20 +12,21 @@ export interface LayoutProps {
1212
}
1313

1414
const Layout = ({ children }: LayoutProps) => {
15-
const isPrint = useMediaQuery("print");
1615
const isTransitioning = useIsTransitioning(false);
1716

1817
return (
1918
<Box sx={{ display: "flex", flexDirection: "column", minHeight: "100vh" }}>
20-
{!isPrint && <Header />}
19+
<Header />
2120
{!!isTransitioning && <LinearProgress />}
2221
{/* <Slide appear direction="right" in={!isTransitioning}> */}
2322
<Box component="main" sx={{ paddingY: 2 }}>
2423
{children}
2524
</Box>
2625
{/* </Slide> */}
27-
{!isPrint && <Footer />}
28-
<NoSsr>{!isPrint && <CookiesBanner />}</NoSsr>
26+
<Footer />
27+
<NoSsr>
28+
<CookiesBanner />
29+
</NoSsr>
2930
</Box>
3031
);
3132
};

0 commit comments

Comments
 (0)