switch to mono-svelte Button component
This commit is contained in:
1 parent
c4a1f143cb
commit
d02d8556d5
61 files changed
+298
-348
No files matched your search
@@ -1,163 +0,0 @@
|
||||
<script lang="ts">
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
|
||||
type ButtonColor = keyof typeof buttonColor
|
||||
type ButtonSize = keyof typeof buttonSize
|
||||
type ButtonRoundness = keyof typeof buttonRoundness
|
||||
type ButtonAlignment = keyof typeof buttonAlignment
|
||||
|
||||
const buttonAlignment = {
|
||||
left: 'justify-start text-left',
|
||||
center: 'justify-center text-center',
|
||||
right: 'justify-end text-right',
|
||||
}
|
||||
|
||||
const buttonColor = {
|
||||
primary: `border border-slate-900 bg-slate-900 dark:bg-zinc-100
|
||||
dark:border-zinc-100 dark:text-black hover:text-inherit hover:dark:text-inherit text-slate-100
|
||||
hover:bg-transparent hover:dark:bg-transparent
|
||||
active:bg-black/10 active:dark:bg-white/10`,
|
||||
|
||||
secondary: `border border-slate-200 dark:border-zinc-700 dark:bg-zinc-900
|
||||
hover:bg-slate-100 hover:dark:bg-zinc-800 hover:dark:border-zinc-700 dark:text-zinc-400 hover:text-inherit
|
||||
hover:dark:text-inherit`,
|
||||
|
||||
tertiary:
|
||||
'border border-transparent bg-transparent hover:bg-slate-100 hover:dark:bg-zinc-800 dark:text-zinc-200',
|
||||
|
||||
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 bg-transparent
|
||||
hover:bg-slate-100 hover:dark:bg-zinc-800 hover:dark:border-zinc-700 dark:text-zinc-400 hover:text-inherit
|
||||
hover:dark:text-inherit`,
|
||||
|
||||
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`,
|
||||
|
||||
elevatedLow: `bg-slate-100 dark:bg-zinc-900 border border-slate-200
|
||||
dark:border-zinc-800 hover:bg-slate-200 hover:dark:bg-zinc-800 hover:border-slate-300
|
||||
hover:dark:border-zinc-700`,
|
||||
|
||||
none: '',
|
||||
}
|
||||
|
||||
const buttonSize = {
|
||||
sm: 'px-2 py-1',
|
||||
md: 'px-3 py-1.5',
|
||||
lg: 'px-4 py-2',
|
||||
'square-sm': 'w-6 h-6',
|
||||
'square-md': 'w-8 h-8',
|
||||
'square-lg': 'w-10 h-10',
|
||||
}
|
||||
|
||||
const buttonRoundness = {
|
||||
pill: 'rounded-full',
|
||||
lg: 'rounded-lg',
|
||||
md: 'rounded-md',
|
||||
none: '',
|
||||
}
|
||||
|
||||
export let loading = false
|
||||
export let submit = false
|
||||
|
||||
export let color: ButtonColor = 'secondary'
|
||||
export let size: ButtonSize = 'md'
|
||||
export let rounded: ButtonRoundness = 'md'
|
||||
export let alignment: ButtonAlignment = 'center'
|
||||
export let icon: IconSource | undefined = undefined
|
||||
|
||||
export let loaderWidth: number | undefined = undefined
|
||||
|
||||
// const dispatch = createEventDispatcher()
|
||||
export let href: string | undefined = undefined
|
||||
</script>
|
||||
|
||||
{#if href}
|
||||
<a
|
||||
{href}
|
||||
on:click
|
||||
{...$$restProps}
|
||||
class="
|
||||
{buttonColor[color]}
|
||||
{buttonSize[size]}
|
||||
{buttonRoundness[rounded]}
|
||||
text-sm transition-colors disabled:!opacity-70 disabled:!pointer-events-none
|
||||
disabled:!border disabled:!border-slate-300 disabled:!bg-slate-200 disabled:dark:!border-zinc-700 disabled:dark:!bg-zinc-800
|
||||
{$$props.class}
|
||||
{loading
|
||||
? color == 'primary'
|
||||
? '!bg-transparent !text-inherit'
|
||||
: ''
|
||||
: ''}"
|
||||
>
|
||||
<div
|
||||
class="flex flex-row items-center gap-1.5 h-full {buttonAlignment[
|
||||
alignment
|
||||
]}"
|
||||
>
|
||||
{#if loading}
|
||||
<Spinner
|
||||
width={loaderWidth
|
||||
? loaderWidth
|
||||
: size == 'lg'
|
||||
? 20
|
||||
: size == 'md'
|
||||
? 18
|
||||
: size == 'sm'
|
||||
? 16
|
||||
: 16}
|
||||
/>
|
||||
{:else if $$slots.icon}
|
||||
<slot name="icon" />
|
||||
{:else if icon}
|
||||
<Icon src={icon} size="16" mini />
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
</a>
|
||||
{:else}
|
||||
<button
|
||||
{...$$restProps}
|
||||
on:click
|
||||
class="
|
||||
{buttonColor[color]}
|
||||
{buttonSize[size]}
|
||||
{buttonRoundness[rounded]}
|
||||
text-sm transition-colors disabled:!opacity-70 disabled:!pointer-events-none
|
||||
disabled:!border disabled:!border-slate-300 disabled:!bg-slate-200
|
||||
disabled:dark:!border-zinc-700 disabled:dark:!bg-zinc-800 disabled:text-inherit
|
||||
{$$props.class}
|
||||
{loading
|
||||
? color == 'primary'
|
||||
? '!bg-transparent !text-inherit'
|
||||
: ''
|
||||
: ''}"
|
||||
type={submit ? 'submit' : 'button'}
|
||||
>
|
||||
<div
|
||||
class="flex flex-row items-center gap-1.5 {buttonAlignment[alignment]}"
|
||||
>
|
||||
{#if loading}
|
||||
<Spinner
|
||||
width={loaderWidth
|
||||
? loaderWidth
|
||||
: size == 'lg'
|
||||
? 20
|
||||
: size == 'md'
|
||||
? 18
|
||||
: size == 'sm'
|
||||
? 16
|
||||
: 16}
|
||||
/>
|
||||
{:else if $$slots.icon}
|
||||
<slot name="icon" />
|
||||
{:else if icon}
|
||||
<Icon src={icon} size="16" mini />
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
</button>
|
||||
{/if}
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { ChevronDown, Icon } from 'svelte-hero-icons'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
type T = $$Generic
|
||||
export let options: T[]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import type { Alignment } from '$lib/components/ui/menu/menu.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
type T = $$Generic
|
||||
@@ -23,7 +22,7 @@
|
||||
<div class="block font-bold text-sm w-max">{label}</div>
|
||||
{/if}
|
||||
<Menu let:toggleOpen {alignment}>
|
||||
<div slot="button" class="w-max relative">
|
||||
<div let:toggleOpen slot="button" class="w-max relative">
|
||||
<Button on:click={toggleOpen} color="secondary">
|
||||
<slot>
|
||||
{optionNames[options.findIndex((o) => selected == o)] || selected}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
export let showWhenEmpty: boolean = false
|
||||
let showNone: boolean = false
|
||||
|
||||
const dispatcher = createEventDispatcher<{ select: Community }>()
|
||||
const dispatcher = createEventDispatcher<{ select: Community | undefined }>()
|
||||
</script>
|
||||
|
||||
{#if type == 'community'}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import StickyCard from '$lib/components/ui/StickyCard.svelte'
|
||||
@@ -7,6 +6,7 @@
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { SiteView, Tagline } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import {
|
||||
Calendar,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { slide } from 'svelte/transition'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let node: CommentNodeI
|
||||
export let postId: number
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { isCommentMutable } from '$lib/components/lemmy/post/helpers.js'
|
||||
import {
|
||||
@@ -33,6 +32,7 @@
|
||||
import CommentModerationMenu from '$lib/components/lemmy/moderation/CommentModerationMenu.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { deleteItem, save } from '$lib/lemmy/contentview.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let comment: CommentView
|
||||
export let replying: boolean = false
|
||||
@@ -58,15 +58,22 @@
|
||||
{#if $profile?.user && (amMod($profile?.user, comment.community) || isAdmin($profile.user))}
|
||||
<CommentModerationMenu bind:item={comment} />
|
||||
{/if}
|
||||
<Menu let:toggleOpen class="top-0 leading-3" alignment="bottom-center">
|
||||
<Menu class="top-0 leading-3" alignment="bottom-center">
|
||||
<Button
|
||||
let:toggleOpen
|
||||
slot="button"
|
||||
on:click={toggleOpen}
|
||||
class="!p-1"
|
||||
aria-label="Comment actions"
|
||||
color="ghost"
|
||||
>
|
||||
<Icon src={EllipsisHorizontal} width={16} height={16} mini slot="icon" />
|
||||
<Icon
|
||||
src={EllipsisHorizontal}
|
||||
width={16}
|
||||
height={16}
|
||||
mini
|
||||
slot="prefix"
|
||||
/>
|
||||
</Button>
|
||||
<span class="text-xs opacity-80 py-1 my-1 px-4">Comment actions</span>
|
||||
<MenuButton
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import type { CommentResponse } from 'lemmy-js-client'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
@@ -11,6 +10,7 @@
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { placeholders } from '$lib/util.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let postId: number
|
||||
export let parentId: number | undefined = undefined
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
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'
|
||||
|
||||
export let comment: CommentView
|
||||
</script>
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
import { getClient } from '$lib/lemmy'
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let vote: number = 0
|
||||
export let score: number
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
import { buildCommentsTree, type CommentNodeI } from './comments'
|
||||
import { page } from '$app/stores'
|
||||
import { onMount, setContext } from 'svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { ChevronDown, Icon, Plus, PlusCircle } from 'svelte-hero-icons'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommentView, Post } from 'lemmy-js-client'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let nodes: CommentNodeI[]
|
||||
export let isParent: boolean
|
||||
@@ -131,7 +131,7 @@
|
||||
fetchChildren(node).then(() => (node.loading = false))
|
||||
}}
|
||||
>
|
||||
<Icon src={Plus} width={18} mini slot="icon" />
|
||||
<Icon src={Plus} width={18} mini slot="prefix" />
|
||||
{node.comment_view.counts.child_count} more
|
||||
</Button>
|
||||
</button>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
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'
|
||||
@@ -13,6 +12,7 @@
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import { fullCommunityName } from '$lib/util.js'
|
||||
import type { CommunityView } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import {
|
||||
Calendar,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
@@ -117,7 +117,7 @@
|
||||
size="lg"
|
||||
disabled={community_view.community.posting_restricted_to_mods}
|
||||
>
|
||||
<Icon src={PencilSquare} mini size="16" slot="icon" />
|
||||
<Icon src={PencilSquare} mini size="16" slot="prefix" />
|
||||
Create Post
|
||||
</Button>
|
||||
<Button
|
||||
@@ -131,7 +131,7 @@
|
||||
src={community_view.subscribed == 'Subscribed' ? Minus : Plus}
|
||||
mini
|
||||
size="16"
|
||||
slot="icon"
|
||||
slot="prefix"
|
||||
/>
|
||||
{community_view.subscribed == 'Subscribed' ||
|
||||
community_view.subscribed == 'Pending'
|
||||
@@ -156,7 +156,7 @@
|
||||
)}/settings"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon src={Cog6Tooth} mini size="16" slot="icon" />
|
||||
<Icon src={Cog6Tooth} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Checkbox from '$lib/components/input/Checkbox.svelte'
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||
@@ -10,6 +9,7 @@
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { getClient, uploadImage } from '$lib/lemmy.js'
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
/**
|
||||
* The community ID to edit.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import type { CommunityView } from 'lemmy-js-client'
|
||||
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
||||
@@ -10,6 +9,7 @@
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let community: CommunityView
|
||||
</script>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { uploadImage } from '$lib/lemmy.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
export let open: boolean
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||
import UserItem from '$lib/components/lemmy/user/UserItem.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
@@ -10,6 +9,7 @@
|
||||
import TextInput from '$lib/components/input/TextInput.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Checkbox from '$lib/components/input/Checkbox.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let open = false
|
||||
let item: Person | undefined
|
||||
|
||||
@@ -8,19 +8,20 @@
|
||||
} from 'lemmy-js-client'
|
||||
import { amMod, ban, isAdmin, remove } from './moderation'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import { Fire, Icon, ShieldExclamation, Trash } from 'svelte-hero-icons'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import { isCommentView } from '$lib/lemmy/item.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let item: PostView | CommentView
|
||||
</script>
|
||||
|
||||
<Menu let:toggleOpen alignment="bottom-center" class="top-0 h-[26px] w-[26px] ">
|
||||
<Menu alignment="bottom-center" class="top-0 h-[26px] w-[26px] ">
|
||||
<Button
|
||||
let:toggleOpen
|
||||
class="w-[26px] h-[26px] hover:!text-green-500 dark:text-zinc-400 text-slate-600"
|
||||
size="square-md"
|
||||
on:click={toggleOpen}
|
||||
@@ -32,7 +33,9 @@
|
||||
</Button>
|
||||
{#if ($profile?.user && amMod($profile.user, item.community)) || ($profile?.user && isAdmin($profile.user))}
|
||||
<li class="px-4 py-1 my-1 text-xs text-slate-600 dark:text-zinc-400">
|
||||
Moderation {#if (!item.community.local && !amMod($profile.user, item.community)) } (Instance Only) {/if}
|
||||
Moderation {#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
(Instance Only)
|
||||
{/if}
|
||||
</li>
|
||||
<MenuButton color="success" on:click={() => remove(item)}>
|
||||
<Icon src={Trash} size="16" mini />
|
||||
@@ -44,7 +47,9 @@
|
||||
</MenuButton>
|
||||
{#if $profile?.user && $profile.user?.local_user_view.person.id != item.creator.id}
|
||||
<span class="px-4 py-1 my-1 text-xs text-slate-600 dark:text-zinc-400">
|
||||
User {#if (!item.community.local && !amMod($profile.user, item.community)) } (Instance Only) {/if}
|
||||
User {#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
(Instance Only)
|
||||
{/if}
|
||||
</span>
|
||||
<MenuButton
|
||||
color="dangerSecondary"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import type { CommentView, Community, PostView } from 'lemmy-js-client'
|
||||
import { amMod, ban, isAdmin, remove } from './moderation'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import {
|
||||
Fire,
|
||||
@@ -19,6 +18,7 @@
|
||||
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let item: PostView | CommentView
|
||||
|
||||
@@ -88,8 +88,9 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Menu let:toggleOpen alignment="bottom-right">
|
||||
<Menu alignment="bottom-right">
|
||||
<Button
|
||||
let:toggleOpen
|
||||
class="hover:text-green-500 dark:text-zinc-400 text-slate-500"
|
||||
on:click={toggleOpen}
|
||||
slot="button"
|
||||
@@ -103,7 +104,7 @@
|
||||
viewBox="0 0 20 22"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
slot="icon"
|
||||
slot="prefix"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
@@ -115,7 +116,9 @@
|
||||
</Button>
|
||||
{#if ($profile?.user && amMod($profile.user, item.community)) || ($profile?.user && isAdmin($profile.user))}
|
||||
<span class="px-4 py-1 my-1 text-xs text-slate-600 dark:text-zinc-400">
|
||||
Moderation {#if !item.community.local && !amMod($profile.user, item.community)} (Instance Only) {/if}
|
||||
Moderation {#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
(Instance Only)
|
||||
{/if}
|
||||
</span>
|
||||
<MenuButton
|
||||
color="warning"
|
||||
@@ -159,7 +162,9 @@
|
||||
</MenuButton>
|
||||
{#if $profile?.user && $profile.user.local_user_view.person.id != item.creator.id}
|
||||
<span class="px-4 py-1 my-1 text-xs text-slate-600 dark:text-zinc-400">
|
||||
User {#if !item.community.local && !amMod($profile.user, item.community)} (Instance Only) {/if}
|
||||
User {#if !item.community.local && !amMod($profile.user, item.community)}
|
||||
(Instance Only)
|
||||
{/if}
|
||||
</span>
|
||||
<MenuButton
|
||||
color="dangerSecondary"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
@@ -17,6 +16,7 @@
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { fullCommunityName } from '$lib/util.js'
|
||||
import { amMod, isAdmin } from './moderation'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let open: boolean
|
||||
export let item: PostView | CommentView | undefined = undefined
|
||||
@@ -202,7 +202,7 @@
|
||||
bind:value={reason}
|
||||
/>
|
||||
|
||||
{#if !removed && ( amMod($profile.user, item.community) || (isAdmin($profile.user) && item.community.local))}
|
||||
{#if !removed && $profile?.user && ( amMod($profile.user, item.community) || (isAdmin($profile.user) && item.community.local))}
|
||||
<Checkbox bind:checked={commentReason}>Reply with reason</Checkbox>
|
||||
|
||||
{#if commentReason}
|
||||
@@ -227,7 +227,7 @@
|
||||
disabled={loading}
|
||||
submit
|
||||
>
|
||||
<Icon src={purge ? Fire : Trash} mini size="16" slot="icon" />
|
||||
<Icon src={purge ? Fire : Trash} mini size="16" slot="prefix" />
|
||||
{#if purge}
|
||||
Purge
|
||||
{:else}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
@@ -8,6 +7,7 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let open: boolean
|
||||
export let item: PostView | CommentView | undefined = undefined
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
@@ -37,6 +36,7 @@
|
||||
import { setSessionStorage } from '$lib/session.js'
|
||||
import { goto } from '$app/navigation'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let post: PostView
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
class="!text-inherit h-8 px-3"
|
||||
>
|
||||
<Icon
|
||||
slot="icon"
|
||||
slot="prefix"
|
||||
src={ChatBubbleOvalLeftEllipsis}
|
||||
mini
|
||||
width={16}
|
||||
@@ -102,25 +102,22 @@
|
||||
{/await}
|
||||
{/if}
|
||||
<Button on:click={() => (debug = true)} size="square-md">
|
||||
<Icon src={BugAnt} mini size="16" slot="icon" />
|
||||
<Icon src={BugAnt} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
{/if}
|
||||
{#if $profile?.user && (amMod($profile.user, post.community) || isAdmin($profile.user))}
|
||||
<ModerationMenu bind:item={post} community={post.community} />
|
||||
{/if}
|
||||
<Menu
|
||||
alignment="bottom-right"
|
||||
containerClass="overflow-auto max-h-[400px]"
|
||||
let:toggleOpen
|
||||
>
|
||||
<Menu alignment="bottom-right" containerClass="overflow-auto max-h-[400px]">
|
||||
<Button
|
||||
let:toggleOpen
|
||||
slot="button"
|
||||
aria-label="Post actions"
|
||||
on:click={toggleOpen}
|
||||
class="hover:text-inherit"
|
||||
size="square-md"
|
||||
>
|
||||
<Icon slot="icon" src={EllipsisHorizontal} width={16} mini />
|
||||
<Icon slot="prefix" src={EllipsisHorizontal} width={16} mini />
|
||||
</Button>
|
||||
<li class="mx-4 text-xs opacity-80 text-left my-1 py-1">Creator</li>
|
||||
<MenuButton
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import type { PostView } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { ArchiveBox, Icon, Plus } from 'svelte-hero-icons'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
description="There are no posts that match this filter."
|
||||
>
|
||||
<Button href="/communities">
|
||||
<Icon src={Plus} size="16" mini slot="icon" />
|
||||
<Icon src={Plus} size="16" mini slot="prefix" />
|
||||
<span>Follow some communities</span>
|
||||
</Button>
|
||||
</Placeholder>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import TextInput from '$lib/components/input/TextInput.svelte'
|
||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import SearchInput from '$lib/components/input/SearchInput.svelte'
|
||||
import { Check, Icon, Photo } from 'svelte-hero-icons'
|
||||
@@ -16,6 +15,7 @@
|
||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let edit = false
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
on:click={() => (uploadingImage = !uploadingImage)}
|
||||
style="width: 46px !important; height: 42px; padding: 0;"
|
||||
>
|
||||
<Icon src={Photo} size="18" mini slot="icon" />
|
||||
<Icon src={Photo} size="18" mini slot="prefix" />
|
||||
</Button>
|
||||
</div>
|
||||
<MarkdownEditor
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import { getClient } from '$lib/lemmy'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
@@ -14,6 +13,7 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { vote as voteItem } from '$lib/lemmy/contentview.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let post: Post
|
||||
export let vote: number = 0
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||
@@ -9,6 +8,7 @@
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { uploadImage } from '$lib/lemmy.js'
|
||||
import type { Community, Person } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import {
|
||||
CodeBracket,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { profile, profileData, setUserID } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
|
||||
import {
|
||||
@@ -15,6 +14,7 @@
|
||||
import { LINKED_INSTANCE_URL, instance } from '$lib/instance.js'
|
||||
import { site } from '$lib/lemmy.js'
|
||||
import { theme } from '$lib/ui/colors.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import {
|
||||
ArrowLeftOnRectangle,
|
||||
Bars3,
|
||||
@@ -97,7 +97,7 @@
|
||||
dark:text-zinc-300 text-slate-700 hover:text-inherit hover:dark:text-inherit
|
||||
hover:bg-slate-200 relative hover:border-slate-300"
|
||||
>
|
||||
<Icon src={CommandLine} mini size="16" slot="icon" />
|
||||
<Icon src={CommandLine} mini size="16" slot="prefix" />
|
||||
<span class="hidden md:inline">Admin</span>
|
||||
</Button>
|
||||
{/if}
|
||||
@@ -123,7 +123,7 @@
|
||||
class="max-md:w-9 max-md:h-8 max-md:!p-0
|
||||
dark:text-zinc-300 text-slate-700 hover:text-inherit hover:dark:text-inherit hover:bg-slate-200 hover:border-slate-300"
|
||||
>
|
||||
<Icon mini src={MagnifyingGlass} width={16} slot="icon" />
|
||||
<Icon mini src={MagnifyingGlass} width={16} slot="prefix" />
|
||||
<span class="hidden md:inline">Search</span>
|
||||
</Button>
|
||||
<Button
|
||||
@@ -133,18 +133,19 @@
|
||||
dark:text-zinc-300 text-slate-700 hover:text-inherit
|
||||
hover:dark:text-inherit hover:bg-slate-200 hover:border-slate-300"
|
||||
>
|
||||
<Icon mini src={GlobeAlt} size="16" slot="icon" />
|
||||
<Icon mini src={GlobeAlt} size="16" slot="prefix" />
|
||||
<span class="hidden md:inline">Explore</span>
|
||||
</Button>
|
||||
<Menu let:toggleOpen alignment="bottom-right">
|
||||
<Menu alignment="bottom-right">
|
||||
<Button
|
||||
let:toggleOpen
|
||||
color="primary"
|
||||
slot="button"
|
||||
aria-label="Create"
|
||||
on:click={toggleOpen}
|
||||
class="max-md:w-9 max-md:h-8 max-md:!p-0"
|
||||
>
|
||||
<Icon src={Plus} width={18} mini slot="icon" />
|
||||
<Icon src={Plus} width={18} mini slot="prefix" />
|
||||
<span class="hidden md:inline">Create</span>
|
||||
</Button>
|
||||
<li class="text-xs opacity-80 text-left mx-4 my-1 py-1">Create</li>
|
||||
@@ -175,7 +176,6 @@
|
||||
</Menu>
|
||||
</div>
|
||||
<Menu
|
||||
let:toggleOpen
|
||||
alignment="bottom-right"
|
||||
itemsClass="h-8 md:h-8"
|
||||
containerClass="!max-h-[28rem]"
|
||||
@@ -185,6 +185,7 @@
|
||||
dark:bg-zinc-800 relative"
|
||||
aria-label="Profile"
|
||||
slot="button"
|
||||
let:toggleOpen
|
||||
on:click={toggleOpen}
|
||||
>
|
||||
{#if $profile?.user}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
export let page: number
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
const buttonColors = {
|
||||
secondary:
|
||||
'hover:bg-neutral-200/50 hover:dark:bg-zinc-600/20 text-slate-800 fill-slate-800 dark:text-zinc-200 dark:fill-zinc-200',
|
||||
'hover:bg-gray-200/50 hover:dark:bg-zinc-600/20 text-slate-800 fill-slate-800 dark:text-zinc-200 dark:fill-zinc-200',
|
||||
dangerSecondary: 'hover:bg-red-500 text-red-500 hover:text-white',
|
||||
success:
|
||||
'hover:bg-green-600 text-green-600 dark:text-green-500 hover:text-white hover:dark:text-white',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { Icon, XMark } from 'svelte-hero-icons'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import type { Community } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { slide } from 'svelte/transition'
|
||||
@@ -27,7 +27,7 @@
|
||||
alt={follow.name}
|
||||
title={follow.title}
|
||||
width={20}
|
||||
slot="icon"
|
||||
slot="prefix"
|
||||
/>
|
||||
</div>
|
||||
<span class="max-w-full break-words" class:hidden={!expanded}>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { profile, setUserID, type Profile } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let expanded: boolean = false
|
||||
export let prof: Profile
|
||||
@@ -41,7 +41,7 @@
|
||||
profile={prof}
|
||||
{index}
|
||||
selected={$profile?.id == prof.id}
|
||||
slot="icon"
|
||||
slot="prefix"
|
||||
/>
|
||||
<span class:hidden={!expanded} class="flex flex-col gap-0">
|
||||
{prof.username ?? prof.user?.local_user_view.person.name}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
Icon,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import Button from '../../input/Button.svelte'
|
||||
import { profile, profileData } from '$lib/auth.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
@@ -16,6 +15,7 @@
|
||||
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { Button } from 'mono-svelte'
|
||||
</script>
|
||||
|
||||
<nav
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
export let expanded: boolean
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import {
|
||||
type Toast,
|
||||
|
||||
Reference in new issue
Block a user