Files
lucide/site/src/components/Layout.tsx
T
dependabot[bot]dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Eric Fennis
754300465a Bump next from 10.2.3 to 11.1.0 in /site (#384)
* Bump next from 10.2.3 to 11.1.0 in /site

Bumps [next](https://github.com/vercel/next.js) from 10.2.3 to 11.1.0.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v10.2.3...v11.1.0)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix eslint

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2021-08-15 20:47:59 +02:00

104 lines
2.5 KiB
TypeScript

import {
Box,
Divider,
Flex,
Text,
Link,
Icon,
useColorMode,
useColorModeValue,
IconButton,
} from '@chakra-ui/react';
import { useKeyBindings } from '../lib/key';
import { useRouter } from 'next/router';
import NextLink from 'next/link';
import { Moon, Sun } from 'lucide-react';
import Logo from '../../public/logo.svg';
const Layout = ({ children }) => {
const router = useRouter();
const { toggleColorMode } = useColorMode();
const text = useColorModeValue('dark', 'light');
const ColorModeToggle = useColorModeValue(Moon, Sun);
function setQuery(query) {
router
.push({
pathname: '/',
query: { query: query },
})
.then();
}
useKeyBindings({
Escape: {
fn: () => setQuery(''),
},
KeyT: {
fn: () => toggleColorMode(),
},
});
return (
<Box h="100vh">
<Flex mb={16} w="full">
<Flex
alignItems="center"
justifyContent="space-between"
pt={4}
pb={4}
maxW="1250px"
margin="0 auto"
w="full"
px={5}
>
<Flex justifyContent="center" alignItems="center">
<NextLink href="/" passHref>
<Link display="flex" _hover={{ textDecoration: 'none' }}>
<Icon boxSize={12} marginRight="8px">
<Logo />
</Icon>
<Text fontSize="40px" lineHeight="48px">
Lucide
</Text>
</Link>
</NextLink>
</Flex>
<Flex justifyContent="center" alignItems="center">
<Link
href="https://github.com/lucide-icons/lucide"
isExternal
marginRight={6}
fontSize="xl"
>
Github
</Link>
<IconButton
size="md"
fontSize="lg"
aria-label={`Switch to ${text} mode`}
variant="ghost"
color="current"
ml="3"
onClick={toggleColorMode}
icon={<ColorModeToggle />}
/>
</Flex>
</Flex>
</Flex>
<Flex margin="0 auto" direction="column" maxW="1250px" px={5}>
{children}
<Divider marginBottom={8} />
<p style={{ alignSelf: 'center' }}>
<a href="https://vercel.com?utm_source=lucide&utm_campaign=oss">
<img src="/vercel.svg" alt="Powered by Vercel" width="200" />
</a>
</p>
<br />
</Flex>
</Box>
);
};
export default Layout;