Skip to content

Commit

Permalink
Add roles to main and navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
nekiro committed Dec 7, 2024
1 parent 82ba4e6 commit 5f51320
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
34 changes: 34 additions & 0 deletions src/components/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Flex, FlexProps } from "@chakra-ui/react";

export interface NavBarProps extends FlexProps {}

export const NavBar = ({ children, ...props }: NavBarProps) => {
return (
<Flex
as="nav"
justifyContent="center"
h="50px"
position="sticky"
top="0"
w="100%"
paddingLeft="15px"
paddingRight="15px"
borderBottomWidth="1px"
borderColor="violet.400"
_before={{
content: '""',
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: "100%",
bgGradient: "bg-gradient",
filter: "brightness(0.6)",
zIndex: -1,
}}
{...props}
>
{children}
</Flex>
);
};
14 changes: 3 additions & 11 deletions src/layout/TopBar/Mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { IoChevronDown, IoChevronUp } from "react-icons/io5";
import { useRouter } from "next/router";
import { trpc } from "@util/trpc";
import { DarkModeButton } from "@component/DarkModeButton";
import { NavBar } from "@component/NavBar";

export const MobileTopBar = () => {
const user = trpc.me.me.useQuery().data;
Expand All @@ -33,16 +34,7 @@ export const MobileTopBar = () => {
};

return (
<Flex
justifyContent="space-between"
alignItems="center"
bgColor="blackAlpha.600"
h="50px"
paddingLeft="15px"
paddingRight="15px"
borderBottomWidth="1px"
borderColor="violet.400"
>
<NavBar justifyContent="space-between">
<Link href="/" style={{ height: "100%", textDecoration: "none" }}>
<TopBarItem paddingLeft={0} userSelect="none" pointerEvents="none">
<Image height="35px" src="/images/header.png" alt="shibaac" />
Expand Down Expand Up @@ -153,6 +145,6 @@ export const MobileTopBar = () => {
</VStack>
</Flex>
)}
</Flex>
</NavBar>
);
};
13 changes: 3 additions & 10 deletions src/layout/TopBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import TextInput from "@component/TextInput";
import DropdownButton from "@component/DropdownButton";
import { useRouter } from "next/router";
import { DarkModeButton } from "@component/DarkModeButton";
import { NavBar } from "@component/NavBar";

export interface NavigationItems {
text: string;
Expand Down Expand Up @@ -44,15 +45,7 @@ export const TopBar = () => {
const router = useRouter();

return (
<Flex
justifyContent="center"
bgColor="blackAlpha.600"
h="50px"
paddingLeft="15px"
paddingRight="15px"
borderBottomWidth="1px"
borderColor="violet.400"
>
<NavBar>
<HStack>
<Link href="/" style={{ height: "100%", textDecoration: "none" }}>
<TopBarItem paddingLeft={0} userSelect="none" pointerEvents="none">
Expand Down Expand Up @@ -132,6 +125,6 @@ export const TopBar = () => {
</Text>
</TopBarItem>
</Link>
</Flex>
</NavBar>
);
};
2 changes: 1 addition & 1 deletion src/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Layout = ({ children }: PropsWithChildren) => {
<>
<Head title="News" />
{TopBarComponent && <TopBarComponent />}
<Flex role="main" w={{ lg: "1050px", base: "100%" }} bgColor={bgColor} mt="2em" marginX={"auto"} padding="1em">
<Flex as="main" w={{ lg: "1050px", base: "100%" }} bgColor={bgColor} mt="2em" marginX={"auto"} padding="1em">
{children}
</Flex>
<Text userSelect="none" fontSize="sm" position="fixed" color="white" bottom="5" left="50%" transform="translateX(-50%)">
Expand Down

0 comments on commit 5f51320

Please sign in to comment.