design: fix classvalue (#560)

This commit is contained in:
Xylight authored and GitHub committed 2025-06-09 20:57:55 -07:00
1 parent 76c581123a
commit 3d509a6e28
14 files changed
+106 -81

No files matched your search

+1 -1
View File
@@ -101,7 +101,7 @@
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<div
class={[
'post relative max-w-full min-w-0 w-full cursor-pointer outline-hidden group',
'post relative max-w-full min-w-0 w-full cursor-pointer outline-hidden group z-10 rounded-3xl',
settings.leftAlign && 'left-align',
view == 'compact' && 'py-3 list-type compact',
view == 'cozy' && 'py-5 flex flex-col gap-2',
+26 -25
View File
@@ -70,6 +70,7 @@
} from 'svelte-hero-icons'
import CommunityHeader from '../community/CommunityHeader.svelte'
import ShieldIcon from '../moderation/ShieldIcon.svelte'
import Material from 'mono-svelte/materials/Material.svelte'
interface Props {
community?: Community | undefined
@@ -132,9 +133,11 @@
This component will build two different things: a post's meta block and the title.
-->
<header
class="grid w-full meta {community
? 'grid-rows-2'
: 'grid-rows-1'} text-xs min-w-0 max-w-full"
class={[
'grid w-full meta',
community ? 'grid-rows-2' : 'grid-rows-1',
'text-xs min-w-0 max-w-full text-slate-600 dark:text-zinc-400',
]}
class:compact={view == 'compact'}
{style}
>
@@ -142,24 +145,30 @@
<Popover autoClose={false} popoverClass="backdrop-blur-xl rounded-2xl">
{#snippet target()}
<button
class="row-span-2 shrink-0 mr-2 self-center group/btn bg-slate-200 dark:bg-zinc-800 rounded-full"
class={[
'row-span-2 shrink-0 mr-1.5 self-center group/btn',
'bg-slate-200 dark:bg-zinc-800 rounded-xl cursor-pointer',
]}
>
<Avatar
url={community?.icon}
width={view == 'compact' ? 24 : 32}
alt={community?.name}
circle={false}
class="group-hover/btn:scale-90 group-active/btn:scale-[.85] transition-transform"
/>
</button>
{/snippet}
{#snippet popover()}
{#if community && subscribed}
<div
class="bg-white/80 dark:bg-zinc-900/90 border border-slate-200 dark:border-zinc-800 rounded-2xl shadow-xl p-4
max-w-2xl w-full max-h-128 overflow-auto"
<Material
color="uniform"
rounding="2xl"
elevation="high"
class="max-w-2xl w-full max-h-128 overflow-auto"
>
<CommunityHeader {community} {subscribed} />
</div>
</Material>
{/if}
{/snippet}
</Popover>
@@ -175,7 +184,7 @@
/>
{/if}
<div
class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 items-center
class="flex flex-row gap-1.5 items-center
no-list-margin {view == 'compact' && showCommunity
? 'min-[480px]:mx-2'
: ''}"
@@ -314,15 +323,14 @@
{#if title && id}
<a
href="/post/{encodeURIComponent(instance.data)}/{id}"
class="inline hover:underline
hover:text-primary-900 dark:hover:text-primary-100 transition-colors max-[480px]:mt-0!
{settings.font == 'satoshi/nunito'
? 'font-display font-semibold'
: 'font-medium'} {titleClass}"
class:text-slate-600={settings.markReadPosts && read}
class:dark:text-zinc-400={settings.markReadPosts && read}
class:text-base={view == 'compact'}
class:text-lg={view != 'compact'}
class={[
'inline max-[480px]:mt-0!',
'hover:underline hover:text-primary-900 dark:hover:text-primary-100 transition-colors',
'font-medium',
titleClass,
settings.markReadPosts && read && 'text-slate-600 dark:text-zinc-400',
view == 'compact' ? 'text-base' : 'text-lg',
]}
style="grid-area: title;"
data-sveltekit-preload-data="tap"
>
@@ -346,8 +354,6 @@
'avatar community badges'
'avatar stats badges';
gap: 0;
grid-template-rows: auto auto;
grid-template-columns: max-content minmax(0, auto) auto;
}
@media screen and (max-width: 480px) {
@@ -359,11 +365,6 @@
gap: 0;
grid-template-rows: auto auto auto;
grid-template-columns: 40px minmax(0, auto);
}
}
@media screen and (max-width: 480px) {
.meta.compact {
grid-template-columns: 32px minmax(0, auto);
}
}
@@ -169,7 +169,7 @@
{:else}
<VirtualList
id="feed"
class="divide-y divide-slate-200 dark:divide-zinc-800"
class="divide-y -mx-4 sm:-mx-6 divide-slate-200 dark:divide-zinc-900"
items={posts}
initialOffset={listEl?.offsetTop}
overscan={500}
@@ -182,7 +182,7 @@
style={row < 7 ? `--anim-delay: ${row * 100}ms` : ''}
class="relative post-container {row < 7
? 'pop-in opacity-0'
: ''} -mx-4 sm:-mx-6 px-4 sm:px-6"
: ''} px-4 sm:px-6"
>
<Post
bind:post={posts[row]}
@@ -27,7 +27,7 @@
@component
For embed-type posts. Displays embed card or a compact link.
-->
{#if embed_title && view != 'compact'}
{#if embed_title && view == 'cozy'}
<a target="_blank" href={url} class="group/link">
<Material
color="distinct"
@@ -1,6 +1,4 @@
<script lang="ts">
import { settings } from '$lib/settings.svelte'
interface Props {
pageHeader?: boolean
style?: string
@@ -28,8 +26,7 @@
{style}
>
<h1
class="text-3xl font-medium flex gap-2 w-full
{settings.font == 'satoshi/nunito' ? 'font-display' : ''} {clazz ?? ''}"
class="text-4xl flex gap-2 w-full tracking-tight font-medium {clazz ?? ''}"
>
{@render children?.()}
</h1>
@@ -41,6 +41,7 @@
class="font-normal block origin-left! border border-transparent dark:hover:bg-zinc-900 {!selected
? 'text-slate-600 dark:text-zinc-400'
: 'bg-slate-100 dark:bg-zinc-925'} {clazz}"
shadow="none"
>
{#snippet prefix()}
{#if customIcon}
+7 -6
View File
@@ -149,7 +149,7 @@
rounding = size == 'lg' ? 'xl' : 'lg',
roundingSide = 'all',
alignment = 'center',
shadow = 'none',
shadow = 'sm',
column = false,
disabled,
loaderWidth = undefined,
@@ -185,11 +185,12 @@
type={submit ? 'submit' : 'button'}
>
<div
class="flex {column
? 'flex-col justify-center'
: 'flex-row items-center'} h-full gap-1.5 button-content {buttonAlignment[
alignment
]}"
class={[
'flex',
column ? 'flex-col justify-center' : 'flex-row items-center',
'h-full gap-1.5 button-content',
buttonAlignment[alignment],
]}
>
{#if loading}
<Spinner width={loaderWidth ?? 16} />
+21 -17
View File
@@ -101,11 +101,14 @@
{...rest}
{id}
bind:this={element}
class="{buttonSize[size]} {buttonShadow[
shadow
]} {buttonColor.secondary} appearance-none transition-colors rounded-lg text-sm
w-full min-w-full cursor-pointer pr-6 {buttonColor.secondary}
{clazz} {selectClass}"
class={[
buttonSize[size],
buttonShadow[shadow],
buttonColor.secondary,
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
selectClass,
clazz,
]}
bind:value
onmousedown={e => {
e.preventDefault()
@@ -138,11 +141,20 @@
}}
size="custom"
disabled={option.disabled}
class="min-h-0! py-[5px]! {option.value == value
? 'bg-slate-100! dark:bg-zinc-800!'
: ''}"
class={[
'min-h-0! py-[5px]!',
option.value == value &&
'bg-slate-100! dark:bg-zinc-800! text-primary-900 dark:text-primary-100 font-medium!',
]}
>
{#if option.icon}
{#if option.value == value}
<Icon
src={CheckCircle}
size="16"
micro
class="text-primary-900 dark:text-primary-100"
/>
{:else if option.icon}
<Icon
src={option.icon}
size="16"
@@ -151,14 +163,6 @@
/>
{/if}
{@html option.label}
{#if option.value == value}
<Icon
src={CheckCircle}
size="16"
micro
class="text-primary-900 dark:text-primary-100 ml-auto"
/>
{/if}
</MenuButton>
{/if}
{/each}
+13 -10
View File
@@ -6,13 +6,14 @@
type ButtonProps,
} from '../button/Button.svelte'
import { Icon, type IconSource } from 'svelte-hero-icons'
import type { ClassValue } from 'svelte/elements'
interface Props extends ButtonProps {
color?: ButtonColor
alignment?: ButtonAlignment
href?: string | undefined
disabled?: boolean
class?: string
class?: ClassValue
icon?: IconSource
prefix?: Snippet
children?: Snippet
@@ -37,21 +38,23 @@
{...rest}
{color}
rounding="none"
class="w-full px-2 rounded-lg min-h-8 font-normal {disabled
? 'opacity-70 pointer-events-none cursor-not-allowed'
: ''} {color == 'tertiary'
? 'dark:hover:bg-zinc-800/70'
: ''} duration-100 {clazz}"
class={[
'w-full px-2 rounded-lg min-h-8 font-normal duration-100',
disabled && 'opacity-70 pointer-events-none cursor-not-allowed',
color == 'tertiary' && 'dark:hover:bg-zinc-800/70',
clazz,
]}
{alignment}
{href}
{disabled}
shadow="none"
>
{#snippet prefix()}
<div
class="contents {color == 'tertiary'
? 'text-slate-600 dark:text-zinc-400'
: ''}
shrink-0"
class={[
'contents shrink-0',
color == 'tertiary' && 'text-slate-600 dark:text-zinc-400',
]}
>
{#if icon}
<Icon src={icon} micro size="16" />
+1 -1
View File
@@ -65,7 +65,7 @@ interface Settings {
debugInfo: boolean
expandImages: boolean
font: 'inter' | 'satoshi/nunito' | 'system' | 'browser'
font: 'inter' | 'system' | 'browser'
leftAlign: boolean
hidePhoton: boolean
+12 -11
View File
@@ -20,17 +20,18 @@ export function getDefaultColors(): ThemeColors {
950: '2 6 23',
},
zinc: {
50: '251 253 255',
100: '246 247 249',
300: '217 221 226',
400: '171 177 188',
500: '127 133 146',
600: '95 104 117',
700: '75 84 99',
800: '42 50 63',
900: '32 37 50',
925: '28 32 43',
950: '23 27 36',
'50': '252 252 252',
'100': '248 248 249',
'200': '235 235 238',
'300': '222 222 226',
'400': '175 175 183',
'500': '128 128 136',
'600': '98 98 106',
'700': '68 68 74',
'800': '47 47 52',
'900': '34 34 37',
'925': '28 28 30',
'950': '25 25 27',
},
primary: {
100: '241 245 249',
-1
View File
@@ -401,7 +401,6 @@
{/snippet}
<Select bind:value={settings.font}>
<Option value="inter">Inter</Option>
<Option value="satoshi/nunito">Satoshi + Nunito</Option>
<Option value="system">System UI</Option>
<Option value="browser">Browser</Option>
</Select>
+20 -2
View File
@@ -8,10 +8,9 @@
--font-*: initial;
--font-sans: sans-serif;
--font-system: system-ui;
--font-serif: serif;
--font-inter: Inter, system-ui, sans-serif;
--font-nunito: Nunito, system-ui, sans-serif;
--font-display: Satoshi, system-ui, sans-serif;
--font-display: Inter, system-ui, sans-serif;
--font-mono: monospace;
--animate-pop-in: pop-in 0.25s ease-out forwards;
@@ -59,6 +58,19 @@
}
}
.cc {
inset: -1px;
position: absolute;
border-radius: inherit;
z-index: -1;
background: linear-gradient(
125deg,
color-mix(in oklab, var(--color-zinc-50) 20%, transparent),
color-mix(in oklab, var(--color-zinc-50) 0%, transparent),
color-mix(in oklab, var(--color-zinc-50) 20%, transparent)
);
}
/*
The default border color has changed to `currentcolor` in Tailwind CSS v4,
so we've added these compatibility styles to make sure everything still
@@ -95,6 +107,12 @@
font-display: swap;
}
@font-face {
font-family: 'EBGaramond';
src: url('/font/EBGaramond-Regular.woff2') format('woff2');
font-display: swap;
}
body {
@apply bg-slate-50 text-slate-900 dark:bg-zinc-950 dark:text-zinc-100 accent-slate-950 dark:accent-zinc-50;
}