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