Skip to content

Commit

Permalink
Merge pull request #12 from ElrondDevGuild/main-layout-render-problems
Browse files Browse the repository at this point in the history
Main layout render problems
  • Loading branch information
juliancwirko authored Aug 12, 2022
2 parents 2fe7d44 + d01b4bc commit b2c1428
Show file tree
Hide file tree
Showing 5 changed files with 1,702 additions and 1,601 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"plugin:valtio/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"valtio/state-snapshot-rule": "off"
},
"plugins": ["@typescript-eslint"],
"parser": "@typescript-eslint/parser"
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### [2.0.1](https://github.com/ElrondDevGuild/nextjs-dapp-template/releases/tag/v2.0.1)
- fix problems with rerendering (wrong memo usage)
- update dependencies

### [2.0.0](https://github.com/ElrondDevGuild/nextjs-dapp-template/releases/tag/v2.0.0)
- Nextjs update
- React update
Expand Down
51 changes: 25 additions & 26 deletions components/ui/MainLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
import { Container, Box } from '@chakra-ui/react';
import { FC, memo, PropsWithChildren } from 'react';
import { FC, PropsWithChildren } from 'react';
import { MetaHead, MetaHeadProps } from './MetaHead';
import { Footer } from './Footer';

export const MainLayout: FC<PropsWithChildren<MetaHeadProps>> = memo(
({ children, metaTitle, metaDescription, metaImage, metaUrl }) => {
return (
<>
<MetaHead
metaTitle={metaTitle}
metaDescription={metaDescription}
metaImage={metaImage}
metaUrl={metaUrl}
/>
<Box minHeight="calc(100vh - 120px)" pb="10">
<Container maxW="container.xl">
<Box>{children}</Box>
</Container>
</Box>
<Footer />
</>
);
},
(prev, next) =>
prev.metaTitle === next.metaTitle &&
prev.metaDescription === next.metaDescription &&
prev.metaImage === next.metaImage &&
prev.metaUrl === next.metaUrl
);
export const MainLayout: FC<PropsWithChildren<MetaHeadProps>> = ({
children,
metaTitle,
metaDescription,
metaImage,
metaUrl,
}) => {
return (
<>
<MetaHead
metaTitle={metaTitle}
metaDescription={metaDescription}
metaImage={metaImage}
metaUrl={metaUrl}
/>
<Box minHeight="calc(100vh - 120px)" pb="10">
<Container maxW="container.xl">
<Box>{children}</Box>
</Container>
</Box>
<Footer />
</>
);
};

MainLayout.displayName = 'MainLayout';
Loading

0 comments on commit b2c1428

Please sign in to comment.