web: move svg icon params to css & clean up

This commit is contained in:
wukko 2024-06-24 23:46:37 +06:00
parent b153c06294
commit 56081db857
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2
5 changed files with 55 additions and 40 deletions

View file

@ -41,7 +41,7 @@
class:focused={isFocused} class:focused={isFocused}
class:downloadable={validLink(link)} class:downloadable={validLink(link)}
> >
<IconLink id="input-link-icon" color="var(--gray)" size="18px" /> <IconLink id="input-link-icon" />
<input <input
id="link-area" id="link-area"
@ -115,6 +115,13 @@
outline: var(--secondary) 0.5px solid; outline: var(--secondary) 0.5px solid;
} }
:global(#input-link-icon) {
stroke: var(--gray);
width: 18px;
height: 18px;
stroke-width: 2px;
}
#input-container.focused :global(#input-link-icon) { #input-container.focused :global(#input-link-icon) {
stroke: var(--secondary); stroke: var(--secondary);
} }

View file

@ -1,26 +1,26 @@
<script lang="ts"> <script lang="ts">
import { page } from "$app/stores"; import { page } from "$app/stores";
export let categoryName: string; export let tabName: string;
export let categoryLink: string; export let tabLink: string;
export let iconColor: "gray" | "blue" | "green" = "gray"; export let iconColor: "gray" | "blue" | "green" = "gray";
$: isActive = $page.url.pathname === `/settings/${categoryLink}`; $: isActive = $page.url.pathname === `/settings/${tabLink}`;
</script> </script>
<a <a
class="settings-category" class="settings-tab"
href="/settings/{categoryLink}" href="/settings/{tabLink}"
class:active={isActive} class:active={isActive}
> >
<div class="category-icon" style="background: var(--{iconColor})"> <div class="tab-icon" style="background: var(--{iconColor})">
<slot></slot> <slot></slot>
</div> </div>
<span>{categoryName}</span> <span>{tabName}</span>
</a> </a>
<style> <style>
.settings-category { .settings-tab {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
@ -32,20 +32,27 @@
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
.settings-category:hover { .settings-tab :global(svg) {
stroke: var(--white);
stroke-width: 1.5px;
height: 18px;
width: 18px;
}
.settings-tab:hover {
background: var(--button-hover-transparent); background: var(--button-hover-transparent);
} }
.settings-category.active { .settings-tab.active {
background: var(--secondary); background: var(--secondary);
color: var(--primary); color: var(--primary);
} }
.settings-category span { .settings-tab span {
font-size: 14.5px; font-size: 14.5px;
} }
.category-icon { .tab-icon {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;

View file

@ -12,8 +12,7 @@
import IconHeart from "@tabler/icons-svelte/IconHeart.svelte"; import IconHeart from "@tabler/icons-svelte/IconHeart.svelte";
import IconInfoCircle from "@tabler/icons-svelte/IconInfoCircle.svelte"; import IconInfoCircle from "@tabler/icons-svelte/IconInfoCircle.svelte";
const iconSize = 21; const settingsLink = "/settings/general/appearance";
const iconStroke = 1.2;
</script> </script>
<nav id="sidebar"> <nav id="sidebar">
@ -21,30 +20,30 @@
<div id="sidebar-tabs"> <div id="sidebar-tabs">
<div id="sidebar-actions" class="sidebar-inner-container"> <div id="sidebar-actions" class="sidebar-inner-container">
<SidebarTab tabName="save" tabLink="/"> <SidebarTab tabName="save" tabLink="/">
<IconDownload size={iconSize} stroke={iconStroke} /> <IconDownload />
</SidebarTab> </SidebarTab>
<SidebarTab tabName="trim" tabLink="/trim"> <SidebarTab tabName="trim" tabLink="/trim">
<IconCut size={iconSize} stroke={iconStroke} /> <IconCut />
</SidebarTab> </SidebarTab>
<SidebarTab tabName="crop" tabLink="/crop"> <SidebarTab tabName="crop" tabLink="/crop">
<IconCrop size={iconSize} stroke={iconStroke} /> <IconCrop />
</SidebarTab> </SidebarTab>
<SidebarTab tabName="convert" tabLink="/convert"> <SidebarTab tabName="convert" tabLink="/convert">
<IconTransform size={iconSize} stroke={iconStroke} /> <IconTransform />
</SidebarTab> </SidebarTab>
<SidebarTab tabName="settings" tabLink="/settings"> <SidebarTab tabName="settings" tabLink={settingsLink}>
<IconSettings size={iconSize} stroke={iconStroke} /> <IconSettings />
</SidebarTab> </SidebarTab>
</div> </div>
<div id="sidebar-info" class="sidebar-inner-container"> <div id="sidebar-info" class="sidebar-inner-container">
<SidebarTab tabName="updates" tabLink="/updates"> <SidebarTab tabName="updates" tabLink="/updates">
<IconComet size={iconSize} stroke={iconStroke} /> <IconComet />
</SidebarTab> </SidebarTab>
<SidebarTab tabName="donate" tabLink="/donate"> <SidebarTab tabName="donate" tabLink="/donate">
<IconHeart size={iconSize} stroke={iconStroke} /> <IconHeart />
</SidebarTab> </SidebarTab>
<SidebarTab tabName="about" tabLink="/about"> <SidebarTab tabName="about" tabLink="/about">
<IconInfoCircle size={iconSize} stroke={iconStroke} /> <IconInfoCircle />
</SidebarTab> </SidebarTab>
</div> </div>
</div> </div>

View file

@ -59,6 +59,12 @@
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
.sidebar-tab :global(svg) {
stroke-width: 1.2px;
height: 21px;
width: 21px;
}
.sidebar-tab.active { .sidebar-tab.active {
color: var(--sidebar-bg); color: var(--sidebar-bg);
background: var(--sidebar-highlight); background: var(--sidebar-highlight);

View file

@ -7,10 +7,6 @@
import IconMovie from "@tabler/icons-svelte/IconMovie.svelte"; import IconMovie from "@tabler/icons-svelte/IconMovie.svelte";
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";
const iconSize = 18;
const iconStroke = 1.5;
const iconColor = "var(--white)";
</script> </script>
<div id="settings-page"> <div id="settings-page">
@ -19,34 +15,34 @@
<nav id="settings-navigation"> <nav id="settings-navigation">
<SettingsSection sectionTitle="general"> <SettingsSection sectionTitle="general">
<SettingsTab <SettingsTab
categoryName="appearance" tabName="appearance"
categoryLink="general/appearance" tabLink="general/appearance"
iconColor="blue" iconColor="blue"
> >
<IconSunHigh size={iconSize} stroke={iconStroke} color={iconColor} /> <IconSunHigh />
</SettingsTab> </SettingsTab>
</SettingsSection> </SettingsSection>
<SettingsSection sectionTitle="save"> <SettingsSection sectionTitle="save">
<SettingsTab <SettingsTab
categoryName="video" tabName="video"
categoryLink="save/video" tabLink="save/video"
iconColor="green" iconColor="green"
> >
<IconMovie size={iconSize} stroke={iconStroke} color={iconColor} /> <IconMovie />
</SettingsTab> </SettingsTab>
<SettingsTab <SettingsTab
categoryName="audio" tabName="audio"
categoryLink="save/audio" tabLink="save/audio"
iconColor="green" iconColor="green"
> >
<IconMusic size={iconSize} stroke={iconStroke} color={iconColor}/> <IconMusic />
</SettingsTab> </SettingsTab>
<SettingsTab <SettingsTab
categoryName="metadata" tabName="metadata"
categoryLink="save/metadata" tabLink="save/metadata"
iconColor="green" iconColor="green"
> >
<IconFileSettings size={iconSize} stroke={iconStroke} color={iconColor}/> <IconFileSettings />
</SettingsTab> </SettingsTab>
</SettingsSection> </SettingsSection>
</nav> </nav>