authorizer/dashboard/src/layouts/AuthLayout.tsx

54 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-05-07 16:48:04 +00:00
import { Box, Flex, Image, Text, Spinner, useMediaQuery, } from '@chakra-ui/react';
2022-01-17 07:33:28 +00:00
import React from 'react';
2022-03-09 06:23:34 +00:00
import { useQuery } from 'urql';
import { MetaQuery } from '../graphql/queries';
export function AuthLayout({ children }: { children: React.ReactNode }) {
2022-03-09 06:23:34 +00:00
const [{ fetching, data }] = useQuery({ query: MetaQuery });
2022-05-07 16:48:04 +00:00
const [isNotSmallerScreen] = useMediaQuery("(min-width:600px)");
2022-01-17 07:33:28 +00:00
return (
2022-01-19 16:50:25 +00:00
<Flex
2022-05-07 16:48:04 +00:00
flexWrap="wrap"
h="100%"
bg="gray.100"
alignItems="center"
justifyContent="center"
flexDirection="column"
2022-01-19 16:50:25 +00:00
>
<Flex alignItems="center">
<Image
src="https://authorizer.dev/images/logo.png"
alt="logo"
height="50"
/>
2022-05-07 16:48:04 +00:00
<Text
fontSize={isNotSmallerScreen ? "x-large" : "large"}
ml="3"
letterSpacing="3">
2022-01-19 16:50:25 +00:00
AUTHORIZER
2022-01-17 07:33:28 +00:00
</Text>
2022-01-19 16:50:25 +00:00
</Flex>
2022-03-09 06:23:34 +00:00
{fetching ? (
<Spinner />
) : (
<>
2022-05-07 16:48:04 +00:00
<Box
p="6"
m="5"
rounded="5"
bg="white"
w={isNotSmallerScreen ? "450px" : "400px"}
shadow="xl"
>
2022-03-09 06:23:34 +00:00
{children}
</Box>
<Text color="gray.600" fontSize="sm">
Current Version: {data.meta.version}
</Text>
</>
)}
2022-01-17 07:33:28 +00:00
</Flex>
);
}