diff --git a/package.json b/package.json index 38ba9d3..745813f 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "react-dom": "^18.2.0", "react-router-dom": "^6.4.5", "sass": "^1.56.2", + "tailwind-override": "^0.6.1", "tailwindcss": "^3.2.4", "typescript": "^4.9.4", "vite": "^4.0.0" diff --git a/src/components/Icons.tsx b/src/components/Icons.tsx new file mode 100644 index 0000000..c8d2093 --- /dev/null +++ b/src/components/Icons.tsx @@ -0,0 +1,36 @@ +export function SVGRightArrow() { + return ( + + + + ) +} + +export function SVGEye() { + return ( + + + + + + + + + ) +} + +export function SVGHamburger() { + return ( + + + + + + + + + + + + ) +} \ No newline at end of file diff --git a/src/components/Inputs.tsx b/src/components/Inputs.tsx new file mode 100644 index 0000000..e52a8c8 --- /dev/null +++ b/src/components/Inputs.tsx @@ -0,0 +1,76 @@ +import { createRef, InputHTMLAttributes, useState } from "react" +import { overrideTailwindClasses } from '../general' +import { SVGEye } from "./Icons" + +interface InputProps extends Omit, "type"> { + invalid?: boolean +} + +export function InputText({ invalid, ...props }: InputProps) { + var inputRef = createRef() + return ( + + ) +} + +export function InputPassword({ invalid, ...props }: InputProps) { + var inputRef = createRef() + var [focused, setFocused] = useState(false) + var [showPassword, setShowPassword] = useState(false) + + var toggleShowPassword = () => { + setShowPassword(!showPassword) + inputRef.current?.focus() + } + + return ( + setFocused(true)} + onBlur={() => setFocused(false)} + className={overrideTailwindClasses(` + flex + flex-row + rounded-full + px-3 py-1 mx-2 + w-64 + bg-gray-800 + shadow-glow + outline-none shadow-transparent + ${invalid ? "outline-red-600 shadow-red-600" : ""} + ${focused ? "outline-blue-500 shadow-blue-500 bg-gray-700" : ""} + transition-all + `)}> + + toggleShowPassword()}> + + + + ) +} \ No newline at end of file diff --git a/src/general.ts b/src/general.ts new file mode 100644 index 0000000..859cd6d --- /dev/null +++ b/src/general.ts @@ -0,0 +1,8 @@ +import { overrideTailwindClasses as otc, Options } from 'tailwind-override' + +export function overrideTailwindClasses( + classNamesString: string, + optionsArgs?: Partial +) { + return otc(classNamesString, optionsArgs).trim() +} diff --git a/src/pages/Layout.tsx b/src/pages/Layout.tsx index 95c3059..19023ba 100644 --- a/src/pages/Layout.tsx +++ b/src/pages/Layout.tsx @@ -1,5 +1,6 @@ import { Outlet, Navigate, NavLink } from 'react-router-dom' import { isLoggedIn, LoginState, usePersistentState } from '../authorization' +import { SVGHamburger } from '../components/Icons' function SLink({ to, children, important }: { to: string, @@ -31,24 +32,27 @@ export function Layout() { isLoggedIn() === LoginState.No && }
-