misc: Change the way buttons are handled

This commit is contained in:
Xyphyn committed 2023-07-19 13:43:18 -07:00
1 parent d8ac0d807a
commit e243848e17
30 files changed
+215 -152

No files matched your search

+1
View File
@@ -22,6 +22,7 @@
"svelte": "^3.54.0", "svelte": "^3.54.0",
"svelte-check": "^3.0.1", "svelte-check": "^3.0.1",
"svelte-hero-icons": "^5.0.0", "svelte-hero-icons": "^5.0.0",
"tailwind-merge": "^1.14.0",
"tailwindcss": "^3.3.2", "tailwindcss": "^3.3.2",
"tslib": "^2.4.1", "tslib": "^2.4.1",
"typescript": "^5.0.0", "typescript": "^5.0.0",
+1 -1
View File
@@ -11,6 +11,6 @@
%sveltekit.head% %sveltekit.head%
</head> </head>
<body data-sveltekit-preload-data="hover"> <body data-sveltekit-preload-data="hover">
<div style="display: contents; height: 100%">%sveltekit.body%</div> <div style="display: contents">%sveltekit.body%</div>
</body> </body>
</html> </html>
@@ -108,8 +108,8 @@
<Button <Button
disabled={loading.subscribing} disabled={loading.subscribing}
loading={loading.subscribing} loading={loading.subscribing}
large color="ghost"
color={Color.ghost} size="lg"
on:click={subscribe} on:click={subscribe}
> >
{community_view.subscribed == 'Subscribed' || {community_view.subscribed == 'Subscribed' ||
@@ -120,8 +120,8 @@
<Button <Button
disabled={loading.blocking} disabled={loading.blocking}
loading={loading.blocking} loading={loading.blocking}
large color="danger"
color={Color.danger} size="lg"
on:click={block} on:click={block}
> >
{community_view.blocked ? 'Unblock' : 'Block'} {community_view.blocked ? 'Unblock' : 'Block'}
+80 -32
View File
@@ -1,43 +1,91 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
import { Color } from '$lib/ui/colors.js'
import Loading from '$lib/components/ui/loader/Loading.svelte'
import Spinner from '$lib/components/ui/loader/Spinner.svelte' import Spinner from '$lib/components/ui/loader/Spinner.svelte'
export let color: Color = Color.secondary type ButtonColor = keyof typeof buttonColor
type ButtonSize = keyof typeof buttonSize
type ButtonRoundness = keyof typeof buttonRoundness
const buttonColor = {
primary: `border bg-black border-black text-white dark:bg-white
dark:border-white dark:text-black hover:text-inherit hover:bg-transparent
active:bg-black/10 active:dark:bg-white/10`,
secondary: 'bg-transparent hover:bg-slate-100 hover:dark:bg-zinc-800',
danger:
'border border-red-500 bg-red-500 hover:text-red-500 hover:bg-transparent text-white',
ghost: `border border-slate-200 dark:border-zinc-800 hover:bg-slate-100 hover:dark:bg-zinc-800
hover:border-slate-200 hover:dark:border-zinc-700`,
elevated: `bg-slate-100 dark:bg-zinc-800 border border-slate-200
dark:border-zinc-700 hover:bg-slate-200 hover:dark:bg-zinc-700 hover:border-slate-300
hover:dark:border-zinc-600`,
none: '',
}
const buttonSize = {
sm: 'px-3 py-1',
md: 'px-3 py-1.5',
lg: 'px-4 py-2',
}
const buttonRoundness = {
pill: 'rounded-full',
md: 'rounded-md',
none: '',
}
export let loading = false export let loading = false
export let large = false
export let disabled = false
export let submit = false export let submit = false
export let label: string = ''
export let spinner = false export let color: ButtonColor = 'secondary'
export let size: ButtonSize = 'md'
export let rounded: ButtonRoundness = 'md'
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
export let href: string | undefined = undefined
let buttonClass = `
${buttonColor[color]}
${buttonSize[size]}
${buttonRoundness[rounded]}
${
loading ? (color == 'primary' ? '!bg-transparent !text-inherit' : '') : ''
}
text-sm transition-all disabled:opacity-70 disabled:pointer-events-none
${$$props.class}
`
</script> </script>
<button {#if href}
{disabled} <a {href} {...$$restProps} class={buttonClass}>
on:click={(e) => dispatch('click', e)} <div class="flex flex-row items-center justify-center gap-1.5">
class="{large {#if loading}
? 'w-full px-4 py-2' <Spinner />
: 'px-3 py-1.5'} rounded-md {color} text-sm transition-all disabled:opacity-50 disabled:pointer-events-none" {:else}
type={submit ? 'submit' : 'button'} <slot name="icon" />
aria-label={label} {/if}
> <slot />
<div </div>
class="flex flex-row items-center justify-center gap-2" </a>
class:hidden={loading} {:else}
<button
disabled={loading}
{...$$restProps}
on:click={(e) => dispatch('click', e)}
class={buttonClass}
type={submit ? 'submit' : 'button'}
> >
<slot name="icon" /> <div class="flex flex-row items-center justify-center gap-1.5">
<slot /> {#if loading}
</div> <Spinner width={20} />
<div class="mx-auto" class:hidden={!loading}> {:else}
{#if spinner} <slot name="icon" />
<Spinner /> {/if}
{:else} <slot />
<div class="py-2"> </div>
<Loading /> </button>
</div> {/if}
{/if}
</div>
</button>
+5 -2
View File
@@ -15,9 +15,12 @@
</script> </script>
<label <label
class="flex flex-col items-center px-8 py-4 mx-auto w-full rounded-lg border border-black border-dashed cursor-pointer min-h-36 transition-colors dark:border-white {dragover class="flex flex-col items-center px-8 py-4 mx-auto w-full rounded-lg
border border-slate-300 dark:border-zinc-700 bg-white dark:bg-black
cursor-pointer min-h-36 transition-colors {dragover
? 'border-sky-500 text-sky-500' ? 'border-sky-500 text-sky-500'
: ''}" : ''}
"
on:drop|preventDefault={(event) => (files = event.dataTransfer?.files)} on:drop|preventDefault={(event) => (files = event.dataTransfer?.files)}
on:dragover|preventDefault={(event) => { on:dragover|preventDefault={(event) => {
if (event.dataTransfer) { if (event.dataTransfer) {
+4 -7
View File
@@ -1,16 +1,13 @@
<script lang="ts"> <script lang="ts">
import { Color } from '$lib/ui/colors.js' export let href: string
export let color: Color = Color.secondary export let highlight: boolean
export let href = ''
export let label: string = ''
</script> </script>
<a <a
{href} {href}
class="px-3 py-1 rounded-md {color} flex flex-row items-center class="flex flex-row gap-2 {highlight ? 'text-sky-500' : ''} hover:underline"
justify-center text-sm transition-all gap-1" {...$$restProps}
aria-label={label}
> >
<slot name="icon" /> <slot name="icon" />
<slot /> <slot />
+3 -3
View File
@@ -27,8 +27,8 @@
{placeholder} {placeholder}
{maxlength} {maxlength}
{rows} {rows}
class="w-full px-3 text-sm py-2.5 bg-transparent border border-black/20 class="w-full px-3 text-sm py-2.5 bg-white dark:bg-black
dark:border-white/20 dark:focus:border-white focus:outline-none border border-slate-300 dark:border-zinc-700 dark:focus:border-white
focus:border-black transition-colors rounded-md {clazz}" focus:outline-none focus:border-black transition-colors rounded-md {clazz}"
/> />
</label> </label>
+11 -19
View File
@@ -3,26 +3,26 @@
export let label: string = '' export let label: string = ''
export let type: 'text' | 'password' | 'email' | null | undefined = 'text' export let type: 'text' | 'password' | 'email' | null | undefined = 'text'
export let placeholder: string = ''
export let value: string = '' export let value: string = ''
export let maxlength: number = -1
export let required = false export let required = false
export let id = ''
export let pattern: string | undefined = undefined
export let minlength: number = 0
function typeAction(node: Node) { function typeAction(node: Node) {
// @ts-ignore // @ts-ignore
node.type = type node.type = type
} }
let clazz = ''
export { clazz as class }
const dispatcher = createEventDispatcher() const dispatcher = createEventDispatcher()
let className = `
${value.length != 0 ? 'invalid:border-red-400' : ''}
w-full px-3 text-sm py-2.5 bg-white dark:bg-zinc-950
border border-slate-300 dark:border-zinc-700 dark:focus:border-white
focus:outline-none focus:border-black transition-colors rounded-md
${$$props.class}
`
</script> </script>
<label class="flex flex-col items-center {clazz}"> <label class="flex flex-col items-center {$$props.class}">
{#if label != ''} {#if label != ''}
<span <span
class="font-bold text-sm text-left mb-1 cursor-pointer w-max self-start" class="font-bold text-sm text-left mb-1 cursor-pointer w-max self-start"
@@ -38,16 +38,8 @@
bind:value bind:value
on:keydown={(e) => dispatcher('keydown', e)} on:keydown={(e) => dispatcher('keydown', e)}
on:input={(e) => dispatcher('input', e)} on:input={(e) => dispatcher('input', e)}
{placeholder} {...$$restProps}
{maxlength} class={className}
{minlength}
{pattern}
{id}
class="{value.length != 0
? 'invalid:border-red-400'
: ''} w-full px-3 text-sm py-2.5 bg-transparent
border border-black/20 dark:border-white/20 dark:focus:border-white
focus:outline-none focus:border-black transition-colors rounded-md {clazz}"
{required} {required}
/> />
</label> </label>
+2 -1
View File
@@ -51,6 +51,7 @@
<FormattedNumber number={site.counts.communities} /> <FormattedNumber number={site.counts.communities} />
</span> </span>
</div> </div>
<p class="text-sm">{site.site.description}</p> <p>{site.site.description}</p>
<hr class="border-slate-300 dark:border-zinc-700" />
<Markdown source={site.site.sidebar} /> <Markdown source={site.site.sidebar} />
</StickyCard> </StickyCard>
@@ -17,9 +17,7 @@
</script> </script>
<li <li
class="py-2 {$page.url.hash == `#${node.comment_view.comment.id}` class="py-2 {node.depth == 0
? 'bg-slate-200 dark:bg-zinc-800'
: ''} {node.depth == 0
? 'border-b border-slate-200 dark:border-zinc-800' ? 'border-b border-slate-200 dark:border-zinc-800'
: ''}" : ''}"
id="#{node.comment_view.comment.id.toString()}" id="#{node.comment_view.comment.id.toString()}"
@@ -83,7 +81,7 @@
node.children = [ node.children = [
{ {
children: [], children: [],
depth: node.depth, depth: node.depth + 1,
comment_view: e.detail.comment_view, comment_view: e.detail.comment_view,
}, },
...node.children, ...node.children,
@@ -55,15 +55,14 @@
class="bg-slate-100 dark:bg-zinc-900" class="bg-slate-100 dark:bg-zinc-900"
bind:value={newComment} bind:value={newComment}
/> />
<div <div class="sm:ml-auto sm:w-28">
class="w-full ml-auto flex flex-row gap-2 md:w-24 md:absolute md:bottom-0 md:right-0 md:m-2"
>
<Button <Button
large large
on:click={submit} on:click={submit}
color={Color.accent} color="primary"
size="lg"
class="w-full"
{loading} {loading}
disabled={loading}
> >
Submit Submit
</Button> </Button>
@@ -17,6 +17,7 @@
if (isParent && $page.url.hash) { if (isParent && $page.url.hash) {
document.getElementById($page.url.hash)?.scrollIntoView({ document.getElementById($page.url.hash)?.scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
block: 'center',
}) })
} }
}) })
@@ -80,7 +81,7 @@
disabled={loadingChildren} disabled={loadingChildren}
on:click={() => fetchChildren(node)} on:click={() => fetchChildren(node)}
> >
<Icon src={ChevronDown} width={16} mini /> <Icon src={ChevronDown} width={16} mini slot="icon" />
{node.comment_view.counts.child_count} more {node.comment_view.counts.child_count} more
</Button> </Button>
</div> </div>
@@ -62,13 +62,23 @@
<div class="flex flex-row gap-2 items-center"> <div class="flex flex-row gap-2 items-center">
<PostVote post={post.post} vote={post.my_vote} score={post.counts.score} /> <PostVote post={post.post} vote={post.my_vote} score={post.counts.score} />
<Link color={Color.border} href="/post/{getInstance()}/{post.post.id}"> <Button
color="elevated"
size="sm"
href="/post/{getInstance()}/{post.post.id}"
>
<Icon slot="icon" src={ChatBubbleOvalLeft} mini width={16} height={16} /> <Icon slot="icon" src={ChatBubbleOvalLeft} mini width={16} height={16} />
<FormattedNumber number={post.counts.comments} /> <FormattedNumber number={post.counts.comments} />
</Link> </Button>
<Menu alignment="bottom-right" class="ml-auto overflow-auto" let:toggleOpen> <Menu alignment="bottom-right" class="ml-auto overflow-auto" let:toggleOpen>
<Button slot="button" label="Post actions" on:click={toggleOpen}> <Button
<Icon src={EllipsisHorizontal} width={16} mini /> slot="button"
label="Post actions"
on:click={toggleOpen}
class="!p-1.5"
color="secondary"
>
<Icon slot="icon" src={EllipsisHorizontal} width={16} mini />
</Button> </Button>
<li class="mx-4 text-xs opacity-80 text-left my-1 py-1">Creator</li> <li class="mx-4 text-xs opacity-80 text-left my-1 py-1">Creator</li>
<MenuButton <MenuButton
@@ -10,13 +10,15 @@
<!-- svelte-ignore a11y-missing-attribute --> <!-- svelte-ignore a11y-missing-attribute -->
<img <img
src={thumbnail_url} src={thumbnail_url}
class="rounded-md max-h-[16rem] w-full aspect-[16/9] object-cover" class="rounded-md max-h-[16rem] w-full aspect-[16/9] object-cover bg-slate-200 dark:bg-zinc-800"
width={600}
height={400}
/> />
<span <span
class="w-full px-4 py-2 overflow-hidden class="w-full px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis
whitespace-nowrap text-ellipsis text-sm group-hover:underline bg-slate-100 border text-sm group-hover:underline bg-slate-100 border dark:border-zinc-700
dark:border-zinc-700 dark:bg-zinc-800 absolute bottom-0 rounded-b-md flex flex-row gap-1
dark:bg-zinc-800 absolute bottom-0 rounded-b-md flex flex-row gap-1 items-center h-10" items-center h-10"
> >
<Icon src={Link} width={16} mini /> <Icon src={Link} width={16} mini />
{new URL(url).hostname} {new URL(url).hostname}
@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import Button from '$lib/components/input/Button.svelte'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte' import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import { authData, getClient } from '$lib/lemmy' import { authData, getClient } from '$lib/lemmy'
import { userSettings } from '$lib/settings.js' import { userSettings } from '$lib/settings.js'
@@ -65,8 +66,7 @@
<slot {upvote} {downvote} {vote} {score}> <slot {upvote} {downvote} {vote} {score}>
<div <div
class="{Color.border} text-sm gap-0.5 rounded-md flex flex-row items-center px-1 class="{Color.border} text-sm gap-0.5 rounded-md flex flex-row items-center
py-0.5
transition-colors cursor-pointer bg-slate-100 dark:bg-zinc-800 transition-colors cursor-pointer bg-slate-100 dark:bg-zinc-800
hover:bg-slate-200 dark:hover:bg-zinc-700" hover:bg-slate-200 dark:hover:bg-zinc-700"
> >
@@ -74,7 +74,7 @@
aria-label="Upvote" aria-label="Upvote"
class:text-orange-500={vote == 1 && $userSettings.revertColors} class:text-orange-500={vote == 1 && $userSettings.revertColors}
class:text-blue-500={vote == 1 && !$userSettings.revertColors} class:text-blue-500={vote == 1 && !$userSettings.revertColors}
class="p-0.5 px-1" class="py-1 pr-0.5 pl-2"
on:click={upvote} on:click={upvote}
> >
<Icon src={ChevronUp} mini width={20} height={20} /> <Icon src={ChevronUp} mini width={20} height={20} />
@@ -84,7 +84,7 @@
aria-label="Downvote" aria-label="Downvote"
class:text-blue-500={vote == -1 && $userSettings.revertColors} class:text-blue-500={vote == -1 && $userSettings.revertColors}
class:text-red-500={vote == -1 && !$userSettings.revertColors} class:text-red-500={vote == -1 && !$userSettings.revertColors}
class="p-0.5 px-1" class="py-1 pl-0.5 pr-2"
on:click={downvote} on:click={downvote}
> >
<Icon src={ChevronDown} mini width={20} height={20} /> <Icon src={ChevronDown} mini width={20} height={20} />
+1 -1
View File
@@ -17,7 +17,7 @@
<div <div
class="bg-white break-words class="bg-white break-words
p-1 {getColor(cardColor)} rounded-xl {clazz}" p-1 {getColor(cardColor)} rounded-md {clazz}"
> >
<slot /> <slot />
</div> </div>
+11 -10
View File
@@ -1,16 +1,17 @@
<script lang="ts"> <script lang="ts">
export let width = 48 export let width = 48
</script> </script>
<svg <svg
{width} {width}
viewBox="0 0 100 100" viewBox="0 0 100 100"
fill="none" fill="none"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
aria-label="Home"
> >
<path <path
id="hexagon" id="hexagon"
d="M45.5 10.8868C48.594 9.10042 52.406 9.10042 55.5 10.8868L82.3061 26.3632C85.4001 28.1496 87.3061 31.4508 87.3061 35.0235V65.9765C87.3061 69.5492 85.4001 72.8504 82.3061 74.6368L55.5 90.1132C52.406 91.8996 48.594 91.8996 45.5 90.1132L18.6939 74.6368C15.5999 72.8504 13.6939 69.5492 13.6939 65.9765V35.0235C13.6939 31.4508 15.5999 28.1496 18.6939 26.3632L45.5 10.8868Z" d="M45.5 10.8868C48.594 9.10042 52.406 9.10042 55.5 10.8868L82.3061 26.3632C85.4001 28.1496 87.3061 31.4508 87.3061 35.0235V65.9765C87.3061 69.5492 85.4001 72.8504 82.3061 74.6368L55.5 90.1132C52.406 91.8996 48.594 91.8996 45.5 90.1132L18.6939 74.6368C15.5999 72.8504 13.6939 69.5492 13.6939 65.9765V35.0235C13.6939 31.4508 15.5999 28.1496 18.6939 26.3632L45.5 10.8868Z"
class="fill-black dark:fill-white" class="fill-black dark:fill-white"
/> />
</svg> </svg>
+12 -16
View File
@@ -3,6 +3,7 @@
import Button from '$lib/components/input/Button.svelte' import Button from '$lib/components/input/Button.svelte'
import Link from '$lib/components/input/Link.svelte' import Link from '$lib/components/input/Link.svelte'
import Logo from '$lib/components/ui/Logo.svelte' import Logo from '$lib/components/ui/Logo.svelte'
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
import Menu from '$lib/components/ui/menu/Menu.svelte' import Menu from '$lib/components/ui/menu/Menu.svelte'
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte' import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
import { authData, getInstance, instance, user } from '$lib/lemmy.js' import { authData, getInstance, instance, user } from '$lib/lemmy.js'
@@ -23,7 +24,7 @@
<nav <nav
class="flex flex-row gap-2 items-center sticky top-0 bg-slate-50/80 class="flex flex-row gap-2 items-center sticky top-0 bg-slate-50/80
lg:bg-white/80 lg:rounded-b-xl lg:bg-white/80 lg:rounded-b-md
dark:bg-zinc-950/80 lg:dark:bg-zinc-900/80 backdrop-blur-3xl max-w-5xl dark:bg-zinc-950/80 lg:dark:bg-zinc-900/80 backdrop-blur-3xl max-w-5xl
w-full mx-auto px-4 py-2 z-50 lg:border-x lg:border-b transition-all w-full mx-auto px-4 py-2 z-50 lg:border-x lg:border-b transition-all
border-slate-200 dark:border-zinc-800 box-border" border-slate-200 dark:border-zinc-800 box-border"
@@ -31,30 +32,25 @@
<div class="flex flex-row gap-2 items-center mr-auto"> <div class="flex flex-row gap-2 items-center mr-auto">
<a href="/" class="flex flex-row items-center gap-2"> <a href="/" class="flex flex-row items-center gap-2">
<Logo width={40} /> <Logo width={40} />
<div class="flex flex-col"> <span class="opacity-30 text-lg">/</span>
<span class="font-bold">Photon</span> <span class="text-sm font-bold">
<span {$instance}
class="text-xs opacity-50 </span>
transition-opacity"
>
{$instance}
</span>
</div>
</a> </a>
</div> </div>
<div class="flex flex-row gap-2 py-2 px-3"> <div class="flex flex-row gap-2 py-2 px-3">
<Link href="/communities" label="Communities"> <Button href="/communities" label="Communities">
<Icon src={GlobeAlt} width={16} /> <Icon src={GlobeAlt} width={16} slot="icon" />
<span class="hidden sm:inline ml-1">Explore</span> <span class="hidden sm:inline">Explore</span>
</Link> </Button>
<Menu let:toggleOpen alignment="bottom-right"> <Menu let:toggleOpen alignment="bottom-right">
<Button <Button
color={Color.accent} color="primary"
slot="button" slot="button"
label="Create" label="Create"
on:click={toggleOpen} on:click={toggleOpen}
> >
<Icon src={Plus} width={18} mini /> <Icon src={Plus} width={18} mini slot="icon" />
<span class="hidden sm:inline">Create</span> <span class="hidden sm:inline">Create</span>
</Button> </Button>
<li class="text-xs opacity-80 text-left mx-4 my-1 py-1">Create</li> <li class="text-xs opacity-80 text-left mx-4 my-1 py-1">Create</li>
+1 -1
View File
@@ -1,7 +1,7 @@
<aside <aside
class="sticky top-20 border bg-white border-slate-200 class="sticky top-20 border bg-white border-slate-200
dark:border-zinc-800 dark:bg-zinc-900 break-words flex dark:border-zinc-800 dark:bg-zinc-900 break-words flex
flex-col gap-4 p-6 w-[20rem] rounded-xl h-max max-h-[calc(100vh-6rem)] flex-col gap-4 p-6 w-[20rem] rounded-md h-max max-h-[calc(100vh-6rem)]
overflow-auto" overflow-auto"
> >
<slot /> <slot />
+8 -4
View File
@@ -1,8 +1,12 @@
<script lang="ts"> <script lang="ts">
export let width: number = 28 export let width: number = 32
</script> </script>
<div class="spinner" style="width: {width}px; height: {width}px;"> <div
class="spinner"
style="width: {width}px; height: {width}px;"
role="progressbar"
>
<div class="bar1" /> <div class="bar1" />
<div class="bar2" /> <div class="bar2" />
<div class="bar3" /> <div class="bar3" />
@@ -25,8 +29,8 @@
} }
div.spinner div { div.spinner div {
width: 6%; width: 7.5%;
height: 16%; height: 22%;
position: absolute; position: absolute;
left: 49%; left: 49%;
top: 43%; top: 43%;
+1 -1
View File
@@ -8,7 +8,7 @@
<div class="flex flex-col mx-auto gap-4 justify-center items-center"> <div class="flex flex-col mx-auto gap-4 justify-center items-center">
<h1 class="font-black text-5xl">{$page.status}</h1> <h1 class="font-black text-5xl">{$page.status}</h1>
<Link href={$page.url.toString()}>Retry</Link> <Button href={$page.url.toString()}>Retry</Button>
<Button <Button
on:click={() => { on:click={() => {
corsSupported.set(false) corsSupported.set(false)
+10 -10
View File
@@ -26,7 +26,7 @@
<div class="flex flex-col sm:flex-row gap-4"> <div class="flex flex-col sm:flex-row gap-4">
<MultiSelect <MultiSelect
options={['Subscribed', 'Local', 'All']} options={['Subscribed', 'Local', 'All']}
selected={$page.url.searchParams.get('type') ?? 'Local'} selected={$page.url.searchParams.get('type') ?? 'All'}
on:select={(e) => { on:select={(e) => {
const url = $page.url const url = $page.url
url.searchParams.set('type', e.detail) url.searchParams.set('type', e.detail)
@@ -36,8 +36,8 @@
}) })
}} }}
/> />
<div class="flex flex-col sm:flex-row gap-2 sm:ml-auto"> <div class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center">
<TextInput class="rounded-md" bind:value={search} /> <TextInput bind:value={search} />
<Button <Button
on:click={() => { on:click={() => {
$page.url.searchParams.set('q', search) $page.url.searchParams.set('q', search)
@@ -45,7 +45,8 @@
invalidateAll: true, invalidateAll: true,
}) })
}} }}
color={Color.ghost} color="ghost"
class="h-max"
> >
Search Search
</Button> </Button>
@@ -56,20 +57,19 @@
<li> <li>
<div <div
class="py-4 border-b border-black/20 dark:border-white/20 class="py-4 border-b border-black/20 dark:border-white/20
flex flex-col gap-1 text-sm" flex flex-col gap-1 text-sm max-w-full"
> >
<div class="flex flex-row justify-between items-center"> <div class="flex flex-row items-center">
<span <span
class="break-words max-w-full w-max text-base font-bold text-sky-400 hover:underline" class="break-words max-w-full w-max text-base font-bold text-sky-400 hover:underline"
> >
<CommunityLink avatar community={community.community} /> <CommunityLink avatar community={community.community} />
</span> </span>
<div class="w-24"> <div class="ml-auto">
<Subscribe {community} let:subscribe let:subscribing> <Subscribe {community} let:subscribe let:subscribing>
<Button <Button
disabled={subscribing} disabled={subscribing}
loading={subscribing} loading={subscribing}
large
on:click={async () => { on:click={async () => {
const res = await subscribe() const res = await subscribe()
@@ -81,8 +81,8 @@
} }
}} }}
color={community.subscribed == 'Subscribed' color={community.subscribed == 'Subscribed'
? Color.accent ? 'primary'
: Color.ghost} : 'ghost'}
> >
{community.subscribed == 'Subscribed' {community.subscribed == 'Subscribed'
? 'Subscribed' ? 'Subscribed'
+2 -8
View File
@@ -6,7 +6,7 @@
import TextArea from '$lib/components/input/TextArea.svelte' import TextArea from '$lib/components/input/TextArea.svelte'
import TextInput from '$lib/components/input/TextInput.svelte' import TextInput from '$lib/components/input/TextInput.svelte'
import Card from '$lib/components/ui/Card.svelte' import Card from '$lib/components/ui/Card.svelte'
import Loading from '$lib/components/ui/loader/Loading.svelte' import Loading from '$lib/components/ui/loader/Dots.svelte'
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js' import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
import { authData, buildBaseUrl, getClient, getInstance } from '$lib/lemmy.js' import { authData, buildBaseUrl, getClient, getInstance } from '$lib/lemmy.js'
import { Color } from '$lib/ui/colors.js' import { Color } from '$lib/ui/colors.js'
@@ -152,13 +152,7 @@
bind:files={data.image} bind:files={data.image}
/> />
</div> </div>
<Button <Button submit color="primary" loading={data.loading} size="lg">
submit
color={Color.accent}
large
loading={data.loading}
disabled={data.loading}
>
Submit Submit
</Button> </Button>
</form> </form>
+3 -3
View File
@@ -86,7 +86,7 @@
</div> </div>
<div class="w-max ml-auto"> <div class="w-max ml-auto">
<Link href="/post/{item.post.id}#{item.comment.id}">Jump</Link> <Button href="/post/{item.post.id}#{item.comment.id}">Jump</Button>
</div> </div>
</div> </div>
<div> <div>
@@ -124,7 +124,7 @@
</p> </p>
{#if item.recipient.id == $user?.person.id} {#if item.recipient.id == $user?.person.id}
<div class="flex flex-row gap-2"> <div class="flex flex-row gap-2">
<Button color={Color.ghost} on:click={() => (replying = !replying)}> <Button color="ghost" on:click={() => (replying = !replying)}>
<Icon mini src={ChatBubbleOvalLeft} width={16} /> <Icon mini src={ChatBubbleOvalLeft} width={16} />
Reply Reply
</Button> </Button>
@@ -139,7 +139,7 @@
{loading} {loading}
large large
on:click={() => replyToMessage(item)} on:click={() => replyToMessage(item)}
color={Color.accent} color="primary"
> >
Submit Submit
</Button> </Button>
+3 -3
View File
@@ -92,7 +92,7 @@
pattern={'(?!-)[A-Za-z0-9-]+([-.]{1}[a-z0-9]+)*.[A-Za-z]{2,6}'} pattern={'(?!-)[A-Za-z0-9-]+([-.]{1}[a-z0-9]+)*.[A-Za-z]{2,6}'}
/> />
</div> </div>
<div class="flex flex-row gap-2 w-full"> <div class="flex flex-row gap-2">
<TextInput <TextInput
id="password" id="password"
bind:value={data.password} bind:value={data.password}
@@ -121,8 +121,8 @@
<Button <Button
loading={data.loading} loading={data.loading}
disabled={data.loading} disabled={data.loading}
large color="primary"
color={Color.accent} size="lg"
submit submit
> >
Log in Log in
+4 -1
View File
@@ -7,6 +7,7 @@
import Link from '$lib/components/input/Link.svelte' import Link from '$lib/components/input/Link.svelte'
import Comment from '$lib/components/lemmy/comment/Comment.svelte' import Comment from '$lib/components/lemmy/comment/Comment.svelte'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import Button from '$lib/components/input/Button.svelte'
export let data export let data
@@ -38,7 +39,9 @@
{item.post.name} {item.post.name}
</span> </span>
</div> </div>
<Link href="/post/{item.post.id}#{item.comment.id}">Jump</Link> <Button href="/post/{item.post.id}#{item.comment.id}">
Jump
</Button>
</div> </div>
<div class="list-none"> <div class="list-none">
<Comment <Comment
+1 -1
View File
@@ -57,7 +57,7 @@
/> />
<div class="w-24"> <div class="w-24">
<Button <Button
color={Color.accent} color="primary"
large large
loading={data.loading} loading={data.loading}
disabled={data.loading} disabled={data.loading}
+9 -1
View File
@@ -20,6 +20,7 @@
Icon, Icon,
PencilSquare, PencilSquare,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import Button from '$lib/components/input/Button.svelte'
export let data: { export let data: {
user: GetPersonDetailsResponse user: GetPersonDetailsResponse
@@ -60,7 +61,14 @@
{item.post.name} {item.post.name}
</span> </span>
</div> </div>
<Link href="/post/{item.post.id}#{item.comment.id}">Jump</Link> <Button
color="secondary"
href="/post/{item.post.id}#{item.comment.id}"
size="sm"
class="self-start"
>
Jump
</Button>
</div> </div>
<div class="list-none"> <div class="list-none">
<Comment <Comment
+5
View File
@@ -1552,6 +1552,11 @@ symbol-tree@^3.2.4:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
tailwind-merge@^1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/tailwind-merge/-/tailwind-merge-1.14.0.tgz#e677f55d864edc6794562c63f5001f45093cdb8b"
integrity sha512-3mFKyCo/MBcgyOTlrY8T7odzZFx+w+qKSMAmdFzRvqBfLlSigU6TZnlFHK0lkMwj9Bj8OYU+9yW9lmGuS0QEnQ==
tailwindcss@^3.3.2: tailwindcss@^3.3.2:
version "3.3.3" version "3.3.3"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.3.3.tgz#90da807393a2859189e48e9e7000e6880a736daf" resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.3.3.tgz#90da807393a2859189e48e9e7000e6880a736daf"