From 09302ad58e7383a123ce6fb9e704057a7ed543c8 Mon Sep 17 00:00:00 2001 From: Xanazf Date: Fri, 8 Nov 2024 09:39:43 +0200 Subject: [PATCH] lrl layout done --- README.md | 5 +- src/components/featurelist/FeatureList.astro | 55 ++++++++++++ src/components/hooks/ThemeSwitch.tsx | 36 +++++--- src/pages/index.astro | 6 ++ src/styles/components/featurelist.css | 90 ++++++++++++++++++++ src/styles/global.css | 13 +++ src/styles/main-page.css | 14 ++- 7 files changed, 202 insertions(+), 17 deletions(-) create mode 100644 src/components/featurelist/FeatureList.astro create mode 100644 src/styles/components/featurelist.css diff --git a/README.md b/README.md index 91f09b3..20d9863 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,13 @@ Hosted version at [quickshell.outfoxxed.me](https://quickshell.outfoxxed.me) Frontend rewritten by [Xanazf](https://github.com/Xanazf) ## Notes for future updates -- improve Head + +~- improve Head~ + - improve light theme - QtQML docs search - page metadata: - lastUpdatedAt - prevUpdate? - editURL +- typedocs clearer borders between layout parts diff --git a/src/components/featurelist/FeatureList.astro b/src/components/featurelist/FeatureList.astro new file mode 100644 index 0000000..6e5e00b --- /dev/null +++ b/src/components/featurelist/FeatureList.astro @@ -0,0 +1,55 @@ +--- +import { processMarkdown } from "@config/io/markdown"; + +let codeString = `\`\`\`qml +// a standard desktop window +FloatingWindow { + Timer { + id: timer // give the timer a name to refer to it by + property bool invert: false // our custom property + + // change the value of invert every half second + running: true; repeat: true + interval: 500 // ms + onTriggered: timer.invert = !timer.invert + } + + // change the window's color when timer.invert changes + color: timer.invert ? "purple" : "green" +} +\`\`\` +`; + +const codeHTML = await processMarkdown(codeString); +--- + diff --git a/src/components/hooks/ThemeSwitch.tsx b/src/components/hooks/ThemeSwitch.tsx index 2bc106a..8db7a61 100644 --- a/src/components/hooks/ThemeSwitch.tsx +++ b/src/components/hooks/ThemeSwitch.tsx @@ -9,28 +9,31 @@ import { import Sun from "@icons/sun.svg?raw"; import Moon from "@icons/moon.svg?raw"; -interface ThemeProps { +export interface ThemeProps { theme: "light" | "dark"; system: "light" | "dark"; } -const getCurrentTheme = (): ThemeProps => { +export const getCurrentTheme = (): ThemeProps => { if ( typeof localStorage !== "undefined" && (localStorage.theme === "dark" || (!("theme" in localStorage) && - window.matchMedia("(prefers-color-scheme: dark)").matches)) + window.matchMedia("(prefers-color-scheme: dark)") + .matches)) ) { return { theme: "dark", - system: window.matchMedia("(prefers-color-scheme: dark)").matches + system: window.matchMedia("(prefers-color-scheme: dark)") + .matches ? "dark" : "light", }; } return { theme: "light", - system: window.matchMedia("(prefers-color-scheme: dark)").matches + system: window.matchMedia("(prefers-color-scheme: dark)") + .matches ? "dark" : "light", }; @@ -55,10 +58,11 @@ const updateTheme = () => { }; export const ThemeSelect: VoidComponent = () => { - const [currentTheme, setCurrentTheme] = createSignal({ - theme: "dark", - system: "dark", - }); + const [currentTheme, setCurrentTheme] = + createSignal({ + theme: "dark", + system: "dark", + }); const [mounted, setMounted] = createSignal(false); const toggleTheme = () => { @@ -67,7 +71,8 @@ export const ThemeSelect: VoidComponent = () => { if (currentTheme()!.theme !== currentTheme()!.system) { localStorage.removeItem("theme"); } else { - localStorage.theme = currentTheme()!.theme === "dark" ? "light" : "dark"; + localStorage.theme = + currentTheme()!.theme === "dark" ? "light" : "dark"; } updateTheme(); setCurrentTheme(getCurrentTheme()); @@ -79,7 +84,9 @@ export const ThemeSelect: VoidComponent = () => { }); createEffect(() => { - const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); + const mediaQuery = window.matchMedia( + "(prefers-color-scheme: dark)" + ); mediaQuery.addEventListener("change", updateTheme); window.addEventListener("storage", updateTheme); @@ -94,7 +101,12 @@ export const ThemeSelect: VoidComponent = () => {
); }; diff --git a/src/pages/index.astro b/src/pages/index.astro index 5891b55..c4fb822 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,6 +1,7 @@ --- import BaseLayout from "@layouts/BaseLayout.astro"; import Marquee from "@components/marquee/Marquee.astro"; +import FeatureList from "@src/components/featurelist/FeatureList.astro"; const title = "Quickshell"; const subtitle = "A framework for building fully custom"; @@ -16,6 +17,11 @@ const subtitle = "A framework for building fully custom"; Install Get Started +
+
+ +
+