Added some initial styles, dependencies, next-auth, and page structure

This commit is contained in:
Valtteri Karesto
2021-11-11 11:42:36 +02:00
parent 583371489c
commit e7efed79ce
24 changed files with 6224 additions and 86 deletions

38
components/Stack.tsx Normal file
View File

@@ -0,0 +1,38 @@
import { Children } from "react";
import { Flex, Box, ThemeUIStyleObject, BoxProps } from "theme-ui";
import { useBreakpointIndex } from "@theme-ui/match-media";
const Stack: React.FC<
BoxProps & {
spacing?: (number | string | null)[] | string | number;
direction?: ("column" | "row") | ("column" | "row" | null)[];
sx?: ThemeUIStyleObject;
}
> = ({ spacing = 3, direction = "row", sx, children, ...rest }) => {
const breakpointIndex = useBreakpointIndex();
const currentDirection = Array.isArray(direction)
? direction[breakpointIndex]
: direction;
const childrenLength = Array.isArray(children) ? children.length : null;
return (
<Box
{...rest}
sx={{
display: "flex",
flexDirection: direction,
...sx,
}}
>
{Children.map(children, (child, index) => (
<Box
mt={currentDirection === "column" && index !== 0 ? spacing : 0}
ml={currentDirection === "row" && index !== 0 ? spacing : 0}
>
{child}
</Box>
))}
</Box>
);
};
export default Stack;