correctly style most things

This commit is contained in:
Samuel Lorch 2023-03-15 00:40:12 +01:00
parent 607dea9725
commit eba5d94f71
3 changed files with 42 additions and 31 deletions

View file

@ -97,14 +97,14 @@ onMounted(async() => {
'nav-state-collapsed': navState === NavState.Collapsed, 'nav-state-collapsed': navState === NavState.Collapsed,
'nav-state-reduced': navState === NavState.Reduced, 'nav-state-reduced': navState === NavState.Reduced,
}"> }">
<button class="nav-head" @click="toggleNavState"> <button class="nav-head cl-secondary" @click="toggleNavState">
<i-mdi-hamburger-menu/> <i-mdi-hamburger-menu/>
<h1>nfSense</h1> <h1>nfSense</h1>
</button> </button>
<Portal from="page-header" class="page-header pad gap"/> <Portal from="page-header" class="page-header pad gap"/>
<div class="nav-body"> <div class="nav-body cl-secondary">
<template v-for="(options, route) in navRoutes" :key="route"> <template v-for="(options, route) in navRoutes" :key="route">
<router-link :to="route" class="button" @click="collapseNavIfMobile"> <router-link :to="route" class="button" @click="collapseNavIfMobile">
<component :is="options.icon"/> <component :is="options.icon"/>
@ -118,6 +118,7 @@ onMounted(async() => {
<button @click="tryLogout"><i-material-symbols-logout/></button> <button @click="tryLogout"><i-material-symbols-logout/></button>
</div> </div>
</div> </div>
<router-view v-slot="{ Component, route }" v-if="authState === AuthState.Authenticated"> <router-view v-slot="{ Component, route }" v-if="authState === AuthState.Authenticated">
<Transition name="fade"> <Transition name="fade">
<component :is="Component" :key="{route}" class="page-content pad gap"/> <component :is="Component" :key="{route}" class="page-content pad gap"/>
@ -128,7 +129,7 @@ onMounted(async() => {
<Transition name="fade"> <Transition name="fade">
<div class="login" v-if="authState === AuthState.Unauthenticated"> <div class="login" v-if="authState === AuthState.Unauthenticated">
<FocusTrap> <FocusTrap>
<form @submit="$event => $event.preventDefault()" :disabled="loginDisabled" class="cl-side"> <form @submit="$event => $event.preventDefault()" :disabled="loginDisabled" class="cl-secondary">
<h1>nfSense Login</h1> <h1>nfSense Login</h1>
<h2 :hidden="!loginDisabled">Logging in...</h2> <h2 :hidden="!loginDisabled">Logging in...</h2>
<label for="username" v-text="'Username'" :hidden="loginDisabled" /> <label for="username" v-text="'Username'" :hidden="loginDisabled" />
@ -149,7 +150,6 @@ onMounted(async() => {
left: 0px; right: 0px; top: 0px; bottom: 0px; left: 0px; right: 0px; top: 0px; bottom: 0px;
display: grid; display: grid;
background-color: var(--cl-bg);
} }
.layout { .layout {
grid-template-rows: auto 1fr; grid-template-rows: auto 1fr;
@ -165,9 +165,6 @@ onMounted(async() => {
.page-header { grid-area: PH; } .page-header { grid-area: PH; }
.page-content { grid-area: PC; } .page-content { grid-area: PC; }
/* Navigation */
.nav-head, .nav-body { background: var(--cl-secondary-container); }
.nav-head { font-weight: bold; } .nav-head { font-weight: bold; }
.nav-head > svg { display: none; } .nav-head > svg { display: none; }
.nav-head > h1 { flex-grow: 1; } .nav-head > h1 { flex-grow: 1; }
@ -181,7 +178,6 @@ onMounted(async() => {
align-items: center; align-items: center;
} }
.page-header button svg { margin: -0.25rem; } .page-header button svg { margin: -0.25rem; }
.page-content { background: var(--cl-background); }
/* Nav-Body-Collapsing */ /* Nav-Body-Collapsing */
.nav-body, .page-header, .page-content { .nav-body, .page-header, .page-content {

View file

@ -88,8 +88,8 @@
/* --- Color Contexts --- */ /* --- Color Contexts --- */
/* These Contexts are meant to make it easy to shift all color assignments for differentiated areas, like navigation bars or context menus */ /* These Contexts are meant to make it easy to shift all color assignments for differentiated areas, like navigation bars or context menus */
/* Main Color Context */ /* Primary Color Context */
:root, .cl-main { :root, .cl-primary {
/* Color assignments, these finally have semantic value and will be used to style components. */ /* Color assignments, these finally have semantic value and will be used to style components. */
/* More can be added as needed. */ /* More can be added as needed. */
--cl-fg: var(--cl-0-8); --cl-fg: var(--cl-0-8);
@ -100,14 +100,22 @@
/* Highlight Background (Component on Hover, select, ...) */ /* Highlight Background (Component on Hover, select, ...) */
--cl-bg-el: var(--cl-1-3); --cl-bg-el: var(--cl-1-3);
/* Element Background (Component) */ /* Element Background (Component) */
/* Set Default Colors */
background-color: var(--cl-bg);
color: var(--cl-fg);
} }
/* Secondary Color Context, in this case for the sidebar */ /* Secondary Color Context, in this case for the sidebar */
.cl-side { .cl-secondary {
/* You can replace the base-tint on a per-assignment basis, though one tint per context is usual */ /* You can replace the base-tint on a per-assignment basis, though one tint per context is usual */
--cl-fg: var(--cl-1-8); --cl-fg: var(--cl-1-8);
--cl-bg: var(--cl-1-2); --cl-bg: var(--cl-1-2);
/* Just shift up all non-fg colors to create a lower-contrast/importance context */ /* Just shift up all non-fg colors to create a lower-contrast/importance context */
--cl-bg-hl: var(--cl-1-3); --cl-bg-hl: var(--cl-1-3);
--cl-bg-el: var(--cl-1-4); --cl-bg-el: var(--cl-1-4);
}
/* Set Default Colors */
background-color: var(--cl-bg);
color: var(--cl-fg);
}

View file

@ -14,16 +14,11 @@ button, .button {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
white-space: nowrap; white-space: nowrap;
color: var(--cl-fg);
background-color: var(--cl-bg-el);
} }
.button > svg, button > svg { .button > svg, button > svg {
min-width: 1.5rem; min-width: 1.5rem;
min-height: 1.5rem; min-height: 1.5rem;
} }
.button:hover, button:hover {
background-color: var(--cl-bg-hl);
}
form { form {
display: grid; display: grid;
@ -31,25 +26,16 @@ form {
padding: 0.5rem; padding: 0.5rem;
gap: 0.5rem; gap: 0.5rem;
background-color: var(--cl-bg);
} }
form > :is(button, .button, h1) { form > :is(button, .button, h1) {
grid-column: 1 / 3; grid-column: 1 / 3;
} }
form button, form .button, form input {
color: var(--cl-fg);
background-color: var(--cl-bg-el);
}
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
} }
thead {
background-color: var(--cl-bg-el);
}
th:hover { th:hover {
background-color: var(--cl-bg-hl);
cursor: pointer; cursor: pointer;
} }
th, td { th, td {
@ -63,14 +49,35 @@ th > *{
th svg { th svg {
height: 1rem; height: 1rem;
} }
tbody tr:nth-child(even) {
background-color: var(--cl-bg-el)
}
.search-bar { .search-bar {
display: block; display: block;
padding: 0.4rem; padding: 0.4rem;
background-color: var(--cl-bg-el);
color: var(--cl-fg);
border: 1px solid var(--cl-fg); border: 1px solid var(--cl-fg);
} }
/* Coloring */
button, .button {
background-color: var(--cl-bg-el);
}
.button:hover, button:hover {
background-color: var(--cl-bg-hl);
}
input {
background-color: var(--cl-bg-el);
border: 1px solid var(--cl-fg);
}
th {
background-color: var(--cl-bg-el);
}
tbody tr:hover, th:hover {
background-color: var(--cl-bg-hl);
}
/* Button Background Exception for Nav Menu */
.nav-body > button, .button {
background-color: var(--cl-bg);
}