diff --git a/src/App.tsx b/src/App.tsx index adbdc75..74f0cc1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,4 @@ import "./App.css"; - -import { NextUIProvider } from "@nextui-org/react"; import { PipedAPI } from "piped-api"; import { HashRouter, Navigate, Route, Routes } from "react-router-dom"; import TrendingPage from "./pages/trending"; @@ -16,16 +14,14 @@ function App() { window.piped_api = new PipedAPI(); return ( - - - - - } /> - } /> - } /> - - - + + + + } /> + } /> + } /> + + ); } diff --git a/src/components/utils.ts b/src/components/utils.ts index 6f52323..cc0ac73 100644 --- a/src/components/utils.ts +++ b/src/components/utils.ts @@ -10,3 +10,13 @@ export function shortenNumber(number: number) { export function capitalize(string: string) { return string.charAt(0).toUpperCase() + string.slice(1); } + +export function getTheme() { + if (window.matchMedia) { + return window.matchMedia("(prefers-color-scheme: dark)").matches + ? "dark" + : "light"; + } else { + return "light"; + } +} diff --git a/src/main.tsx b/src/main.tsx index 3d7150d..1265190 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,10 +1,20 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import App from './App.tsx' -import './index.css' +import React from "react"; +import ReactDOM from "react-dom/client"; +import App from "./App.tsx"; +import "./index.css"; +import { NextUIProvider } from "@nextui-org/react"; +import { getTheme } from "./components/utils.ts"; -ReactDOM.createRoot(document.getElementById('root')!).render( +ReactDOM.createRoot(document.getElementById("root")!).render( - - , -) + +
+ +
+
+ +);