design: redesign Tabs and distinct material, improve button danger style
This commit is contained in:
12 files changed
+185
-84
No files matched your search
+2
-1
@@ -19,4 +19,5 @@ test-results
|
||||
*TS.md
|
||||
|
||||
# Used for automated screenshot workflow
|
||||
.github/__pycache__/
|
||||
.github/__pycache__/
|
||||
.zed
|
||||
@@ -146,10 +146,8 @@
|
||||
{/if}
|
||||
<div
|
||||
class={[
|
||||
'flex flex-col border border-slate-200 border-b-slate-300 dark:border-zinc-800',
|
||||
'focus-within:border-primary-900 dark:focus-within:border-primary-100 focus-within:ring-3 ring-slate-300 dark:ring-zinc-700',
|
||||
'bg-white dark:bg-zinc-950',
|
||||
'rounded-2xl overflow-hidden transition-colors shadow-xs',
|
||||
'focus-within:ring-3 ring-slate-300 dark:ring-zinc-700',
|
||||
'markdown-editor',
|
||||
label && 'mt-1',
|
||||
clazz,
|
||||
]}
|
||||
@@ -290,7 +288,7 @@
|
||||
{/if}
|
||||
<!--Actual text area-->
|
||||
<TextArea
|
||||
class="bg-inherit z-0 border-0 rounded-none ring-0! focus:ring-transparent! transition-none! resize-none"
|
||||
class="z-0 focus:ring-transparent! transition-none! resize-none"
|
||||
bind:value
|
||||
bind:element={textArea}
|
||||
onkeydown={(e) => {
|
||||
@@ -305,6 +303,7 @@
|
||||
}
|
||||
}
|
||||
}}
|
||||
unstyled
|
||||
oninput={adjustHeight}
|
||||
onpaste={(e) => {
|
||||
if (!e.clipboardData?.files) return
|
||||
@@ -320,9 +319,7 @@
|
||||
{/if}
|
||||
|
||||
{#if previewButton}
|
||||
<div
|
||||
class="p-2 flex flex-row items-center w-full bg-slate-50 border-t border-slate-200 dark:border-zinc-900 dark:bg-zinc-925 gap-1"
|
||||
>
|
||||
<div class="p-2 flex flex-row items-center w-full gap-1">
|
||||
{#if previewButton}
|
||||
<MultiSelect
|
||||
bind:selected={previewing}
|
||||
@@ -335,3 +332,44 @@
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@reference '../../../app.css';
|
||||
|
||||
.markdown-editor {
|
||||
--primary-box-shadow: 0px -1px 0px 0px --alpha(var(--color-slate-900) / 20%)
|
||||
inset;
|
||||
--ring-box-shadow: 0px 0px 0px 2px --alpha(var(--color-primary-900) / 30%);
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid var(--color-slate-200);
|
||||
box-shadow: var(--primary-box-shadow);
|
||||
border-radius: var(--radius-2xl);
|
||||
overflow: hidden;
|
||||
font-size: var(--text-sm);
|
||||
background-color: var(--color-white);
|
||||
transition: all 150ms var(--ease-cubic);
|
||||
|
||||
@variant dark {
|
||||
--primary-box-shadow: 0px 1.5px 0px 0px inset
|
||||
--alpha(var(--color-zinc-800) / 100%);
|
||||
--ring-box-shadow: 0px 0px 0px 2px --alpha(var(--color-primary-100) / 30%);
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
var(--color-zinc-925) 25%,
|
||||
var(--color-zinc-900)
|
||||
);
|
||||
border-color: --alpha(var(--color-black) / 20%);
|
||||
}
|
||||
|
||||
&:focus-within {
|
||||
box-shadow: var(--primary-box-shadow), var(--ring-box-shadow);
|
||||
border-color: var(--color-primary-900);
|
||||
|
||||
@variant dark {
|
||||
border-color: var(--color-primary-100);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -8,7 +8,7 @@
|
||||
import MarkdownEditor from '$lib/app/markdown/MarkdownEditor.svelte'
|
||||
import { placeholders } from '$lib/app/util.svelte'
|
||||
import { Button, Menu, MenuButton, toast } from 'mono-svelte'
|
||||
import { Icon, Language, XMark } from 'svelte-hero-icons/dist'
|
||||
import { ArrowUp, Icon, Language, XMark } from 'svelte-hero-icons/dist'
|
||||
import type { ClassValue, HTMLTextareaAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props extends Omit<HTMLTextareaAttributes, 'oncancel'> {
|
||||
@@ -149,11 +149,10 @@
|
||||
<div class="flex-1"></div>
|
||||
{#if actions}
|
||||
<Button
|
||||
size="custom"
|
||||
title={$t('common.cancel')}
|
||||
onclick={() => oncancel?.(true)}
|
||||
color="tertiary"
|
||||
class="w-8 h-8"
|
||||
size="square-md"
|
||||
rounding="xl"
|
||||
>
|
||||
<Icon
|
||||
@@ -169,8 +168,12 @@
|
||||
rounding="xl"
|
||||
{loading}
|
||||
disabled={locked || loading || banned}
|
||||
title={$t('form.submit')}
|
||||
size="square-lg"
|
||||
>
|
||||
{$t('form.submit')}
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUp} size="20" mini />
|
||||
{/snippet}
|
||||
</Button>
|
||||
{/if}
|
||||
</MarkdownEditor>
|
||||
|
||||
@@ -2,9 +2,9 @@ import { browser } from '$app/environment'
|
||||
import type {
|
||||
CommentView,
|
||||
CommunityView,
|
||||
FeedView,
|
||||
GetComments,
|
||||
GetCommunityResponse,
|
||||
GetMultiCommunityResponse,
|
||||
GetPersonDetails,
|
||||
GetPersonDetailsResponse,
|
||||
GetPost,
|
||||
@@ -115,12 +115,11 @@ export interface FeedTypes {
|
||||
]
|
||||
'/f/[id]': [
|
||||
GetPosts,
|
||||
|
||||
{
|
||||
posts: PostView[]
|
||||
multi: GetMultiCommunityResponse
|
||||
next_page?: string
|
||||
params: GetPosts & { page_cursor: string }
|
||||
feed: Promise<FeedView | undefined>
|
||||
params: GetPosts
|
||||
client: {
|
||||
itemHeights?: (number | null)[]
|
||||
lastSeen?: number
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<div
|
||||
class={[
|
||||
'relative overflow-hidden rounded-2xl max-h-full h-full',
|
||||
'border border-slate-200 dark:border-zinc-800 hover-scale-effect bg-slate-200 dark:bg-zinc-900',
|
||||
'btn-secondary hover-scale-effect',
|
||||
]}
|
||||
>
|
||||
{#if post.thumbnail_url || type == 'image'}
|
||||
@@ -115,7 +115,7 @@
|
||||
])}
|
||||
<div
|
||||
class={[
|
||||
'bg-slate-100 dark:bg-zinc-900 w-full h-full rounded-xl grid place-items-center',
|
||||
' w-full h-full rounded-xl grid place-items-center',
|
||||
'text-slate-600 dark:text-zinc-400',
|
||||
]}
|
||||
>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</script>
|
||||
|
||||
<fieldset
|
||||
class="flex items-center gap-1 w-max max-w-full z-0 relative overflow-auto"
|
||||
class="flex items-center gap-1 w-max max-w-full z-0 p-0.5 relative overflow-auto border border-slate-200 dark:border-zinc-800 rounded-full"
|
||||
>
|
||||
{#each options as option, index}
|
||||
<label>
|
||||
@@ -56,11 +56,7 @@
|
||||
id="{id}-{option?.toString()}"
|
||||
class="hidden"
|
||||
/>
|
||||
<TabButton
|
||||
selected={selectedIndex == index}
|
||||
disabled={disabled[index]}
|
||||
element="div"
|
||||
>
|
||||
<TabButton selected={selectedIndex == index} disabled={disabled[index]} element="div">
|
||||
{optionNames[index] || option}
|
||||
</TabButton>
|
||||
</label>
|
||||
|
||||
@@ -29,11 +29,7 @@
|
||||
|
||||
<svelte:element
|
||||
this={element}
|
||||
class={[
|
||||
sizes[size],
|
||||
'tab-button',
|
||||
selected ? 'btn-primary' : 'btn-secondary',
|
||||
]}
|
||||
class={[sizes[size], 'tab-button', selected && 'material-distinct']}
|
||||
onclick={href ? undefined : onselect}
|
||||
{disabled}
|
||||
{href}
|
||||
@@ -47,11 +43,38 @@
|
||||
|
||||
.tab-button {
|
||||
font-size: var(--text-sm);
|
||||
border-radius: var(--radius-xl);
|
||||
border-radius: 9999px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
transition: all 75ms var(--default-transition-timing-function);
|
||||
position: relative;
|
||||
box-shadow: var(--shadow-xs);
|
||||
cursor: pointer;
|
||||
padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 3.5);
|
||||
|
||||
&:hover {
|
||||
background-color: --alpha(var(--color-slate-300) / 40%);
|
||||
@variant dark {
|
||||
background-color: --alpha(var(--color-zinc-700) / 50%);
|
||||
}
|
||||
}
|
||||
|
||||
&:active {
|
||||
background-color: --alpha(var(--color-slate-400) / 40%);
|
||||
@variant dark {
|
||||
background-color: --alpha(var(--color-zinc-800) / 50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab-button-selected {
|
||||
background-color: --alpha(var(--color-slate-300) / 40%);
|
||||
@variant dark {
|
||||
background-color: --alpha(var(--color-zinc-700) / 50%);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: --alpha(var(--color-zinc-400) / 40%);
|
||||
@variant dark {
|
||||
background-color: --alpha(var(--color-zinc-600) / 50%);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -46,9 +46,9 @@
|
||||
<nav
|
||||
aria-label={$t('aria.pagination.nav')}
|
||||
class={[
|
||||
'flex flex-row gap-2 items-center justify-center bg-white dark:bg-zinc-950',
|
||||
'border border-slate-200 dark:border-zinc-800 rounded-full overflow-hidden w-max mx-auto p-0.5',
|
||||
'shadow-md',
|
||||
'flex flex-row gap-4 items-center justify-center',
|
||||
'rounded-full overflow-hidden w-max mx-auto p-1',
|
||||
'material-distinct',
|
||||
]}
|
||||
>
|
||||
{#if children}
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<nav
|
||||
class={[
|
||||
'tab-bar rounded-full',
|
||||
style == 'header' ? 'bar-header material-distinct' : 'gap-2',
|
||||
style == 'header' ? 'bar-header material-uniform' : 'gap-2',
|
||||
margin && 'my-2',
|
||||
margin && style == 'subpage' && 'mb-3',
|
||||
clazz,
|
||||
@@ -71,7 +71,7 @@
|
||||
{#if style == 'header'}
|
||||
<a
|
||||
href={buildUrl(currentRoute, route.href)}
|
||||
class={['tab-item ', selected && 'tab-selected']}
|
||||
class={['tab-item ', selected && 'material-distinct tab-selected']}
|
||||
>
|
||||
{route.name}
|
||||
</a>
|
||||
@@ -100,8 +100,8 @@
|
||||
}
|
||||
|
||||
.tab-bar.bar-header {
|
||||
padding: calc(var(--spacing) * 1.5);
|
||||
gap: calc(var(--spacing) * 1) calc(var(--spacing) * 2);
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
gap: calc(var(--spacing) * 1) calc(var(--spacing) * 1);
|
||||
justify-content: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
@@ -112,27 +112,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.tab-selected {
|
||||
position: relative;
|
||||
color: var(--color-primary-900);
|
||||
|
||||
@variant dark {
|
||||
color: var(--color-primary-100);
|
||||
}
|
||||
|
||||
@variant hover {
|
||||
cursor: default !important;
|
||||
}
|
||||
}
|
||||
|
||||
.tab-selected::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: calc(var(--spacing) * -1) calc(var(--spacing) * -3);
|
||||
z-index: -10;
|
||||
border-radius: 9999px;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
&:not(.tab-selected) {
|
||||
color: var(--color-slate-500);
|
||||
@@ -140,11 +119,11 @@
|
||||
@variant dark {
|
||||
color: var(--color-zinc-500);
|
||||
}
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
padding: calc(var(--spacing)) calc(var(--spacing) * 3);
|
||||
padding: calc(var(--spacing) * 1.5) calc(var(--spacing) * 4);
|
||||
border-radius: 999px;
|
||||
font-weight: var(--font-weight-medium);
|
||||
transition: all cubic-bezier(0.075, 0.82, 0.165, 1) 75ms;
|
||||
z-index: 0;
|
||||
flex-shrink: 0;
|
||||
|
||||
|
||||
@@ -294,14 +294,17 @@
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
/* border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white */
|
||||
|
||||
background-color: var(--color-red-600);
|
||||
background: linear-gradient(to bottom, var(--color-red-400), var(--color-red-500));
|
||||
border: 1px solid var(--color-red-600);
|
||||
box-shadow:
|
||||
0px 1.5px 0px 0px inset --alpha(var(--color-red-50) / 50%),
|
||||
0px -1px 0px 0px inset --alpha(var(--color-red-900) / 50%);
|
||||
color: var(--color-white);
|
||||
|
||||
@variant dark {
|
||||
background-color: var(--color-red-400);
|
||||
background: linear-gradient(to bottom, var(--color-red-300), var(--color-red-400));
|
||||
color: var(--color-black);
|
||||
border: 1px solid var(--color-red-900);
|
||||
}
|
||||
|
||||
@variant hover {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
id?: string
|
||||
rows?: number
|
||||
element?: HTMLTextAreaElement | undefined
|
||||
unstyled?: boolean
|
||||
class?: ClassValue
|
||||
customLabel?: import('svelte').Snippet
|
||||
suffix?: import('svelte').Snippet
|
||||
@@ -45,6 +46,7 @@
|
||||
id = generateID(),
|
||||
rows = 4,
|
||||
element = $bindable(),
|
||||
unstyled = false,
|
||||
class: clazz = '',
|
||||
customLabel,
|
||||
suffix,
|
||||
@@ -65,9 +67,8 @@
|
||||
{@render customLabel?.()}
|
||||
</Label>
|
||||
{/if}
|
||||
<div
|
||||
class="rounded-xl flex flex-col items-center text-sm bg-white dark:bg-zinc-950 {clazz}"
|
||||
>
|
||||
<div class={[!unstyled && 'text-area-container', clazz]}>
|
||||
e button danger style)
|
||||
<textarea
|
||||
{id}
|
||||
{placeholder}
|
||||
@@ -78,12 +79,9 @@
|
||||
{...rest}
|
||||
class={[
|
||||
sizeClass[size],
|
||||
borderClass,
|
||||
`focus:border-slate-800 dark:focus:border-zinc-200 bg-white dark:bg-zinc-950
|
||||
focus:outline-hidden focus:ring-2 ring-slate-800/50 rounded-xl dark:ring-zinc-200/50
|
||||
transition-all text-sm w-full disabled:bg-slate-100
|
||||
disabled:cursor-not-allowed dark:disabled:bg-zinc-900 invalid:border-red-500!
|
||||
peer invalid:text-red-500 z-10`,
|
||||
'text-area transition-all peer',
|
||||
!unstyled && borderClass,
|
||||
!unstyled && 'focus:ring-2 ring-slate-800/50 dark:ring-zinc-200/50',
|
||||
suffix && 'rounded-b-none border-b-0',
|
||||
clazz,
|
||||
]}
|
||||
@@ -101,3 +99,58 @@
|
||||
</div>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@reference '../../../../app.css';
|
||||
.text-area-container {
|
||||
border-radius: var(--radius-xl);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-size: var(--text-sm);
|
||||
|
||||
background: linear-gradient(
|
||||
to top,
|
||||
var(--color-white),
|
||||
var(--color-slate-100)
|
||||
);
|
||||
|
||||
@variant dark {
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
var(--color-zinc-900),
|
||||
color-mix(
|
||||
in oklab,
|
||||
var(--color-zinc-800) 50%,
|
||||
var(--color-zinc-900) 50%
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@variant focus-within {
|
||||
border-color: var(--color-primary-900);
|
||||
|
||||
@variant dark {
|
||||
border-color: var(--color-primary-100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.text-area {
|
||||
border-radius: inherit;
|
||||
width: 100%;
|
||||
|
||||
@variant focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@variant disabled {
|
||||
cursor: not-allowed;
|
||||
background-color: var(--color-slate-100);
|
||||
|
||||
@variant dark {
|
||||
background: var(--color-zinc-900);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -86,7 +86,12 @@
|
||||
]}
|
||||
>
|
||||
{#if icon}
|
||||
<Icon src={icon} size="20" mini class="inline-block rounded-lg clear-both float-left mr-2" />
|
||||
<Icon
|
||||
src={icon}
|
||||
size="20"
|
||||
mini
|
||||
class="inline-block rounded-lg clear-both float-left mr-2"
|
||||
/>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</svelte:element>
|
||||
@@ -130,8 +135,7 @@
|
||||
|
||||
.material-distinct {
|
||||
background-color: --alpha(var(--color-slate-50) / 70%);
|
||||
border-width: 1px;
|
||||
border-color: var(--color-slate-200);
|
||||
border: 1px solid var(--color-slate-200);
|
||||
box-shadow: 0px 1.5px 0px 0px --alpha(var(--color-white) / 90%) inset;
|
||||
|
||||
@variant not-dark {
|
||||
@@ -139,9 +143,13 @@
|
||||
}
|
||||
|
||||
@variant dark {
|
||||
background-color: --alpha(var(--color-zinc-925) / 70%);
|
||||
border-color: --alpha(var(--color-black) / 30%);
|
||||
box-shadow: 0px 1.5px 0px 0px --alpha(var(--color-zinc-800) / 80%) inset;
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
var(--color-zinc-800),
|
||||
var(--color-zinc-900)
|
||||
);
|
||||
border-color: oklab(0.2 0 00%);
|
||||
box-shadow: 0px 1.5px 0px 0px --alpha(var(--color-zinc-700) / 80%) inset;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,12 +168,10 @@
|
||||
}
|
||||
|
||||
.material-uniform {
|
||||
background-color: white;
|
||||
border-width: 1px;
|
||||
border-color: var(--color-slate-200);
|
||||
|
||||
@variant dark {
|
||||
background-color: var(--color-zinc-950);
|
||||
border-color: var(--color-zinc-900);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user