feat(frontend): add a terminal theme and three-way theme switcher
Adds the cyber theme to the console and login page, replaces the dark/light toggle with a theme switcher, and moves the login page script to /login.js so it is served under the existing CSP.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import {useEffect, useState} from 'react'
|
||||
|
||||
type Theme = 'dark' | 'light'
|
||||
export type Theme = 'dark' | 'light' | 'cyber'
|
||||
|
||||
function getStored(): Theme {
|
||||
const v = localStorage.getItem('floci-theme')
|
||||
return v === 'light' ? 'light' : 'dark'
|
||||
return v === 'light' || v === 'cyber' ? v : 'dark'
|
||||
}
|
||||
|
||||
export function useTheme() {
|
||||
@@ -15,7 +15,5 @@ export function useTheme() {
|
||||
localStorage.setItem('floci-theme', theme)
|
||||
}, [theme])
|
||||
|
||||
const toggle = () => setTheme(t => t === 'dark' ? 'light' : 'dark')
|
||||
|
||||
return {theme, toggle}
|
||||
return {theme, setTheme}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user