mirror of
https://github.com/versia-pub/docs.git
synced 2026-03-13 02:49:16 +01:00
feat: ✨ Introduce uwu mode
This commit is contained in:
parent
5026e59d17
commit
be79c569a1
4 changed files with 62 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
"use client";
|
||||
|
||||
import { uwuifyDocument } from "@/lib/uwuify";
|
||||
import { ThemeProvider, useTheme } from "next-themes";
|
||||
import { type ReactNode, useEffect } from "react";
|
||||
|
||||
|
|
@ -27,10 +28,31 @@ function ThemeWatcher() {
|
|||
return null;
|
||||
}
|
||||
|
||||
function UwuWatcher() {
|
||||
// Uwuify the whole page when ctrl + u is pressed
|
||||
useEffect(() => {
|
||||
function onKeyDown(event: KeyboardEvent) {
|
||||
if (event.key === "u" && (event.metaKey || event.ctrlKey)) {
|
||||
event.preventDefault();
|
||||
uwuifyDocument();
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("keydown", onKeyDown);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener("keydown", onKeyDown);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export function Providers({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<ThemeProvider attribute="class" disableTransitionOnChange={true}>
|
||||
<ThemeWatcher />
|
||||
<UwuWatcher />
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue