-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
83 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { termsOfServiceUrl } from "../constants"; | ||
|
||
export function Footer() { | ||
return ( | ||
<span id="version-footer"> | ||
<a href={termsOfServiceUrl}>Terms</a> | v{import.meta.env.PACKAGE_VERSION} | ||
</span> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
export function useIsDarkMode(): boolean { | ||
const [isDarkMode, setIsDarkMode] = useState<boolean>(() => { | ||
// Check the current theme using matchMedia | ||
return window.matchMedia("(prefers-color-scheme: dark)").matches; | ||
}); | ||
|
||
useEffect(() => { | ||
// Update the theme on changes | ||
const mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)"); | ||
const handleChange = (e: MediaQueryListEvent) => { | ||
setIsDarkMode(e.matches); | ||
}; | ||
|
||
mediaQueryList.addEventListener("change", handleChange); | ||
|
||
// Cleanup event listener on component unmount | ||
return () => { | ||
mediaQueryList.removeEventListener("change", handleChange); | ||
}; | ||
}, []); | ||
|
||
return isDarkMode; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useErrorMessage } from "../hooks/useErrorMessage"; | ||
import { LogoHeader } from "../components/LogoHeader"; | ||
import "./Page.css"; | ||
import { ErrMsgCallback } from "../types"; | ||
import { Footer } from "../components/Footer"; | ||
|
||
interface PageProps { | ||
page: (errorCallback: ErrMsgCallback) => JSX.Element; | ||
} | ||
|
||
export function Page({ page }: PageProps) { | ||
const [errorMessage, errorCallback] = useErrorMessage(); | ||
|
||
return ( | ||
<> | ||
<LogoHeader errorMessage={errorMessage} /> | ||
{page(errorCallback)} | ||
<Footer /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export type ErrMsgCallback = (error: string) => void; | ||
export type ErrMsgCallbackAsProps = { | ||
errorCallback: ErrMsgCallback; | ||
}; |