feat: switch from card to material
This commit is contained in:
1 parent
43b0e87ebf
commit
c53ec52d86
16 files changed
+61
-126
No files matched your search
@@ -1,15 +1,14 @@
|
||||
<script lang="ts">
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { getInstance } from '$lib/lemmy.js'
|
||||
import type { CommentView } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Button, Material } from 'mono-svelte'
|
||||
|
||||
export let comment: CommentView
|
||||
</script>
|
||||
|
||||
<Card class="flex flex-col bg-white rounded-md p-5 flex-1 gap-1">
|
||||
<Material class="flex flex-col flex-1 gap-1" color="distinct" padding="lg">
|
||||
<div class="flex flex-row justify-between items-center">
|
||||
<PostMeta
|
||||
community={comment.community}
|
||||
@@ -42,4 +41,4 @@
|
||||
replying={false}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
</Material>
|
||||
@@ -3,7 +3,6 @@
|
||||
import { amMod } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import StickyCard from '$lib/components/ui/StickyCard.svelte'
|
||||
import { toast } from 'mono-svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<script lang="ts">
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import { isImage } from '$lib/ui/image.js'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { getInstance } from '$lib/lemmy.js'
|
||||
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
|
||||
export let post: PostView
|
||||
@@ -18,7 +17,9 @@
|
||||
let loaded = false
|
||||
</script>
|
||||
|
||||
<Card
|
||||
<Material
|
||||
color="distinct"
|
||||
padding="none"
|
||||
class="flex flex-col max-w-full min-w-0 w-full gap-2.5 {compact
|
||||
? '!bg-transparent !border-0 py-5'
|
||||
: 'p-5'}"
|
||||
@@ -42,7 +43,7 @@
|
||||
/>
|
||||
<a
|
||||
href="/post/{getInstance()}/{post.post.id}"
|
||||
class="font-medium max-w-full w-full break-words"
|
||||
class="font-medium max-w-full w-full break-words text-base"
|
||||
style="word-break: break-word;"
|
||||
class:text-slate-500={post.read && $userSettings.markReadPosts}
|
||||
class:dark:text-zinc-400={post.read && $userSettings.markReadPosts}
|
||||
@@ -51,14 +52,6 @@
|
||||
</a>
|
||||
</div>
|
||||
{#if !$userSettings.showCompactPosts}
|
||||
{#if post.post.url && !post.post.thumbnail_url}
|
||||
<a
|
||||
href={post.post.url}
|
||||
class="max-w-full overflow-hidden overflow-ellipsis whitespace-nowrap text-sky-400 hover:underline text-xs"
|
||||
>
|
||||
{post.post.url}
|
||||
</a>
|
||||
{/if}
|
||||
{#if isImage(post.post.url)}
|
||||
<!--disabled preloads here since most people will hover over every image while scrolling-->
|
||||
<a
|
||||
@@ -153,4 +146,4 @@
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
</Card>
|
||||
</Material>
|
||||
@@ -1,24 +0,0 @@
|
||||
<script lang="ts">
|
||||
export let label: string = ''
|
||||
|
||||
const badgeColor = {
|
||||
red: 'bg-red-200 dark:bg-red-900 text-red-800 dark:text-red-300',
|
||||
green: 'bg-green-200 dark:bg-green-900 text-green-800 dark:text-green-300',
|
||||
yellow:
|
||||
'bg-yellow-200 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-300',
|
||||
gray: 'bg-slate-200 dark:bg-zinc-800 text-gray-800 dark:text-gray-200',
|
||||
}
|
||||
|
||||
type BadgeColor = keyof typeof badgeColor
|
||||
|
||||
export let color: BadgeColor = 'gray'
|
||||
</script>
|
||||
|
||||
<span
|
||||
class="px-2 py-0.5 rounded-full text-xs ml-auto font-bold flex items-center gap-1 {badgeColor[
|
||||
color
|
||||
]} {$$props.class}"
|
||||
title={label}
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
@@ -1,28 +0,0 @@
|
||||
<script lang="ts">
|
||||
type CardColor = 'default' | 'warning' | 'error'
|
||||
export let cardColor: CardColor = 'default'
|
||||
|
||||
export let elevation: 0 | 1 = 1
|
||||
|
||||
const getColor = (color: CardColor) => {
|
||||
switch (color) {
|
||||
case 'default':
|
||||
return elevation == 0
|
||||
? 'border border-slate-200 dark:border-zinc-900 bg-slate-100 dark:bg-zinc-950'
|
||||
: 'border border-slate-200 dark:border-zinc-800 bg-white dark:bg-zinc-900'
|
||||
case 'warning':
|
||||
return 'border border-yellow-300 dark:bg-yellow-950/30 dark:border-yellow-900 bg-yellow-50'
|
||||
}
|
||||
}
|
||||
|
||||
let clazz = ''
|
||||
export { clazz as class }
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="break-words
|
||||
{getColor(cardColor)} rounded-lg {clazz}"
|
||||
{...$$restProps}
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -1,10 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { RegistrationApplicationView } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
@@ -50,7 +48,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Card elevation={0} class="p-4 flex flex-col gap-2">
|
||||
<Material class="flex flex-col gap-2">
|
||||
<div class="flex flex-col gap-1">
|
||||
<SectionTitle>User</SectionTitle>
|
||||
<span class="text-sm">
|
||||
@@ -102,4 +100,4 @@
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</Material>
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { onMount } from 'svelte'
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
@@ -13,7 +12,7 @@
|
||||
} from 'lemmy-js-client'
|
||||
import { ChatBubbleOvalLeft, Check, Icon } from 'svelte-hero-icons'
|
||||
import { page } from '$app/stores'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { Material, toast } from 'mono-svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
@@ -90,7 +89,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Card elevation={0} class="flex flex-col rounded-md p-5 max-w-full gap-2">
|
||||
<Material padding="lg" class="flex flex-col max-w-full gap-2">
|
||||
{#if !isPrivateMessage(item)}
|
||||
<PostMeta
|
||||
published={new Date(item.post.published)}
|
||||
@@ -192,4 +191,4 @@
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</Card>
|
||||
</Material>
|
||||
@@ -1,15 +1,13 @@
|
||||
<script lang="ts">
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import Report from './Report.svelte'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { goto } from '$app/navigation'
|
||||
import { EnvelopeOpen, Icon, Inbox, Newspaper } from 'svelte-hero-icons'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Button, Material } from 'mono-svelte'
|
||||
|
||||
export let data
|
||||
</script>
|
||||
@@ -33,9 +31,7 @@
|
||||
<div class="flex flex-col gap-4">
|
||||
{#each data.items as item}
|
||||
<div in:fly={{ y: -6, opacity: 0, duration: 500 }}>
|
||||
<Card
|
||||
class="p-4 flex flex-col gap-4 text-sm !bg-slate-100 dark:!bg-zinc-950"
|
||||
>
|
||||
<Material class="flex flex-col gap-4 text-sm">
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<span class="text-xs font-bold dark:text-zinc-400 text-slate-600">
|
||||
Report from
|
||||
@@ -46,7 +42,7 @@
|
||||
</div>
|
||||
|
||||
<Report {item} />
|
||||
</Card>
|
||||
</Material>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import { page } from '$app/stores'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import ModlogItemCard from './item/ModlogItemCard.svelte'
|
||||
import ModlogItemTable from './item/ModlogItemTable.svelte'
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { Material } from 'mono-svelte'
|
||||
import type { ModLog } from '../+page.js'
|
||||
import ModlogAction from '../ModlogAction.svelte'
|
||||
|
||||
export let item: ModLog
|
||||
</script>
|
||||
|
||||
<Card elevation={0} class="p-5 flex flex-col gap-2 text-sm">
|
||||
<Material padding="lg" class="flex flex-col gap-2">
|
||||
<div class="flex flex-row justify-between flex-wrap gap-2">
|
||||
{#if item.community}
|
||||
<CommunityLink community={item.community} avatar showInstance />
|
||||
@@ -58,4 +58,4 @@
|
||||
<SectionTitle class="mt-2">Reason</SectionTitle>
|
||||
<p>{item.reason}</p>
|
||||
{/if}
|
||||
</Card>
|
||||
</Material>
|
||||
@@ -9,10 +9,9 @@
|
||||
import { page } from '$app/stores'
|
||||
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
||||
import { ExclamationTriangle, Icon } from 'svelte-hero-icons'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { Spinner, removeToast, toast } from 'mono-svelte'
|
||||
import { Material, Spinner, removeToast, toast } from 'mono-svelte'
|
||||
import type { CommentSortType } from 'lemmy-js-client'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
@@ -112,7 +111,10 @@
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
{#if $page.params.instance.toLowerCase() != $instance.toLowerCase()}
|
||||
<Card cardColor="warning" class="p-4 flex flex-col gap-1">
|
||||
<Material
|
||||
class="p-4 flex flex-col gap-1 border
|
||||
border-yellow-300 dark:bg-yellow-950/30 dark:border-yellow-900 bg-yellow-50"
|
||||
>
|
||||
<Icon
|
||||
src={ExclamationTriangle}
|
||||
width={24}
|
||||
@@ -124,7 +126,7 @@
|
||||
This URL is for a different instance than you're logged into. You
|
||||
probably won't be able to vote or comment.
|
||||
</p>
|
||||
</Card>
|
||||
</Material>
|
||||
{/if}
|
||||
|
||||
<PostMeta
|
||||
@@ -221,7 +223,19 @@
|
||||
</details>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="mt-4 flex flex-col gap-2">
|
||||
{#if data.singleThread}
|
||||
<Material
|
||||
elevation="max"
|
||||
padding="none"
|
||||
color="distinct"
|
||||
class="py-2 px-4 text-sm flex flex-row justify-between items-center
|
||||
flex-wrap gap-4 sticky top-20 w-full box-border z-[100] mt-4"
|
||||
>
|
||||
<p>You're viewing a single thread.</p>
|
||||
<Button on:click={reloadComments}>View full thread</Button>
|
||||
</Material>
|
||||
{/if}
|
||||
<div class="mt-4 flex flex-col gap-2 w-full">
|
||||
<div class="flex flex-row justify-between">
|
||||
<div class="font-bold opacity-80 text-base">
|
||||
Comments <span class="text-lg font-medium ml-2">
|
||||
@@ -235,12 +249,6 @@
|
||||
headless
|
||||
/>
|
||||
</div>
|
||||
{#if data.singleThread}
|
||||
<Card class="py-2 px-4 text-sm flex flex-row items-center flex-wrap gap-4">
|
||||
<p>You're viewing a single thread.</p>
|
||||
<Button on:click={reloadComments}>View full thread</Button>
|
||||
</Card>
|
||||
{/if}
|
||||
{#await data.streamed.comments}
|
||||
<div class="h-16 mx-auto grid place-items-center">
|
||||
<Spinner width={24} />
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
import { profile, profileData, setUserID } from '$lib/auth.js'
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { removeToast, toast } from 'mono-svelte'
|
||||
import { Material, removeToast, toast } from 'mono-svelte'
|
||||
import { getClient, uploadImage } from '$lib/lemmy.js'
|
||||
import type { SaveUserSettings } from 'lemmy-js-client'
|
||||
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
|
||||
@@ -187,9 +186,7 @@
|
||||
Save
|
||||
</Button>
|
||||
{:else}
|
||||
<Card cardColor="warning" class="p-5">
|
||||
The API didn't return your user settings.
|
||||
</Card>
|
||||
<Material padding="lg">The API didn't return your user settings.</Material>
|
||||
{/if}
|
||||
<Button
|
||||
on:click={() => deleteAccount(0)}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<script lang="ts">
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import { fly } from 'svelte/transition'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Button, Material } from 'mono-svelte'
|
||||
|
||||
export let data
|
||||
|
||||
@@ -27,7 +26,7 @@
|
||||
{#each data.data as item, index}
|
||||
<div in:fly={{ opacity: 0, y: -4, delay: index * 50 }}>
|
||||
{#if isComment(item)}
|
||||
<Card class="flex flex-col bg-white rounded-md p-5 flex-1">
|
||||
<Material padding="lg" color="distinct" class="flex flex-col flex-1">
|
||||
<div class="flex flex-row items-center">
|
||||
<PostMeta
|
||||
title={item.post.name}
|
||||
@@ -45,7 +44,7 @@
|
||||
<Button class="ml-auto" href="/comment/{item.comment.id}">
|
||||
Jump
|
||||
</Button>
|
||||
</Card>
|
||||
</Material>
|
||||
{:else}
|
||||
<Post post={item} />
|
||||
{/if}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { Material } from 'mono-svelte'
|
||||
</script>
|
||||
|
||||
<Card class="flex flex-col gap-3 p-5 text-sm my-2">
|
||||
<Material padding="lg" class="flex flex-col gap-3 my-2">
|
||||
<h1 class="font-bold"><slot name="title" /></h1>
|
||||
{#if $$slots.description}
|
||||
<p class="text-slate-700 dark:text-zinc-300">
|
||||
@@ -10,4 +10,4 @@
|
||||
</p>
|
||||
{/if}
|
||||
<slot />
|
||||
</Card>
|
||||
</Material>
|
||||
@@ -5,12 +5,11 @@
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Spinner, toast } from 'mono-svelte'
|
||||
import { Material, Spinner, toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { GetCaptchaResponse } from 'lemmy-js-client'
|
||||
import { Button, TextArea, TextInput } from 'mono-svelte'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
import {
|
||||
ArrowPath,
|
||||
ExclamationCircle,
|
||||
@@ -131,14 +130,11 @@
|
||||
type="password"
|
||||
/>
|
||||
{#if data.site_view.local_site.registration_mode == 'RequireApplication'}
|
||||
<Card
|
||||
class="p-4 dark:text-yellow-200 text-yellow-800"
|
||||
cardColor="warning"
|
||||
>
|
||||
<Material class="dark:text-yellow-200 text-yellow-800 bg-yellow-500/20">
|
||||
<Icon src={ExclamationTriangle} mini size="20" />
|
||||
To join this instance, you need to fill out this application, and wait to
|
||||
be accepted.
|
||||
</Card>
|
||||
</Material>
|
||||
{#if data.site_view.local_site.application_question}
|
||||
<Markdown source={data.site_view.local_site.application_question} />
|
||||
{/if}
|
||||
@@ -164,16 +160,21 @@
|
||||
/>
|
||||
<audio controls src={captchaAudio} />
|
||||
{:else}
|
||||
<Card cardColor="warning" class="p-3 flex gap-2">
|
||||
<Material
|
||||
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
|
||||
>
|
||||
<Icon src={QuestionMarkCircle} mini size="24" />
|
||||
No captcha was returned
|
||||
</Card>
|
||||
</Material>
|
||||
{/if}
|
||||
{:catch err}
|
||||
<Card cardColor="error" class="p-3 flex gap-2">
|
||||
<Material
|
||||
padding="sm"
|
||||
class="flex gap-2 dark:text-yellow-200 text-yellow-800 bg-yellow-500/20"
|
||||
>
|
||||
<Icon src={ExclamationCircle} mini size="24" />
|
||||
{err}
|
||||
</Card>
|
||||
</Material>
|
||||
{/await}
|
||||
<Button on:click={() => getCaptcha()} size="square-md">
|
||||
<Icon src={ArrowPath} size="16" mini />
|
||||
|
||||
Reference in new issue
Block a user