web/settings: mobile layout, better padding & borders

This commit is contained in:
wukko 2024-06-25 14:50:59 +06:00
parent 6fdc63a6c2
commit 55515f0fb1
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
6 changed files with 141 additions and 17 deletions

View file

@ -16,6 +16,6 @@
.settings-content { .settings-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; gap: 10px;
} }
</style> </style>

View file

@ -25,4 +25,11 @@
color: var(--gray); color: var(--gray);
padding-left: 8px; padding-left: 8px;
} }
@media screen and (max-width: 750px) {
#settings-section-categories {
background: var(--button);
border-radius: var(--border-radius);
}
}
</style> </style>

View file

@ -1,6 +1,8 @@
<script lang="ts"> <script lang="ts">
import { page } from "$app/stores"; import { page } from "$app/stores";
import IconChevronRight from "@tabler/icons-svelte/IconChevronRight.svelte";
export let tabName: string; export let tabName: string;
export let tabLink: string; export let tabLink: string;
export let iconColor: "gray" | "blue" | "green" = "gray"; export let iconColor: "gray" | "blue" | "green" = "gray";
@ -13,10 +15,14 @@
href="/settings/{tabLink}" href="/settings/{tabLink}"
class:active={isActive} class:active={isActive}
> >
<div class="settings-tab-left">
<div class="tab-icon" style="background: var(--{iconColor})"> <div class="tab-icon" style="background: var(--{iconColor})">
<slot></slot> <slot></slot>
</div> </div>
<span>{tabName}</span> <span>{tabName}</span>
</div>
<IconChevronRight class="settings-tab-chevron" />
</a> </a>
<style> <style>
@ -25,6 +31,7 @@
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between;
gap: calc(var(--small-padding) * 2); gap: calc(var(--small-padding) * 2);
padding: 7px; padding: 7px;
font-weight: 500; font-weight: 500;
@ -33,16 +40,38 @@
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
.settings-tab-left {
display: flex;
flex-direction: row;
align-items: center;
gap: calc(var(--small-padding) * 2);
font-weight: 500;
}
.settings-tab :global(svg) { .settings-tab :global(svg) {
stroke: var(--white);
stroke-width: 1.5px; stroke-width: 1.5px;
height: 18px; height: 18px;
width: 18px; width: 18px;
} }
.settings-tab .tab-icon :global(svg) {
stroke: var(--white);
}
:global(.settings-tab-chevron) {
display: none;
stroke: var(--secondary);
}
@media (hover: hover) {
.settings-tab:hover { .settings-tab:hover {
background: var(--button-hover-transparent); background: var(--button-hover-transparent);
} }
}
.settings-tab:active {
background: var(--button-hover-transparent);
}
.settings-tab.active { .settings-tab.active {
background: var(--secondary); background: var(--secondary);
@ -60,4 +89,20 @@
padding: var(--small-padding); padding: var(--small-padding);
border-radius: var(--small-padding); border-radius: var(--small-padding);
} }
@media screen and (max-width: 750px) {
.settings-tab {
background: none;
--small-padding: 5px;
}
.settings-tab :global(svg) {
height: 19px;
width: 19px;
}
:global(.settings-tab-chevron) {
display: block;
}
}
</style> </style>

View file

@ -24,7 +24,7 @@
--button: #f4f4f4; --button: #f4f4f4;
--button-hover: #e8e8e8; --button-hover: #e8e8e8;
--button-hover-transparent: rgba(0, 0, 0, 0.06); --button-hover-transparent: rgba(0, 0, 0, 0.06);
--button-stroke: rgba(0, 0, 0, 0.08); --button-stroke: rgba(0, 0, 0, 0.05);
--button-text: #282828; --button-text: #282828;
--sidebar-bg: #000000; --sidebar-bg: #000000;
@ -64,7 +64,7 @@
--button: #191919; --button: #191919;
--button-hover: #2a2a2a; --button-hover: #2a2a2a;
--button-hover-transparent: rgba(225, 225, 225, 0.1); --button-hover-transparent: rgba(225, 225, 225, 0.1);
--button-stroke: rgba(255, 255, 255, 0.08); --button-stroke: rgba(255, 255, 255, 0.05);
--button-text: #e1e1e1; --button-text: #e1e1e1;
--sidebar-bg: #101010; --sidebar-bg: #101010;
@ -216,7 +216,6 @@
#content { #content {
display: flex; display: flex;
overflow: scroll; overflow: scroll;
padding: var(--padding);
background-color: var(--primary); background-color: var(--primary);
border-top-left-radius: var(--border-radius); border-top-left-radius: var(--border-radius);

