diff --git a/Makefile b/Makefile index 8d45097..3e3c57e 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,12 @@ -all: css migrate +all: migrate -initialize: npm css migrate sethookdir loadplatforms +initialize: npm migrate sethookdir loadplatforms HTMLFILES := $(shell find games/templates -type f) npm: npm install -css: common/input.css - npx tailwindcss -i ./common/input.css -o ./games/static/base.css - -css-dev: css - npx tailwindcss -i ./common/input.css -o ./games/static/base.css --watch - makemigrations: poetry run python manage.py makemigrations diff --git a/common/input.css b/common/input.css deleted file mode 100644 index e8a7e7d..0000000 --- a/common/input.css +++ /dev/null @@ -1,113 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@font-face { - font-family: "IBM Plex Mono"; - src: url("fonts/IBMPlexMono-regular.woff2") format("woff2"); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: "IBM Plex Sans"; - src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); - font-weight: 400; - font-style: normal; -} - -@font-face { - font-family: "IBM Plex Serif"; - src: url("fonts/IBMPlexSerif-Regular.woff2") format("woff2"); - font-weight: 400; - font-style: normal; -} - -form label { - @apply dark:text-slate-400; -} - -.responsive-table { - @apply dark:text-white mx-auto; -} - -.responsive-table tr:nth-child(even) { - @apply bg-slate-800 -} - -.responsive-table tbody tr:nth-child(odd) { - @apply bg-slate-900 -} - -.responsive-table thead th { - @apply text-left border-b-2 border-b-slate-500 text-xl; -} - -.responsive-table thead th:not(:first-child), -.responsive-table td:not(:first-child) { - @apply border-l border-l-slate-500; -} - -@layer utilities { - .max-w-20char { - max-width: 20ch; - } - .max-w-35char { - max-width: 40ch; - } - .max-w-40char { - max-width: 40ch; - } -} - -form input, -select, -textarea { - @apply dark:border dark:border-slate-900 dark:bg-slate-500 dark:text-slate-100; -} - -form input:disabled, -select:disabled, -textarea:disabled { - @apply dark:bg-slate-700 dark:text-slate-400; -} - -.errorlist { - @apply mt-4 mb-1 pl-3 py-2 bg-red-600 text-slate-200 w-[300px]; -} - -@media screen and (min-width: 768px) { - form input, - select, - textarea { - width: 300px; - } -} - -@media screen and (max-width: 768px) { - form input, - select, - textarea { - width: 150px; - } -} - -#button-container button { - @apply mx-1; -} - -th { - @apply text-right; -} - -th label { - @apply mr-4; -} - -.basic-button-container { - @apply flex space-x-2 justify-center; -} - -.basic-button { - @apply inline-block px-6 py-2.5 bg-blue-600 text-white font-medium text-xs leading-tight uppercase rounded shadow-md hover:bg-blue-700 hover:shadow-lg focus:bg-blue-700 focus:shadow-lg focus:outline-none focus:ring-0 active:bg-blue-800 active:shadow-lg transition duration-150 ease-in-out; -} diff --git a/frontend/index.html b/frontend/index.html index 79c4701..b52f64c 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,11 +2,15 @@ - + + - Vite + React + + + + Timetracker - +
diff --git a/frontend/package.json b/frontend/package.json index 2371d17..af93702 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,8 +9,11 @@ "preview": "vite preview" }, "dependencies": { + "autoprefixer": "^10.4.13", + "postcss": "^8.4.21", "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "tailwindcss": "^3.2.4" }, "devDependencies": { "@types/react": "^18.0.26", @@ -18,4 +21,4 @@ "@vitejs/plugin-react": "^3.0.0", "vite": "^4.0.0" } -} \ No newline at end of file +} diff --git a/frontend/postcss.config.cjs b/frontend/postcss.config.cjs new file mode 100644 index 0000000..33ad091 --- /dev/null +++ b/frontend/postcss.config.cjs @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/frontend/src/App.css b/frontend/src/App.css index 2c5e2ef..e69de29 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -1,41 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index ef0adc0..0831da0 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -1,33 +1,41 @@ import { useState } from 'react' -import reactLogo from './assets/react.svg' import './App.css' function App() { const [count, setCount] = useState(0) return ( -
-
- - Vite logo - - - React logo - -
-

Vite + React

-
- -

- Edit src/App.jsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

-
+ <> +
+ + {/* {% block content %}No content here.{% endblock content %} */} +
+ {/* {% load version %} */} + {/* {% version %} ({% version_date %}) */} + ) } diff --git a/frontend/src/assets/react.svg b/frontend/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/frontend/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/src/index.css b/frontend/src/index.css index 917888c..539a4ec 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -1,70 +1,22 @@ -:root { - font-family: Inter, Avenir, Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 24px; - font-weight: 400; +@tailwind base; +@tailwind components; +@tailwind utilities; - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; +form label { + @apply dark:text-slate-400; } -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; +form input, +select, +textarea { + @apply dark:border dark:border-slate-900 dark:bg-slate-500 dark:text-slate-100; } -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; +#session-table { + display: grid; + grid-template-columns: 3fr 1fr repeat(2, 2fr) 0.5fr 1fr; } -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} +#button-container button { + @apply mx-1; +} \ No newline at end of file diff --git a/frontend/tailwind.config.cjs b/frontend/tailwind.config.cjs new file mode 100644 index 0000000..e8ecc87 --- /dev/null +++ b/frontend/tailwind.config.cjs @@ -0,0 +1,12 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + darkMode: "class", + content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"], + theme: { + fontFamily: { + sans: ["Inter", "sans-serif"], + }, + extend: {}, + }, + plugins: [require("@tailwindcss/typography"), require("@tailwindcss/forms")], +}; diff --git a/frontend/vite.config.js b/frontend/vite.config.js index d54c977..3c471a7 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -6,7 +6,7 @@ export default defineConfig({ plugins: [react()], server: { proxy: { - "/": "http://localhost:8001", + "/api": "http://127.0.0.1:8001", }, }, }); diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index 8047bc1..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,19 +0,0 @@ -const defaultTheme = require('tailwindcss/defaultTheme') - -module.exports = { - darkMode: 'class', - content: ["./games/**/*.{html,js}"], - theme: { - extend: { - fontFamily: { - 'sans': ['IBM Plex Sans', ...defaultTheme.fontFamily.sans], - 'mono': ['IBM Plex Mono', ...defaultTheme.fontFamily.mono], - 'serif': ['IBM Plex Serif', ...defaultTheme.fontFamily.serif], - } - }, - }, - plugins: [ - require('@tailwindcss/typography'), - require('@tailwindcss/forms') - ], -}