From 45fc2eed5aa43de8a2cd0f9108508758e822cf6f Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sat, 19 Oct 2024 01:49:00 -0700 Subject: [PATCH] rewrite DocsCollapsible now with disabled js support and less broken animations --- src/components/Accordion.astro | 55 +++++++++++++++++++ src/components/Collapsible.astro | 16 ++++++ src/components/Collapsible.tsx | 18 ------ src/icons/collapsible-marker.svg | 2 + src/pages/docs/configuration/intro.mdx | 6 +- src/pages/docs/configuration/qml-overview.mdx | 10 ++-- src/styles/components/accordion.css | 17 ++++++ src/styles/css-config/animations.css | 20 ------- src/styles/docs/docs.css | 38 +++++++++++++ 9 files changed, 136 insertions(+), 46 deletions(-) create mode 100644 src/components/Accordion.astro create mode 100644 src/components/Collapsible.astro delete mode 100644 src/components/Collapsible.tsx create mode 100644 src/icons/collapsible-marker.svg create mode 100644 src/styles/components/accordion.css diff --git a/src/components/Accordion.astro b/src/components/Accordion.astro new file mode 100644 index 0000000..613dd50 --- /dev/null +++ b/src/components/Accordion.astro @@ -0,0 +1,55 @@ +--- +import "@styles/components/accordion.css" +--- +
+ + + +
+
+ +
+
+
+ diff --git a/src/components/Collapsible.astro b/src/components/Collapsible.astro new file mode 100644 index 0000000..b4b9405 --- /dev/null +++ b/src/components/Collapsible.astro @@ -0,0 +1,16 @@ +--- +import Accordion from "./Accordion.astro" +import collapsibleMarker from "@icons/collapsible-marker.svg?raw" + +interface Props { + title: string +} +const { title } = Astro.props; +--- + +
+ + {title} +
+ +
diff --git a/src/components/Collapsible.tsx b/src/components/Collapsible.tsx deleted file mode 100644 index 93372ac..0000000 --- a/src/components/Collapsible.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Collapsible } from "@ark-ui/solid"; -import type { Component, JSX } from "solid-js"; -import { CaretCircleRight } from "@icons"; - -export const DocsCollapsible: Component<{ - title: string; - children: JSX.Element; -}> = props => { - return ( - - - - {props.title} - - {props.children} - - ); -}; diff --git a/src/icons/collapsible-marker.svg b/src/icons/collapsible-marker.svg new file mode 100644 index 0000000..c2ae7db --- /dev/null +++ b/src/icons/collapsible-marker.svg @@ -0,0 +1,2 @@ + + diff --git a/src/pages/docs/configuration/intro.mdx b/src/pages/docs/configuration/intro.mdx index d8c4759..d6842d5 100644 --- a/src/pages/docs/configuration/intro.mdx +++ b/src/pages/docs/configuration/intro.mdx @@ -3,7 +3,7 @@ layout: "@layouts/ConfigLayout.astro" title: "Introduction" --- -import { DocsCollapsible } from "@components/Collapsible.tsx"; +import Collapsible from "@components/Collapsible.astro"; import MD_Title from "@components/MD_Title.tsx" # {frontmatter.title} @@ -35,7 +35,7 @@ The shell root is not a visual element but instead contains all of the visual and non visual objects in your shell. You can have multiple different shells with shared components and different shell roots. - + Quickshell can be launched with configurations in locations other than the default one. The `-p` or `--path` option will launch the shell root at the given path. @@ -68,7 +68,7 @@ myconf4 = ~/.config/quickshell/myconf You can use `quickshell --current` to print the current values of any of these options and what set them. - + ## Creating Windows diff --git a/src/pages/docs/configuration/qml-overview.mdx b/src/pages/docs/configuration/qml-overview.mdx index 63976b7..960d3a1 100644 --- a/src/pages/docs/configuration/qml-overview.mdx +++ b/src/pages/docs/configuration/qml-overview.mdx @@ -3,7 +3,7 @@ layout: "@layouts/ConfigLayout.astro" title: "QML Overview" --- import MD_Title from "@components/MD_Title.tsx" -import { DocsCollapsible } from "@components/Collapsible.tsx"; +import Collapsible from "@components/Collapsible.astro"; # {frontmatter.title} @@ -140,7 +140,7 @@ import QtQuick.Layouts 6.0 as L import "jsfile.js" as JsFile ``` - + By default, when no module version is requested, the QML engine will pick the latest available version of the module. Requesting a specific version @@ -151,7 +151,7 @@ While Qt's types usually don't majorly change across versions, quickshell's are much more likely to break. To put off dealing with the breakage we suggest specifying a version at least when importing quickshell modules. - + [Qt Documentation: Import @@ -321,14 +321,14 @@ the object a name it can be referred to throughout the current file. The id must } ``` - + The `id` property isn't really a property, and doesn't do anything other than expose the object to the current file. It is only called a property because it uses very similar syntax to one, and is the only exception to standard property definition rules. The name `id` is always reserved for the id property. - + ##### Property access scopes diff --git a/src/styles/components/accordion.css b/src/styles/components/accordion.css new file mode 100644 index 0000000..ac6f430 --- /dev/null +++ b/src/styles/components/accordion.css @@ -0,0 +1,17 @@ +.accordion { + & summary { + list-style: none; + } + + & .accordion-container { + /* fixes jumps due to margins on inline items */ + display: flex; + } + + & .accordion-container.animate { + /* this somehow breaks if both min AND max aren't animated */ + transition: min-height 0.3s ease, max-height 0.3s ease; + min-height: var(--height); + max-height: var(--height); + } +} diff --git a/src/styles/css-config/animations.css b/src/styles/css-config/animations.css index e00ad7a..4910fb3 100644 --- a/src/styles/css-config/animations.css +++ b/src/styles/css-config/animations.css @@ -57,26 +57,6 @@ } } -@keyframes rotateIn90 { - from { - transform: rotate(0deg); - } - - to { - transform: rotate(90deg); - } -} - -@keyframes rotateOut90 { - from { - transform: rotate(90deg); - } - - to { - transform: rotate(0deg); - } -} - @keyframes percentToFifty { from { --percent: 0%; diff --git a/src/styles/docs/docs.css b/src/styles/docs/docs.css index 5f5ea36..a2c564a 100644 --- a/src/styles/docs/docs.css +++ b/src/styles/docs/docs.css @@ -142,3 +142,41 @@ ul { min-width: 33.8rem; } } + +.docs-collapsible { + background-color: hsl(var(--white) 40 50 / 0.1); + border-radius: 0.618rem; + overflow: hidden; + + & summary { + padding: 1.2rem; + user-select: none; + + & > div { + display: flex; + flex-direction: row; + align-items: center; + gap: 0.1em; + font-size: 1.117rem; + font-weight: 500; + + & svg { + transition: transform 0.3s ease; + font-size: 1.1em; + } + } + } + + & .accordion-container > div { + padding: 0 1.2rem; + + & p:first-child { + padding-top: 0; + margin-top: 0; + } + } +} + +.docs-collapsible[open]:not(.closing) > summary > div > svg { + transform: rotate(90deg); +}