-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(navigation): create NavigateProvider for improve navigate rerend…
…er components
- Loading branch information
Stéphane
committed
Oct 12, 2023
1 parent
2d24382
commit 150f305
Showing
16 changed files
with
206 additions
and
144 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
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 |
---|---|---|
@@ -1,21 +1,26 @@ | ||
import { ColorScheme } from "@mantine/core"; | ||
import { ColorScheme, UnstyledButton } from "@mantine/core"; | ||
import { useLocalStorage } from "@mantine/hooks"; | ||
import { memo } from "react"; | ||
import { Link } from "react-router-dom"; | ||
import { useStableNavigate } from "../providers/Navigate"; | ||
|
||
export const Logo = memo(() => { | ||
const [colorScheme] = useLocalStorage<ColorScheme>({ | ||
key: "mantine-color-scheme", | ||
}); | ||
const navigate = useStableNavigate(); | ||
|
||
const isDarkMode = colorScheme === "dark"; | ||
const imageSrc = isDarkMode | ||
? "/logo-holoplay-white.png" | ||
: "/logo-holoplay-blue.png"; | ||
|
||
return ( | ||
<Link to="/" style={{ marginTop: 8 }}> | ||
<UnstyledButton | ||
component="a" | ||
onClick={() => navigate("/")} | ||
style={{ marginTop: 8 }} | ||
> | ||
<img src={imageSrc} width={40} alt="Logo HoloPlay" /> | ||
</Link> | ||
</UnstyledButton> | ||
); | ||
}); |
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
Oops, something went wrong.