Skip to content

Commit

Permalink
Theme Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sayshark75 committed Nov 29, 2023
1 parent 460ea53 commit 0fdfdd1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/CONSTANTS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,26 +226,32 @@ export const TimelineData: TimelineCardProps[] = [
export const ThemeIconsData: ThemeIconsProps[] = [
{
color: "themeBlue",
metaColor: "#0954BD",
theme: blueTheme,
},
{
color: "themeRed",
metaColor: "#E10202",
theme: redTheme,
},
{
color: "themeGreen",
metaColor: "#11C402",
theme: greenTheme,
},
{
color: "themeViolet",
metaColor: "#8406C3",
theme: violetTheme,
},
{
color: "themeOrange",
metaColor: "#C44201",
theme: orangeTheme,
},
{
color: "themeYellow",
metaColor: "#DBBA03",
theme: yellowTheme,
},
];
3 changes: 2 additions & 1 deletion src/TYPES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type ScrollContextFunctions = {

export type ScrollContextProps = ScrollContextRefs & ScrollContextFunctions;

export type ThemeFunction = (config: ThemeConfig) => void;
export type ThemeFunction = (config: ThemeConfig, metaColor: string) => void;

export type ThemeContextProps = {
theme: ThemeConfig;
Expand All @@ -26,6 +26,7 @@ export type ThemeContextProps = {
export type ThemeIconsProps = {
color: string;
theme: ThemeConfig;
metaColor: string;
};

export interface ContextProviderProps {
Expand Down
4 changes: 2 additions & 2 deletions src/components/HomePage/IconButtonComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const IconButtonHome = ({ label, icon, onClick, tooltip, delay }: SocialBtnType)
return (
<Tooltip
bg={"text"}
color={"darker"}
color={"light"}
fontFamily={"Poppins"}
fontWeight={"600"}
letterSpacing={"1.4px"}
Expand All @@ -41,7 +41,7 @@ const IconButtonHome = ({ label, icon, onClick, tooltip, delay }: SocialBtnType)
animation={isIntersecting ? `${fadeTop} 1s ease-in-out ${delay} forwards` : "none"}
shadow={"dark-lg"}
transition={"700ms"}
_hover={{ bgColor: "darker", color: "text" }}
_hover={{ bgColor: "light", color: "text" }}
border={"2px solid"}
borderColor={"transparent"}
_active={{ opacity: "0.5", transform: "translateY(5px)" }}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/DesktopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const DesktopNav = ({ buttonData }: Props) => {
top={"0px"}
left={"0px"}
w={"100%"}
bgColor={"primary"}
bgColor={"transparent"}
color={"text"}
gap={"2"}
py={3}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ThemesComponent/ThemeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ThemeContainer = () => {
icon={<BiSolidColor style={{ color: "#fff" }} />}
fontSize={"32px"}
rounded={"full"}
onClick={() => handleTheme(icon.theme)}
onClick={() => handleTheme(icon.theme, icon.metaColor)}
_active={{ opacity: "0.5", transform: "translateY(5px)" }}
bgColor={icon.color}
_hover={{}}
Expand Down
4 changes: 3 additions & 1 deletion src/contexts/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createContext, useEffect, useState } from "react";
import { ContextProviderProps, ThemeContextProps, ThemeFunction } from "../TYPES";
import { ChakraProvider, ThemeConfig } from "@chakra-ui/react";
import { blueTheme } from "../themes/BlueTheme";
import changeThemeMeta from "../helpers/MobileChromeTheme";

const ThemeContext = createContext<ThemeContextProps | undefined>(undefined);

Expand All @@ -12,8 +13,9 @@ const ThemeContextProvider: React.FC<ContextProviderProps> = ({ children }) => {
setTheme(blueTheme);
}, []);

const handleTheme: ThemeFunction = (config) => {
const handleTheme: ThemeFunction = (config, metaColor) => {
setTheme(config);
changeThemeMeta(metaColor);
};

return (
Expand Down

0 comments on commit 0fdfdd1

Please sign in to comment.