Skip to content

Commit 5bb2fbd

Browse files
committed
Layout revamp
1 parent 7fc1498 commit 5bb2fbd

12 files changed

+180
-286
lines changed

src/components/DropdownButton.tsx

+28-31
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import Link from "next/link";
2-
import React from "react";
31
import { useRouter } from "next/router";
4-
import { IoChevronDown } from "react-icons/io5";
5-
import { Menu, MenuButton, MenuList, MenuItem, Button } from "@chakra-ui/react";
2+
import { Menu, MenuButton, MenuList, Button, useDisclosure, MenuItem } from "@chakra-ui/react";
3+
import { IoChevronDown, IoChevronUp } from "react-icons/io5";
4+
import Link from "next/link";
65

76
export interface DropdownButtonProps {
87
hasMenu?: boolean;
@@ -13,22 +12,22 @@ export interface DropdownButtonProps {
1312

1413
const DropdownButton = ({ hasMenu = false, text, href, list }: DropdownButtonProps) => {
1514
const router = useRouter();
15+
const { isOpen, onOpen, onClose } = useDisclosure();
1616
const isActive = hasMenu ? list?.some((item) => router.asPath.startsWith(item.url)) : router.asPath === href;
1717

1818
if (hasMenu) {
1919
return (
20-
<Menu>
20+
<Menu isOpen={isOpen} onOpen={onOpen} onClose={onClose}>
2121
<MenuButton
22-
color="white"
23-
bg={isActive ? "#c3a6d9)" : "transparent"}
22+
color={isActive ? "black" : "white"}
23+
bg={isActive ? "#c3a6d9" : ""}
2424
as={Button}
25-
pt="25px"
26-
pb="25px"
25+
h="100%"
2726
borderRadius={0}
28-
rightIcon={<IoChevronDown />}
29-
fontWeight="normal"
27+
rightIcon={isOpen ? <IoChevronUp size="10px" /> : <IoChevronDown size="10px" />}
28+
fontWeight={"normal"}
3029
_hover={{ bgColor: "rgba(255, 255, 255, 0.3)" }}
31-
_active={{ bgColor: " rgba(255, 255, 255, 0.3)" }}
30+
_active={{ bgColor: "rgba(255, 255, 255, 0.3)" }}
3231
_focus={{ outline: 0 }}
3332
>
3433
{text}
@@ -49,26 +48,24 @@ const DropdownButton = ({ hasMenu = false, text, href, list }: DropdownButtonPro
4948
</MenuList>
5049
</Menu>
5150
);
52-
} else if (href) {
53-
return (
54-
<Link href={href} passHref>
55-
<Button
56-
color="white"
57-
bg={isActive ? "#c3a6d9" : "transparent"}
58-
pt="25px"
59-
pb="25px"
60-
borderRadius={0}
61-
fontWeight="normal"
62-
_hover={{ bgColor: "rgba(255, 255, 255, 0.3)" }}
63-
_active={{ bgColor: " rgba(255, 255, 255, 0.3)" }}
64-
_focus={{ outline: "0" }}
65-
alignSelf="self-end"
66-
>
67-
{text}
68-
</Button>
69-
</Link>
70-
);
7151
}
52+
53+
return (
54+
<Link href={href ?? "#"} style={{ height: "100%" }} passHref>
55+
<Button
56+
h="100%"
57+
color={isActive ? "black" : "white"}
58+
bg={isActive ? "#c3a6d9" : ""}
59+
borderRadius={0}
60+
fontWeight="normal"
61+
_hover={{ bgColor: "rgba(255, 255, 255, 0.3)" }}
62+
_active={{ bgColor: "rgba(255, 255, 255, 0.3)" }}
63+
_focus={{ outline: 0 }}
64+
>
65+
{text}
66+
</Button>
67+
</Link>
68+
);
7269
};
7370

7471
export default DropdownButton;

src/components/NewsPanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface NewsPanelProps extends FlexProps {
1313
isLoading?: boolean;
1414
}
1515

16-
const NewsPanel = ({ header = "Loading...", date, identifier, children, isLoading = false, borderRadius = "md", ...props }: NewsPanelProps) => {
16+
const NewsPanel = ({ header = "Loading...", date, identifier, children, isLoading = false, borderRadius = "none", ...props }: NewsPanelProps) => {
1717
return (
1818
<Flex key={identifier} width="100%" flexDirection="column" color="black" bgColor="#fff" borderRadius={borderRadius} {...props}>
1919
<Flex bg="#f5f5f5" borderBottomWidth="1px" borderTopWidth="1px" borderColor="#ddd" borderRadius={borderRadius}>

src/components/Panel.tsx

+17-23
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,35 @@ export interface PanelProps extends FlexProps {
1212
isLoading?: boolean;
1313
}
1414

15-
const Panel = ({
16-
header = "Loading...",
17-
date,
18-
identifier,
19-
children,
20-
isLoading = false,
21-
borderRadius = "md",
22-
padding = "10px",
23-
...props
24-
}: PanelProps) => {
15+
const Panel = ({ header, date, identifier, children, isLoading = false, borderRadius = "none", padding = "10px", ...props }: PanelProps) => {
2516
return (
2617
<Flex
2718
key={identifier}
2819
width="100%"
2920
flexDirection="column"
30-
color="black"
21+
color="white"
3122
border="1px"
3223
borderColor="#ddd"
3324
bgColor="#fff"
25+
textAlign="center"
3426
borderRadius={borderRadius}
3527
borderBottomRadius={0}
3628
{...props}
3729
>
38-
<Flex bg="#f5f5f5" border="1px" borderColor="#ddd" borderRadius={borderRadius}>
39-
<Grid margin="10px" width="100%" templateColumns="1fr auto">
40-
<Text>{header}</Text>
41-
{date && (
42-
<Box display="flex" justifyContent="flex-end">
43-
<Text display="flex" alignItems="center">
44-
<IoMdTime /> {formatDate(date)}
45-
</Text>
46-
</Box>
47-
)}
48-
</Grid>
49-
</Flex>
30+
{header && (
31+
<Flex bg="violet.500" border="1px" borderColor="#ddd" borderRadius={borderRadius}>
32+
<Grid margin="10px" width="100%" templateColumns="1fr auto">
33+
<Text>{header}</Text>
34+
{date && (
35+
<Box display="flex" justifyContent="flex-end">
36+
<Text display="flex" alignItems="center">
37+
<IoMdTime /> {formatDate(date)}
38+
</Text>
39+
</Box>
40+
)}
41+
</Grid>
42+
</Flex>
43+
)}
5044
<Box padding={padding}>{isLoading ? <Loader /> : children}</Box>
5145
</Flex>
5246
);

src/layout/Footer.tsx

-12
This file was deleted.

src/layout/NavBar/DesktopNavBar.tsx

-56
This file was deleted.

src/layout/NavBar/MobileNavBar.tsx

-62
This file was deleted.

src/layout/NavBar/index.tsx

-55
This file was deleted.

src/layout/TopBar/TopBarSeparator.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { Box } from "@chakra-ui/react";
1+
import { Box, BoxProps } from "@chakra-ui/react";
22

3-
export const TopBarSeparator = () => {
4-
return <Box bgColor="violet.400" w="1px" h="100%" />;
3+
interface TopBarSeparatorProps extends BoxProps {}
4+
5+
export const TopBarSeparator = ({ ...props }: TopBarSeparatorProps) => {
6+
return <Box bgColor="violet.400" w="1px" h="100%" {...props} />;
57
};

0 commit comments

Comments
 (0)