From cea48a1545250429b78235b2ad00b8243923e2b2 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 29 Apr 2024 14:59:59 +0100 Subject: feat(ui/dotfiles): add vars (#1989) --- ui/src/pages/Dotfiles.tsx | 90 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 87 insertions(+), 3 deletions(-) (limited to 'ui/src/pages') diff --git a/ui/src/pages/Dotfiles.tsx b/ui/src/pages/Dotfiles.tsx index 6b0870b3..29b6b54a 100644 --- a/ui/src/pages/Dotfiles.tsx +++ b/ui/src/pages/Dotfiles.tsx @@ -1,6 +1,35 @@ +import { useState } from "react"; import Aliases from "@/components/dotfiles/Aliases"; +import Vars from "@/components/dotfiles/Vars"; -function Header() { +enum Section { + Aliases, + Vars, + Scripts, +} + +function renderDotfiles(current: Section) { + switch (current) { + case Section.Aliases: + return ; + case Section.Vars: + return ; + case Section.Scripts: + return
; + } +} + +interface HeaderProps { + current: Section; + setCurrent: (section: Section) => void; +} + +interface TabsProps { + current: Section; + setCurrent: (section: Section) => void; +} + +function Header({ current, setCurrent }: HeaderProps) { return (
@@ -8,17 +37,72 @@ function Header() { Dotfiles
+ + +
+ ); +} + +function classNames(...classes) { + return classes.filter(Boolean).join(" "); +} + +function Tabs({ current, setCurrent }: TabsProps) { + let tabs = [ + { + name: "Aliases", + isCurrent: () => current === Section.Aliases, + section: Section.Aliases, + }, + { + name: "Vars", + isCurrent: () => current === Section.Vars, + section: Section.Vars, + }, + { + name: "Scripts", + isCurrent: () => current === Section.Scripts, + section: Section.Scripts, + }, + ]; + + return ( +
+
+ +
); } export default function Dotfiles() { + let [current, setCurrent] = useState(Section.Aliases); + console.log(current); + return (
-
+
Manage your shell aliases, variables and paths - + {renderDotfiles(current)}
); -- cgit v1.3.1