Skip to content

Commit

Permalink
chore: [] Sticky header (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvanvoorst-contentful authored Oct 19, 2022
2 parents d18f085 + ded8604 commit 92d6ce4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 47 deletions.
9 changes: 4 additions & 5 deletions src/components/errors/entry-not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react'

import ErrorBox from './error-box'
import React from 'react';

import ErrorBox from './error-box';

const EntryNotFound = (props: { className?: string }) => (
<ErrorBox {...props}>Component not found.</ErrorBox>
)
);

export default EntryNotFound
export default EntryNotFound;
9 changes: 1 addition & 8 deletions src/components/layout/category-container.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { Theme } from '@mui/material';
import { CSSProperties } from '@mui/material/styles/createTypography';
import { makeStyles } from '@mui/styles';
import clsx from 'clsx';
import React from 'react';

import { HEADER_HEIGHT, HEADER_HEIGHT_MD } from '@src/theme';

const useStyles = makeStyles((theme: Theme) => ({
const useStyles = makeStyles(() => ({
root: {
marginTop: HEADER_HEIGHT_MD,
width: '100%',
[theme.breakpoints.up('md')]: {
marginTop: HEADER_HEIGHT,
},
},
}));

Expand Down
4 changes: 2 additions & 2 deletions src/components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ const Header = (props: HeaderPropsInterface) => {
const classes = useStyles();

return (
<AppBar position="fixed" color="secondary" className={classes.appbar}>
<Toolbar className={classes.toolbar}>
<AppBar position="sticky" color="secondary" className={classes.appbar}>
<Toolbar>
<Container
className={classes.toolbarContent}
disableGutters
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ html {
html,
body,
#__next {
height: 100%;
min-height: 100%;
}

body.is-scroll-locked {
Expand Down
9 changes: 1 addition & 8 deletions src/components/layout/page-container.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { Theme } from '@mui/material';
import { CSSProperties } from '@mui/material/styles/createTypography';
import { makeStyles } from '@mui/styles';
import clsx from 'clsx';
import React from 'react';

import { HEADER_HEIGHT_MD, HEADER_HEIGHT } from '@src/theme';

const useStyles = makeStyles((theme: Theme) => ({
const useStyles = makeStyles(() => ({
pageContainerRoot: {
marginTop: HEADER_HEIGHT_MD,
width: '100%',
[theme.breakpoints.up('md')]: {
marginTop: HEADER_HEIGHT,
},
},
}));

Expand Down
9 changes: 1 addition & 8 deletions src/components/layout/post-container.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { Theme } from '@mui/material';
import { CSSProperties } from '@mui/material/styles/createTypography';
import { makeStyles } from '@mui/styles';
import clsx from 'clsx';
import React from 'react';

import { HEADER_HEIGHT_MD, HEADER_HEIGHT } from '@src/theme';

const useStyles = makeStyles((theme: Theme) => ({
const useStyles = makeStyles(() => ({
root: {
marginTop: HEADER_HEIGHT_MD,
width: '100%',
[theme.breakpoints.up('md')]: {
marginTop: HEADER_HEIGHT,
},
},
}));

Expand Down
16 changes: 1 addition & 15 deletions src/components/layout/product-container.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
import { Theme } from '@mui/material';
import { CSSProperties } from '@mui/material/styles/createTypography';
import { makeStyles } from '@mui/styles';
import clsx from 'clsx';
import React from 'react';

import { HEADER_HEIGHT, HEADER_HEIGHT_MD } from '@src/theme';

const useStyles = makeStyles((theme: Theme) => ({
root: {
marginTop: HEADER_HEIGHT_MD,
[theme.breakpoints.up('md')]: {
marginTop: HEADER_HEIGHT,
},
},
}));

type Props = {
className?: string;
style?: CSSProperties;
children?: React.ReactNode | React.ReactNode[];
};

const ProductContainer = (props: Props) => {
const classes = useStyles();
return (
<div style={props.style} className={clsx(classes.root, props.className)}>
<div style={props.style} className={clsx(props.className)}>
{props.children}
</div>
);
Expand Down

0 comments on commit 92d6ce4

Please sign in to comment.