View file

@ -14,6 +14,10 @@
</div> </div>
<style> <style>
#cobalt-save-container {
padding: var(--padding);
}
#cobalt-save { #cobalt-save {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View file

@ -10,6 +10,8 @@
import IconMusic from "@tabler/icons-svelte/IconMusic.svelte"; import IconMusic from "@tabler/icons-svelte/IconMusic.svelte";
import IconFileSettings from "@tabler/icons-svelte/IconFileSettings.svelte"; import IconFileSettings from "@tabler/icons-svelte/IconFileSettings.svelte";
import IconChevronLeft from "@tabler/icons-svelte/IconChevronLeft.svelte";
let screenWidth: number; let screenWidth: number;
$: isMobile = screenWidth <= 750; $: isMobile = screenWidth <= 750;
@ -19,9 +21,18 @@
<svelte:window bind:innerWidth={screenWidth} /> <svelte:window bind:innerWidth={screenWidth} />
<div id="settings-page"> <div id="settings-page">
<div id="settings-sidebar" class:visible-mobile={isMobile && isHome}> <div id="settings-sidebar">
<div id="settings-header" class:back-visible={!isHome && isMobile}>
{#if !isHome && isMobile}
<a class="back-button" href="/settings">
<IconChevronLeft />
<h2 id="settings-page-title">settings</h2> <h2 id="settings-page-title">settings</h2>
<nav id="settings-navigation"> </a>
{:else}
<h2 id="settings-page-title">settings</h2>
{/if}
</div>
<nav id="settings-navigation" class:visible-mobile={isMobile && isHome}>
<SettingsSection sectionTitle="general"> <SettingsSection sectionTitle="general">
<SettingsTab <SettingsTab
tabName="appearance" tabName="appearance"
@ -66,12 +77,13 @@
#settings-page { #settings-page {
--settings-nav-width: 250px; --settings-nav-width: 250px;
--settings-padding: 30px; --settings-padding: 30px;
--settings-padding-small: calc(var(--settings-padding) - var(--padding));
display: grid; display: grid;
width: 100%; width: 100%;
grid-template-columns: var(--settings-nav-width) 1fr; grid-template-columns: var(--settings-nav-width) 1fr;
overflow: hidden; overflow: hidden;
padding-left: calc(var(--settings-padding) - var(--padding)); padding-left: var(--settings-padding);
padding-top: calc(var(--settings-padding) - var(--padding)); padding-top: var(--settings-padding);
} }
#settings-page-content { #settings-page-content {
@ -101,6 +113,30 @@
gap: 12px; gap: 12px;
} }
#settings-header {
--back-padding: 6px;
}
.back-button {
display: flex;
align-items: center;
color: var(--secondary);
gap: var(--back-padding);
padding: var(--back-padding);
padding-right: calc(var(--back-padding) * 2);
}
.back-button:active {
background: var(--button-hover-transparent);
border-radius: var(--border-radius);
}
.back-button :global(svg) {
stroke-width: 2px;
height: 21px;
width: 21px;
}
.hidden-mobile { .hidden-mobile {
display: none !important; display: none !important;
} }
@ -108,16 +144,49 @@
@media screen and (max-width: 750px) { @media screen and (max-width: 750px) {
#settings-page { #settings-page {
--settings-nav-width: 100%; --settings-nav-width: 100%;
display: flex;
flex-direction: column;
grid-template-columns: 1fr; grid-template-columns: 1fr;
padding: 0;
}
#settings-page-content,
#settings-navigation {
padding: var(--padding);
}
#settings-page-content {
max-width: unset;
gap: calc(var(--padding) * 2);
}
#settings-header {
display: flex;
align-items: center;
position: sticky;
padding: var(--padding);
gap: 4px;
}
#settings-header.back-visible {
padding: calc(var(--padding) - var(--back-padding));
} }
#settings-sidebar { #settings-sidebar {
gap: 0px;
}
#settings-page-title {
text-align: center;
font-size: 16px;
}
#settings-navigation {
display: none; display: none;
} }
#settings-sidebar.visible-mobile { #settings-navigation.visible-mobile {
display: flex; display: flex;
} }
} }
</style> </style>