From 350b2dfbe22bea82ca2d5739d5aebbf9277fe7b7 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 21 Dec 2022 00:18:15 +0100 Subject: css: Add theme switcher scss sources. --- assets/_theme-switcher.scss | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 assets/_theme-switcher.scss (limited to 'assets/_theme-switcher.scss') diff --git a/assets/_theme-switcher.scss b/assets/_theme-switcher.scss new file mode 100644 index 0000000..bcc59d2 --- /dev/null +++ b/assets/_theme-switcher.scss @@ -0,0 +1,71 @@ +/** + * Docs: Theme switcher + */ + +.switcher { + position: fixed; + right: calc(var(--spacing) / 2 + var(--scrollbar-width, 0px)); + bottom: var(--spacing); + width: auto; + margin-bottom: 0; + padding: 0.75rem; + border-radius: 2rem; + box-shadow: var(--card-box-shadow); + line-height: 1; + text-align: right; + + &::after { + display: inline-block; + width: 1rem; + height: 1rem; + border: 0.15rem solid currentColor; + border-radius: 50%; + background: linear-gradient( + to right, + currentColor 0%, + currentColor 50%, + transparent 50% + ); + content: ""; + vertical-align: bottom; + transition: transform var(--transition); + } + + i { + display: inline-block; + max-width: 0; + padding: 0; + overflow: hidden; + font-style: normal; + font-size: 0.875rem; + white-space: nowrap; + } + + &:hover, + &:focus { + max-width: 100%; + transition: background-color var(--transition), + border-color var(--transition), color var(--transition), + box-shadow var(--transition); + } + + &:hover { + &::after { + transform: rotate(180deg); + } + + i { + max-width: 100%; + padding: 0 calc(var(--spacing) / 2) 0 calc(var(--spacing) / 4); + transition: max-width var(--transition), padding var(--transition); + } + } + + &:focus { + box-shadow: var(--card-box-shadow), 0 0 0 0.2rem var(--secondary-focus); + } + + @media (min-width: map-get($breakpoints, "sm")) { + right: calc(var(--spacing) + var(--scrollbar-width, 0px)); + } +} -- cgit v1.2.3