diff --git a/app/assets/images/monitor.svg b/app/assets/images/monitor.svg new file mode 100644 index 000000000..a1140a2a8 --- /dev/null +++ b/app/assets/images/monitor.svg @@ -0,0 +1 @@ + diff --git a/app/assets/images/moon.svg b/app/assets/images/moon.svg new file mode 100644 index 000000000..8db6c1b09 --- /dev/null +++ b/app/assets/images/moon.svg @@ -0,0 +1 @@ + diff --git a/app/assets/images/sun.svg b/app/assets/images/sun.svg new file mode 100644 index 000000000..6dd6e54c8 --- /dev/null +++ b/app/assets/images/sun.svg @@ -0,0 +1 @@ + diff --git a/app/assets/stylesheets/icons.css b/app/assets/stylesheets/icons.css index 8e9f19e89..2e269b9d0 100644 --- a/app/assets/stylesheets/icons.css +++ b/app/assets/stylesheets/icons.css @@ -72,6 +72,8 @@ .icon--menu-dots-horizontal { --svg: url("menu-dots-horizontal.svg "); } .icon--menu-dots-vertical { --svg: url("menu-dots-vertical.svg "); } .icon--minus { --svg: url("minus.svg "); } + .icon--monitor { --svg: url("monitor.svg "); } + .icon--moon { --svg: url("moon.svg "); } .icon--move { --svg: url("move.svg "); } .icon--notification-bell-access-only { --svg: url("bell.svg "); } .icon--notification-bell-watching { --svg: url("bell-off.svg "); } @@ -96,6 +98,7 @@ .icon--settings { --svg: url("settings.svg "); } .icon--share { --svg: url("share.svg "); } .icon--sliders { --svg: url("sliders.svg "); } + .icon--sun { --svg: url("sun.svg "); } .icon--switch { --svg: url("switch.svg "); } .icon--tag { --svg: url("tag.svg "); } .icon--tag-outline { --svg: url("tag-outline.svg "); } diff --git a/app/assets/stylesheets/theme-switcher.css b/app/assets/stylesheets/theme-switcher.css new file mode 100644 index 000000000..1e35ca990 --- /dev/null +++ b/app/assets/stylesheets/theme-switcher.css @@ -0,0 +1,67 @@ +@layer components { + .theme-switcher { + --gap: 8px; + + align-items: center; + display: flex; + flex-wrap: wrap; + gap: var(--gap); + inline-size: 100%; + justify-content: center; + margin: 1rem auto; + max-inline-size: 100%; + } + + .theme-switcher__btn { + --btn-border-radius: 0.4em; + + align-items: center; + aspect-ratio: 5/3; + background-color: var(--color-ink-lightest); + border: none; + border-radius: 0.5em; + color: inherit; + cursor: pointer; + display: flex; + flex-basis: calc((100% - var(--gap) * 2) / 3); + flex-direction: column; + font-size: var(--text-small); + line-height: 1; + justify-content: center; + overflow: hidden; + padding: 0.5em; + position: relative; + row-gap: 0.3lh; + text-align: center; + + .icon { + --icon-size: 2em; + } + + span { + display: block; + text-wrap: nowrap; + } + + @media (max-width: 639px) { + font-size: var(--text-x-small); + font-weight: 500; + } + + @media (any-hover: hover) { + &:hover { + background-color: var(--color-ink-lighter); + } + } + + &[aria-selected="true"] { + background-color: var(--color-selected); + + @media (any-hover: hover) { + &:hover { + background-color: var(--color-selected); + } + } + } + } +} diff --git a/app/views/users/_theme.html.erb b/app/views/users/_theme.html.erb index 86cf694e2..ce4e91429 100644 --- a/app/views/users/_theme.html.erb +++ b/app/views/users/_theme.html.erb @@ -1,35 +1,19 @@