diff --git a/package.json b/package.json index 3115448..38ba9d3 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,16 @@ "@types/react": "^18.0.26", "@types/react-dom": "^18.0.9", "@vitejs/plugin-react": "^3.0.0", + "autoprefixer": "^10.4.13", "dotenv": "^16.0.3", "eslint": "^8.29.0", + "postcss": "^8.4.20", "prettier": "^2.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.4.5", "sass": "^1.56.2", + "tailwindcss": "^3.2.4", "typescript": "^4.9.4", "vite": "^4.0.0" }, diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..33ad091 --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/src/App.tsx b/src/App.tsx index 9b01577..06cb928 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,7 +11,7 @@ import { Tokens } from "./pages/Tokens"; function App() { return ( -
+
} /> diff --git a/src/_index.scss b/src/_index.scss new file mode 100644 index 0000000..d7a8529 --- /dev/null +++ b/src/_index.scss @@ -0,0 +1,81 @@ +#root { + --bg-color-1: #262626; + --bg-color-2: #363636; + --bg-color-3-5: #3d3d3d; + --bg-color-3: #464646; + --text-color-1: #d6d6d6; + --text-color-2: #a6a6a6; + --color-error: #860000; + + #sidebar { + position: fixed; + top: 0; + left: 0; + + height: 100%; + + width: 200px; + & + #content { + margin-left: 200px; + } + + &.collapse { + width: 50px; + & + #content { + margin-left: 50px; + } + } + + background-color: var(--bg-color-2); + color: var(--text-color-2); + + #collapse { + cursor: pointer; + input { + display: none; + } + } + + .menu { + display: flex; + flex-direction: column; + align-items: center; + font-weight: bold; + + width: 100%; + height: calc(100% - 50px); + + a { + text-decoration: none; + color: inherit; + font-weight: inherit; + width: 100%; + } + + .item { + display: flex; + justify-content: center; + align-items: center; + + width: 100%; + height: 50px; + + font-size: 16px; + + &:hover, + &:focus { + background-color: var(--bg-color-3); + color: var(--text-color-1); + + &.important { + background-color: var(--color-error); + } + } + } + } + } + + #content { + overflow-x: hidden; + } +} \ No newline at end of file diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..bd6213e --- /dev/null +++ b/src/index.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; \ No newline at end of file diff --git a/src/index.scss b/src/index.scss deleted file mode 100644 index fe79938..0000000 --- a/src/index.scss +++ /dev/null @@ -1,173 +0,0 @@ -body { - margin: 0; -} - -#root { - --bg-color-1: #262626; - --bg-color-2: #363636; - --bg-color-3-5: #3d3d3d; - --bg-color-3: #464646; - --text-color-1: #d6d6d6; - --text-color-2: #a6a6a6; - --color-error: #860000; - - background-color: var(--bg-color-1); - color: var(--text-color-1); - font-family: Helvetica, Arial, sans-serif; - font-size: 16px; - - width: 100%; - height: 100%; - - input { - border: none; - outline: none; - background-color: var(--bg-color-2); - color: var(--text-color-2); - font-size: 16px; - - &[type="text"], - &[type="password"] { - width: 200px; - } - - padding: 7px 10px; - margin: 0 5px; - - border-radius: 200px; - - &:focus { - background-color: var(--bg-color-3); - color: var(--text-color-1); - } - - border-bottom: 1px solid transparent; - &.error { - border-bottom: 1px solid var(--color-error); - } - } - - button, .button { - display: inline-block; - border: none; - outline: none; - background-color: var(--bg-color-2); - color: var(--text-color-2); - font-size: 16px; - - &.svg svg { - fill: var(--text-color-2); - height: 16px; - } - - padding: 7px 10px; - margin: 0 5px; - - &.pad { - padding: 10px 15px; - margin: 10px; - } - - border-radius: 200px; - - &:hover, - &:focus { - background-color: var(--bg-color-3); - color: var(--text-color-1); - - &.svg svg { - fill: var(--text-color-1); - } - } - - &:active { - background-color: var(--bg-color-3-5); - } - } - - #login { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - - width: 100%; - height: 100%; - - .form { - margin-bottom: 5px; - } - } - - #sidebar { - position: fixed; - top: 0; - left: 0; - - height: 100%; - - width: 200px; - & + #content { - margin-left: 200px; - } - - &.collapse { - width: 50px; - & + #content { - margin-left: 50px; - } - } - - background-color: var(--bg-color-2); - color: var(--text-color-2); - - #collapse { - cursor: pointer; - input { - display: none; - } - } - - .menu { - display: flex; - flex-direction: column; - align-items: center; - font-weight: bold; - - width: 100%; - height: calc(100% - 50px); - - a { - text-decoration: none; - color: inherit; - font-weight: inherit; - width: 100%; - } - - .item { - display: flex; - justify-content: center; - align-items: center; - - width: 100%; - height: 50px; - - font-size: 16px; - - &:hover, - &:focus { - background-color: var(--bg-color-3); - color: var(--text-color-1); - - &.important { - background-color: var(--color-error); - } - } - } - } - } - - #content { - overflow-x: hidden; - } -} \ No newline at end of file diff --git a/src/main.tsx b/src/main.tsx index 3ffdf28..013b143 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,7 +1,7 @@ import React from 'react' import ReactDOM from 'react-dom/client' import App from './App' -import './index.scss' +import './index.css' ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( diff --git a/src/pages/Layout.tsx b/src/pages/Layout.tsx index 5cde7b8..95c3059 100644 --- a/src/pages/Layout.tsx +++ b/src/pages/Layout.tsx @@ -1,7 +1,27 @@ import { Outlet, Navigate, NavLink } from 'react-router-dom' import { isLoggedIn, LoginState, usePersistentState } from '../authorization' -const activeClassName: ({ isActive }: { isActive: boolean }) => string = ({ isActive }) => isActive ? "active" : "" +function SLink({ to, children, important }: { + to: string, + children: React.ReactNode, + important?: boolean +}) { + return ( + + "flex w-full h-10 justify-center items-center hover:text-gray-300 " + + (isActive ? "bg-gray-500 text-gray-300 " : "") + + (important ? + "hover:bg-red-900 active:bg-red-800" : + "hover:bg-gray-600 active:bg-gray-600" + ) + } + to={to}> + {children} + + ) +} export function Layout() { const [collapsed, setCollapsed] = usePersistentState("collapsed", false) @@ -10,21 +30,36 @@ export function Layout() { { isLoggedIn() === LoginState.No && } -