From 93552152be180766fda08b1bd7ccefc4d26065ff Mon Sep 17 00:00:00 2001 From: Lieuwe Rooijakkers Date: Sun, 19 Jan 2025 22:21:32 +0100 Subject: client advancements --- .../src/routes/app/components/content/content.css | 20 ++++++++++++++ .../src/routes/app/components/content/content.jsx | 32 ++++++++++++++++++++++ .../src/routes/app/components/sidebar/sidebar.css | 24 ++++++++++++++++ .../src/routes/app/components/sidebar/sidebar.jsx | 19 +++++++++++++ 4 files changed, 95 insertions(+) create mode 100644 client/src/routes/app/components/content/content.css create mode 100644 client/src/routes/app/components/content/content.jsx create mode 100644 client/src/routes/app/components/sidebar/sidebar.css create mode 100644 client/src/routes/app/components/sidebar/sidebar.jsx (limited to 'client/src/routes/app/components') diff --git a/client/src/routes/app/components/content/content.css b/client/src/routes/app/components/content/content.css new file mode 100644 index 0000000..196fb96 --- /dev/null +++ b/client/src/routes/app/components/content/content.css @@ -0,0 +1,20 @@ +.content { + display: flex; + flex-direction: column; + + flex-grow: 1; + padding: 10px; + + overflow-y: scroll; + + .title { + border: 0; + padding: 10px; + margin-left: 15px; + margin-bottom: 50px; + } + .title:focus { + border: 0; + outline: 0; + } +} diff --git a/client/src/routes/app/components/content/content.jsx b/client/src/routes/app/components/content/content.jsx new file mode 100644 index 0000000..42ecb8a --- /dev/null +++ b/client/src/routes/app/components/content/content.jsx @@ -0,0 +1,32 @@ +import {useLayoutEffect, useRef, useState} from 'react'; + +import './content.css'; + +import Entry from '../../../../components/entry'; + +export default function Content({ title, setTitle, items, setItems }) { + const [focused, setFocused] = useState(null); + + const children = items.map((item, i) => { + return setFocused(i + delta)} + onRemove={refocus => setItems(a => { + if (refocus) { + setFocused(i-1); + } + return [...a.slice(0, i), ...a.slice(i + 1)] + })} + onEnter={type => setItems(a => { + setFocused(i+1); + return a.toSpliced(i+1, 0, { type, text: '' }); + })} + />; + }); + + return
+

{title}

+ {children} +
; +} diff --git a/client/src/routes/app/components/sidebar/sidebar.css b/client/src/routes/app/components/sidebar/sidebar.css new file mode 100644 index 0000000..515117a --- /dev/null +++ b/client/src/routes/app/components/sidebar/sidebar.css @@ -0,0 +1,24 @@ +.sidebar { + width: 200px; + background-color: #f2f2f2; + + flex-shrink: 0; + + h1 { + margin-left: 10px; + margin-top: 10px; + } + + .file { + display: block; + + color: black; + text-decoration: none; + + padding: 5px; + } + + .file:hover { + background-color: #e4e4e4; + } +} diff --git a/client/src/routes/app/components/sidebar/sidebar.jsx b/client/src/routes/app/components/sidebar/sidebar.jsx new file mode 100644 index 0000000..1ce7d2b --- /dev/null +++ b/client/src/routes/app/components/sidebar/sidebar.jsx @@ -0,0 +1,19 @@ +import { useNavigate } from "react-router"; +import { RichTreeView } from '@mui/x-tree-view/RichTreeView'; + +import './sidebar.css'; + + +export default function Sidebar({ files }) { + const navigate = useNavigate(); + + const onSelect = (_, i) => { + navigate(`/file/${i}`); + }; + + return
+

🧀🥜

+
+ p.title} /> +
; +} -- cgit v1.2.3-70-g09d2