Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: changed Chakra UI to dark theme #859

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions components/AuthForm.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { useState, FormEvent } from "react";
import styles from "../styles/Home.module.css";
import { signIn } from "next-auth/react";
import { useRouter } from "next/router";
import Routes from "../routes/routes";
import signupUser from "../api/users/signupUser";
import {
Button,
FormControl,
FormLabel,
Heading,
Input,
useToast,
Heading,
FormLabel,
FormControl,
} from "@chakra-ui/react";
import { signIn } from "next-auth/react";
import { useRouter } from "next/router";
import { FormEvent, useState } from "react";
import signupUser from "../api/users/signupUser";
import Routes from "../routes/routes";
import styles from "../styles/Home.module.css";

Check warning on line 14 in components/AuthForm.tsx

View check run for this annotation

Codecov / codecov/patch

components/AuthForm.tsx#L9-L14

Added lines #L9 - L14 were not covered by tests

export default function AuthForm() {
const router = useRouter();
Expand Down Expand Up @@ -130,12 +130,12 @@
</FormControl>
)}
<div className="flex flex-col mt-8">
<Button colorScheme="blue" type="submit">
<Button colorScheme="highlightPurple" type="submit">
{isLoginMode ? "login" : "create account"}
</Button>
<Button
variant="ghost"
colorScheme="blue"
colorScheme="detailGrayPurple"
type="button"
onClick={switchLoginMode}
>
Expand All @@ -146,7 +146,7 @@
{isLoginMode && (
<Button
variant="ghost"
colorScheme="blue"
colorScheme="detailGrayPurple"
type="button"
onClick={navigateToPasswordResetPage}
>
Expand Down
59 changes: 27 additions & 32 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
import React from "react";
import {
Avatar,
Box,
Flex,
Text,
IconButton,
Button,
Stack,
Center,
Collapse,
Flex,
IconButton,
Link,
useColorModeValue,
useBreakpointValue,
useDisclosure,
Avatar,
Center,
Menu,
MenuButton,
MenuDivider,
MenuItem,
MenuList,
Stack,
Text,
useBreakpointValue,
useColorModeValue,
useDisclosure,
} from "@chakra-ui/react";
import { MdMenu, MdClose } from "react-icons/md";
import Routes from "../routes/routes";
import { useRouter } from "next/router";
import { signOut } from "next-auth/react";
import { Session } from "next-auth";
import MobileNav from "./NavbarMobile";
import { signOut } from "next-auth/react";
import { useRouter } from "next/router";
import { MdClose, MdMenu } from "react-icons/md";
import Routes from "../routes/routes";

Check warning on line 25 in components/Navbar.tsx

View check run for this annotation

Codecov / codecov/patch

components/Navbar.tsx#L22-L25

Added lines #L22 - L25 were not covered by tests
import DesktopNav from "./NavbarDesktop";
import MobileNav from "./NavbarMobile";

Check warning on line 27 in components/Navbar.tsx

View check run for this annotation

Codecov / codecov/patch

components/Navbar.tsx#L27

Added line #L27 was not covered by tests

interface Props {
session: Session;
Expand All @@ -42,14 +41,14 @@
return (
<Box>
<Flex
bg={useColorModeValue("white", "gray.800")}
color={useColorModeValue("gray.600", "white")}
bg={useColorModeValue("black", "black")}
color={useColorModeValue("white", "white")}
minH={"60px"}
py={{ base: 2 }}
px={{ base: 4 }}
borderBottom={1}
borderStyle={"solid"}
borderColor={useColorModeValue("gray.200", "gray.900")}
borderColor={useColorModeValue("gray.200", "gray.200")}
align={"center"}
>
<Flex
Expand All @@ -71,9 +70,9 @@
<Text
textAlign={useBreakpointValue({ base: "center", md: "left" })}
fontFamily={"heading"}
color={useColorModeValue("gray.800", "white")}
as='b'
textDecoration='none'
color={useColorModeValue("white", "white")}
as="b"
textDecoration="none"
>
OnLaunch &#128640;
</Text>
Expand All @@ -85,6 +84,7 @@
</Flex>

<Stack
color={useColorModeValue("white", "white")}
flex={{ base: 1, md: 0 }}
justify={"flex-end"}
direction={"row"}
Expand All @@ -111,29 +111,23 @@
cursor={"pointer"}
minW={0}
>
<Avatar
size={"sm"}
name={props.session.user.name}
/>
<Avatar size={"sm"} name={props.session.user.name} />
</MenuButton>
<MenuList alignItems={"center"}>
<MenuList alignItems={"center"} bg={"black"}>
<br />
<Center>
<Avatar
size={"2xl"}
name={props.session.user.name}
/>
<Avatar size={"2xl"} name={props.session.user.name} />
</Center>
<br />
<Center>
<p>{props?.session?.user?.name}</p>
</Center>
<br />
<MenuDivider />
<MenuItem as="a" href={Routes.DASHBOARD}>
<MenuItem as="a" href={Routes.DASHBOARD} bg={"black"}>
Your Organisations
</MenuItem>
<MenuItem as="a" href="/profile">
<MenuItem as="a" href="/profile" bg={"black"}>
Your Profile
</MenuItem>
<MenuDivider />
Expand All @@ -142,6 +136,7 @@
signOut();
navigateToAuthPage();
}}
bg={"black"}
>
Logout
</MenuItem>
Expand Down
19 changes: 9 additions & 10 deletions components/NavbarDesktop.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import React from "react";
import {
Box,
Flex,
Icon,
Link,
Stack,
Popover,
PopoverTrigger,
PopoverContent,
useColorModeValue,
PopoverTrigger,
Stack,
Text,
Flex,
Icon,
useColorModeValue,
} from "@chakra-ui/react";
import { MdChevronRight } from "react-icons/md";
import Routes from "../routes/routes";
Expand All @@ -29,9 +28,9 @@
];

export default function DesktopNav() {
const linkColor = useColorModeValue("gray.600", "gray.200");
const linkHoverColor = useColorModeValue("gray.800", "white");
const popoverContentBgColor = useColorModeValue("white", "gray.800");
const linkColor = useColorModeValue("white", "white");
const linkHoverColor = useColorModeValue("gray.200", "gray.200");
const popoverContentBgColor = useColorModeValue("gray.200", "gray.200");

Check warning on line 33 in components/NavbarDesktop.tsx

View check run for this annotation

Codecov / codecov/patch

components/NavbarDesktop.tsx#L31-L33

Added lines #L31 - L33 were not covered by tests

return (
<Stack direction={"row"} spacing={4}>
Expand Down Expand Up @@ -85,7 +84,7 @@
display={"block"}
p={2}
rounded={"md"}
_hover={{ bg: useColorModeValue("pink.50", "gray.900") }}
_hover={{ bg: useColorModeValue("pink.50", "pink.50") }}
>
<Stack direction={"row"} align={"center"}>
<Box>
Expand Down
13 changes: 6 additions & 7 deletions components/NavbarMobile.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React from "react";
import {
Stack,
Link,
Collapse,
Flex,
Icon,
useColorModeValue,
Link,
Stack,
Text,
Flex,
useDisclosure
useColorModeValue,
useDisclosure,
} from "@chakra-ui/react";
import { MdExpandMore } from "react-icons/md";
import Routes from "../routes/routes";
Expand Down Expand Up @@ -78,7 +77,7 @@ function MobileNavItem({ label, children, href }: NavItem) {
pl={4}
borderLeft={1}
borderStyle={"solid"}
borderColor={useColorModeValue("gray.200", "gray.700")}
borderColor={useColorModeValue("gray.400", "gray.700")}
align={"start"}
>
{children &&
Expand Down
14 changes: 8 additions & 6 deletions components/ProductCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from "react";
import { Product } from "../models/product";
import { ProductType } from "../models/productType";
import { Button, Checkbox, Divider, Heading, Text } from "@chakra-ui/react";
import Routes from "../routes/routes";
import { useRouter } from "next/router";
import { useState } from "react";

Check warning on line 3 in components/ProductCard.tsx

View check run for this annotation

Codecov / codecov/patch

components/ProductCard.tsx#L3

Added line #L3 was not covered by tests
import createCheckoutSession from "../api/stripe/createCheckoutSession";
import { Product } from "../models/product";
import { ProductType } from "../models/productType";
import Routes from "../routes/routes";

Check warning on line 7 in components/ProductCard.tsx

View check run for this annotation

Codecov / codecov/patch

components/ProductCard.tsx#L7

Added line #L7 was not covered by tests

interface Props {
product: Product;
Expand Down Expand Up @@ -97,14 +97,16 @@
}}
>
unlimited exceeding requests at{" "}
{formatCurrency((props.product.unlimitedOption.priceAmount as number))}{" "}
{formatCurrency(
props.product.unlimitedOption.priceAmount as number
)}{" "}
per extra request
</Checkbox>
</div>
)}
<div className="flex-grow"></div>
<Button
colorScheme="blue"
colorScheme="highlightPurple"
onClick={() => handleSubscription()}
className="mt-4 flex w-full"
role="link"
Expand Down
21 changes: 14 additions & 7 deletions components/RequestsChart.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from "react";
import {
Chart as ChartJS,
CategoryScale,
Chart as ChartJS,
Filler,
Legend,
LineElement,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Filler,
Legend,
} from "chart.js";
import { Line } from "react-chartjs-2";

Expand Down Expand Up @@ -40,10 +39,18 @@ export const options = {
},
scales: {
y: {
grid: {
color: "#8D8D92", // Set grid line color to grey
},
ticks: {
precision: 0, // Ensure that only whole numbers are shown
},
},
x: {
grid: {
color: "#8D8D92", // Set grid line color to grey
},
},
},
};

Expand Down Expand Up @@ -82,8 +89,8 @@ export default function RequestChart({ requestData }: RequestChartProps) {
fill: true,
label: "Requests per day",
data: dataSet,
borderColor: "rgb(53, 162, 235)",
backgroundColor: "rgba(53, 162, 235, 0.5)",
borderColor: "#7823C9",
backgroundColor: "#7823C9",
},
],
};
Expand Down
13 changes: 6 additions & 7 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import "../styles/globals.css";
import type { AppProps } from "next/app";
import { ChakraProvider } from "@chakra-ui/react";
import "cal-sans";

