Skip to content

Commit

Permalink
feat: add footer
Browse files Browse the repository at this point in the history
  • Loading branch information
limsohee1002 committed Oct 31, 2024
1 parent 6f487c0 commit 8261f3c
Show file tree
Hide file tree
Showing 11 changed files with 443 additions and 46 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules/
.a11yrc.json
*.DS_Store
coverage/
assets/*.js
script.js
style.css
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nodejs 18.18.0

164 changes: 164 additions & 0 deletions assets/tailwind-output.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/context/uiProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import React, {
useState,
useContext,
useEffect,
} from "react";
} from 'react';

import { ThemeManager, Theme } from "../utils/storage";
import { ThemeManager, Theme } from '../utils/storage';

type UIProviderProps = {
theme: Theme;
Expand All @@ -20,21 +20,21 @@ export const useUIProvider = () => {
const context = useContext(UIContext);

if (context === undefined) {
throw new Error("useUIProvider must be used within a UIProvider");
throw new Error('useUIProvider must be used within a UIProvider');
}

return context;
};

export const UIProvider: FC<PropsWithChildren<{}>> = ({ children }) => {
export const UIProvider: FC<{ children: React.ReactNode }> = ({ children }) => {
const [theme, setTheme] = useState<Theme>('light');

useEffect(() => {
if (typeof window !== "undefined") {
if (typeof window !== 'undefined') {
const currentTheme = ThemeManager.get();

if (!currentTheme) {
ThemeManager.set("light");
ThemeManager.set('light');
} else {
setTheme(currentTheme);
}
Expand All @@ -43,7 +43,7 @@ export const UIProvider: FC<PropsWithChildren<{}>> = ({ children }) => {

const toggleTheme = () => {
setTheme((prev) => {
const newTheme = prev === "dark" ? "light" : "dark";
const newTheme = prev === 'dark' ? 'light' : 'dark';
ThemeManager.set(newTheme);
document.documentElement.classList.toggle('dark', newTheme === 'dark'); // Toggles the dark class
return newTheme;
Expand Down
Loading

0 comments on commit 8261f3c

Please sign in to comment.