This commit is contained in:
2022-12-27 22:50:16 -06:00
parent 69540a868b
commit 77f6472679
3 changed files with 27 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
import { createRef, InputHTMLAttributes, useState } from "react" import { createRef, HTMLAttributes, InputHTMLAttributes, useState } from "react"
import { overrideTailwindClasses } from '../general' import { overrideTailwindClasses } from '../general'
import { SVGEye } from "./Icons" import { SVGEye } from "./Icons"
@@ -74,3 +74,23 @@ export function InputPassword({ invalid, ...props }: InputProps) {
</span> </span>
) )
} }
interface ButtonProps extends HTMLAttributes<HTMLButtonElement> { }
export function Button({ children, ...props }: ButtonProps) {
return (
<button className={`
rounded-full outline-none
bg-gray-800 focus:bg-gray-700
hover:bg-gray-700 active:bg-gray-800
fill-gray-400 focus:fill-gray-200
px-3 py-2
shadow-glow shadow-transparent
focus:outline-blue-500 focus:shadow-blue-500
transition-all
`}
{...props}>
{children}
</button>
)
}

View File

@@ -1,6 +1,7 @@
import { Outlet, Navigate, NavLink } from 'react-router-dom' import { Outlet, Navigate, NavLink } from 'react-router-dom'
import { isLoggedIn, LoginState, usePersistentState } from '../authorization' import { isLoggedIn, LoginState, usePersistentState } from '../authorization'
import { SVGHamburger } from '../components/Icons' import { SVGHamburger } from '../components/Icons'
import { Button } from '../components/Inputs'
function SLink({ to, children, important }: { function SLink({ to, children, important }: {
to: string, to: string,
@@ -40,20 +41,9 @@ export function Layout() {
bg-gray-700 text-gray-400 bg-gray-700 text-gray-400
${collapsed ? "w-14" : "w-48"} ${collapsed ? "w-14" : "w-48"}
`}> `}>
<label className={` <Button onClick={() => setCollapsed(!collapsed)}>
inline-block
rounded-full
focus:bg-gray-700 hover:bg-gray-700 active:bg-gray-800
fill-gray-400 focus:fill-gray-200
px-3 py-2 mx-2
shadow-glow
outline-none shadow-transparent
focus:outline-blue-500 focus:shadow-blue-500
transition-all
`}>
<input className="hidden" type="checkbox" checked={collapsed} onChange={e => setCollapsed(e.target.checked)} />
<SVGHamburger /> <SVGHamburger />
</label> </Button>
<div className="menu"> <div className="menu">
<SLink to="/">Dashboard</SLink> <SLink to="/">Dashboard</SLink>
<SLink to="/bots">Bots</SLink> <SLink to="/bots">Bots</SLink>

View File

@@ -2,7 +2,7 @@ import { useMemo, useState } from "react"
import { Navigate } from "react-router-dom" import { Navigate } from "react-router-dom"
import { authorizeLogin, isLoggedIn, LoginState, useClearToken } from "../authorization" import { authorizeLogin, isLoggedIn, LoginState, useClearToken } from "../authorization"
import { SVGRightArrow } from "../components/Icons" import { SVGRightArrow } from "../components/Icons"
import { InputPassword, InputText } from "../components/Inputs" import { Button, InputPassword, InputText } from "../components/Inputs"
export function Login() { export function Login() {
var [username, setUsername] = useState("") var [username, setUsername] = useState("")
@@ -36,18 +36,9 @@ export function Login() {
onChange={e => setPassword(e.target.value)} /> onChange={e => setPassword(e.target.value)} />
</div> </div>
<div className="flex justify-center items-center align-middle my-2"> <div className="flex justify-center items-center align-middle my-2">
<button className={` <Button>
rounded-full outline-none
bg-gray-800 focus:bg-gray-700
hover:bg-gray-700 active:bg-gray-800
fill-gray-400 focus:fill-gray-200
px-3 py-2
shadow-glow shadow-transparent
focus:outline-blue-500 focus:shadow-blue-500
transition-all
`}>
<SVGRightArrow /> <SVGRightArrow />
</button> </Button>
</div> </div>
</form> </form>
{ {