Check warning on line 2 in pages/_app.tsx

View check run for this annotation

Codecov / codecov/patch

pages/_app.tsx#L1-L2

Added lines #L1 - L2 were not covered by tests
import { SessionProvider } from "next-auth/react";
import type { AppProps } from "next/app";
import Navbar from "../components/Navbar";
import "cal-sans";
import { ChakraProvider, extendTheme } from "@chakra-ui/react";

const chakraTheme = extendTheme();
import customTheme from "../styles/customChakraTheme";
import "../styles/globals.css";

Check warning on line 7 in pages/_app.tsx

View check run for this annotation

Codecov / codecov/patch

pages/_app.tsx#L6-L7

Added lines #L6 - L7 were not covered by tests

export default function App({
Component,
pageProps: { session, ...pageProps },
}: AppProps) {
return (
<ChakraProvider theme={chakraTheme} resetCSS>
<ChakraProvider theme={customTheme} resetCSS>
<SessionProvider session={session}>
<Navbar session={session} />
<Component {...pageProps} />
Expand Down
8 changes: 4 additions & 4 deletions pages/changeEmail.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Button, Center, Heading, Spinner, useToast } from "@chakra-ui/react";
import { signOut, useSession } from "next-auth/react";

Check warning on line 2 in pages/changeEmail.tsx

View check run for this annotation

Codecov / codecov/patch

pages/changeEmail.tsx#L1-L2

Added lines #L1 - L2 were not covered by tests
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import styles from "../styles/Home.module.css";
import { signOut, useSession } from "next-auth/react";
import validateEmailChange from "../api/tokens/validateEmailChange";
import Routes from "../routes/routes";
import { Button, Center, Heading, Spinner, useToast } from "@chakra-ui/react";
import styles from "../styles/Home.module.css";

Check warning on line 7 in pages/changeEmail.tsx

View check run for this annotation

Codecov / codecov/patch

pages/changeEmail.tsx#L7

Added line #L7 was not covered by tests

export default function ResetPasswordPage() {
const router = useRouter();
Expand Down Expand Up @@ -71,7 +71,7 @@
</Center>
<Center>
<Button
colorScheme="blue"
colorScheme="highlightPurple"
sx={{ marginTop: 5 }}
onClick={navigateToAuthPage}
>
Expand Down
Loading
Loading