mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
style: improve comments overall styling
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
import { escapeHtml } from '$lib/utils/html';
|
import { escapeHtml } from '$lib/utils/html';
|
||||||
import { user } from '$lib/stores/user';
|
import { user } from '$lib/stores/user';
|
||||||
import PasteCommentItem from '$lib/components/PasteCommentItem.svelte';
|
import PasteCommentItem from '$lib/components/PasteCommentItem.svelte';
|
||||||
import { ThumbsUp, ThumbsDown, Trash2, Shredder } from '@lucide/svelte';
|
import { ThumbsUp, ThumbsDown, Trash2, Shredder, Reply, Quote } from '@lucide/svelte';
|
||||||
import { resolve } from '$app/paths';
|
import { resolve } from '$app/paths';
|
||||||
import RichTextEditor from './RichTextEditor.svelte';
|
import RichTextEditor from './RichTextEditor.svelte';
|
||||||
import { hasRole, roles } from '$lib/utils/auth';
|
import { hasRole, roles } from '$lib/utils/auth';
|
||||||
@@ -93,9 +93,9 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="p-3">
|
<div class="rounded border border-transparent p-3">
|
||||||
<div class="mb-2 flex items-center justify-between gap-3 text-xs text-neutral-400">
|
<div class="mb-2 flex items-center justify-between gap-3 text-xs text-neutral-400">
|
||||||
<div class="flex min-w-0 items-center gap-2 text-lg">
|
<div class="flex min-w-0 items-center gap-2 text-sm">
|
||||||
{#if node.author}
|
{#if node.author}
|
||||||
{#if node.author.isBanned}
|
{#if node.author.isBanned}
|
||||||
<span class="text-red-500">BANNED</span>
|
<span class="text-red-500">BANNED</span>
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if node.updatedAt}
|
{#if node.updatedAt}
|
||||||
<span
|
<span
|
||||||
class="text-sm text-neutral-500"
|
class="text-xs text-neutral-400"
|
||||||
use:tooltip={`Edited on ${new Date(node.updatedAt * 1000).toLocaleString()} • ${dateToRelativeString(new Date(node.updatedAt * 1000), true, true, now, 3)}`}
|
use:tooltip={`Edited on ${new Date(node.updatedAt * 1000).toLocaleString()} • ${dateToRelativeString(new Date(node.updatedAt * 1000), true, true, now, 3)}`}
|
||||||
>edited</span
|
>edited</span
|
||||||
>
|
>
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-sm leading-relaxed text-neutral-200">
|
<div class="text-sm leading-relaxed text-neutral-200">
|
||||||
<div class="wrap-break-word" class:italic={isDeleted} class:text-neutral-800={isDeleted}>
|
<div class="wrap-break-word" class:italic={isDeleted} class:text-neutral-500={isDeleted}>
|
||||||
{#if expanded || !isLongComment}
|
{#if expanded || !isLongComment}
|
||||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||||
{@html parsedHtml}
|
{@html parsedHtml}
|
||||||
@@ -151,54 +151,53 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3 flex flex-wrap items-center gap-2">
|
<div class="mt-3 flex flex-wrap items-center gap-1.5">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="h-7 min-w-12 rounded border px-2 py-1 text-xs {node.userReaction !== 1
|
class="flex h-7 min-w-10 items-center justify-center gap-1 rounded px-2 text-xs {node.userReaction !==
|
||||||
? 'hover:bg-neutral-800 active:bg-neutral-700'
|
1
|
||||||
: 'hover:bg-green-800 active:bg-green-700'} disabled:cursor-not-allowed disabled:hover:bg-transparent"
|
? 'text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 active:bg-neutral-600'
|
||||||
|
: 'bg-green-950 text-green-200 hover:bg-green-900 active:bg-green-800'} disabled:cursor-not-allowed disabled:hover:bg-transparent"
|
||||||
class:border-green-700={node.userReaction === 1}
|
class:border-green-700={node.userReaction === 1}
|
||||||
class:bg-green-900={node.userReaction === 1}
|
|
||||||
class:text-green-200={node.userReaction === 1}
|
|
||||||
class:border-neutral-700={node.userReaction !== 1}
|
|
||||||
class:text-neutral-300={node.userReaction !== 1}
|
|
||||||
onclick={() => onReact(node.id, 1, node.userReaction)}
|
onclick={() => onReact(node.id, 1, node.userReaction)}
|
||||||
disabled={reactingIds[node.id] || !$user}
|
disabled={reactingIds[node.id] || !$user}
|
||||||
|
aria-label="Like comment"
|
||||||
|
title="Like"
|
||||||
>
|
>
|
||||||
<ThumbsUp class="mr-1 inline h-3.5 w-3.5" />
|
<ThumbsUp class="h-3.5 w-3.5" />
|
||||||
{node.likes}
|
{node.likes}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="h-7 min-w-12 rounded border px-2 py-1 text-xs {node.userReaction !== 2
|
class="flex h-7 min-w-10 items-center justify-center gap-1 rounded px-2 text-xs {node.userReaction !==
|
||||||
? 'hover:bg-neutral-800 active:bg-neutral-700'
|
2
|
||||||
: 'hover:bg-red-800 active:bg-red-700'} disabled:cursor-not-allowed disabled:hover:bg-transparent"
|
? 'text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 active:bg-neutral-600'
|
||||||
|
: 'bg-red-950 text-red-200 hover:bg-red-900 active:bg-red-800'} disabled:cursor-not-allowed disabled:hover:bg-transparent"
|
||||||
class:border-red-700={node.userReaction === 2}
|
class:border-red-700={node.userReaction === 2}
|
||||||
class:bg-red-900={node.userReaction === 2}
|
|
||||||
class:text-red-200={node.userReaction === 2}
|
|
||||||
class:border-neutral-700={node.userReaction !== 2}
|
|
||||||
class:text-neutral-300={node.userReaction !== 2}
|
|
||||||
onclick={() => onReact(node.id, 2, node.userReaction)}
|
onclick={() => onReact(node.id, 2, node.userReaction)}
|
||||||
disabled={reactingIds[node.id] || !$user}
|
disabled={reactingIds[node.id] || !$user}
|
||||||
|
aria-label="Dislike comment"
|
||||||
|
title="Dislike"
|
||||||
>
|
>
|
||||||
<ThumbsDown class="mr-1 inline h-3.5 w-3.5" />
|
<ThumbsDown class="h-3.5 w-3.5" />
|
||||||
{node.dislikes}
|
{node.dislikes}
|
||||||
</button>
|
</button>
|
||||||
{#if $user}
|
{#if $user}
|
||||||
{#if !replyOpen}
|
{#if !replyOpen}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="h-7 min-w-12 rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100 active:bg-neutral-700"
|
class="flex h-7 items-center gap-1 rounded px-2 text-xs text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 active:bg-neutral-600"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
openReply(node.content ? `> ${node.content.replace(/\n/g, '\n> ')}\n\n` : '');
|
openReply(node.content ? `> ${node.content.replace(/\n/g, '\n> ')}\n\n` : '');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Quote class="h-3.5 w-3.5" />
|
||||||
Quote
|
Quote
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="h-7 min-w-12 rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100 active:bg-neutral-700"
|
class="flex h-7 items-center gap-1 rounded px-2 text-xs text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 active:bg-neutral-600"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
if (replyOpen) {
|
if (replyOpen) {
|
||||||
replyOpen = false;
|
replyOpen = false;
|
||||||
@@ -209,26 +208,31 @@
|
|||||||
openReply('');
|
openReply('');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Reply class="h-3.5 w-3.5" />
|
||||||
{replyOpen ? 'Cancel' : 'Reply'}
|
{replyOpen ? 'Cancel' : 'Reply'}
|
||||||
</button>
|
</button>
|
||||||
{#if node.author?.uuid === $user.uuid || hasRole($user.roles, 4) || hasRole($user.roles, 2)}
|
{#if node.author?.uuid === $user.uuid || hasRole($user.roles, 4) || hasRole($user.roles, 2)}
|
||||||
<div class="ml-auto">
|
<div class="ml-auto flex items-center gap-1">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="h-7 rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100 active:bg-neutral-700"
|
class="flex h-7 w-7 items-center justify-center rounded text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 active:bg-neutral-600"
|
||||||
onclick={() => handleDelete(false)}
|
onclick={() => handleDelete(false)}
|
||||||
disabled={deleting}
|
disabled={deleting}
|
||||||
|
aria-label="Delete comment"
|
||||||
|
title="Delete"
|
||||||
>
|
>
|
||||||
<Trash2 class="inline h-3.5 w-3.5" />
|
<Trash2 class="h-3.5 w-3.5" />
|
||||||
</button>
|
</button>
|
||||||
{#if hasRole($user.roles, roles.Moderator) || hasRole($user.roles, roles.Admin)}
|
{#if hasRole($user.roles, roles.Moderator) || hasRole($user.roles, roles.Admin)}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="h-7 rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100 active:bg-neutral-700"
|
class="flex h-7 w-7 items-center justify-center rounded text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 active:bg-neutral-600"
|
||||||
onclick={() => handleDelete(true)}
|
onclick={() => handleDelete(true)}
|
||||||
disabled={deleting}
|
disabled={deleting}
|
||||||
|
aria-label="Hard delete comment"
|
||||||
|
title="Hard delete"
|
||||||
>
|
>
|
||||||
<Shredder class="inline h-3.5 w-3.5" />
|
<Shredder class="h-3.5 w-3.5" />
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -245,6 +249,9 @@
|
|||||||
onSubmit={submitReply}
|
onSubmit={submitReply}
|
||||||
disabled={replySubmitting}
|
disabled={replySubmitting}
|
||||||
submitting={replySubmitting}
|
submitting={replySubmitting}
|
||||||
|
submitLabel="Reply"
|
||||||
|
submittingLabel="Replying..."
|
||||||
|
compact
|
||||||
/>
|
/>
|
||||||
{#if replyError}
|
{#if replyError}
|
||||||
<p class="mt-2 text-xs text-red-400">{replyError}</p>
|
<p class="mt-2 text-xs text-red-400">{replyError}</p>
|
||||||
@@ -252,7 +259,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if node.children.length > 0}
|
{#if node.children.length > 0}
|
||||||
<div class="mt-3 border-l border-neutral-800 pl-3">
|
<div class="mt-3 border-l border-neutral-700 pl-3">
|
||||||
{#if depth >= 3 && !showDeepReplies}
|
{#if depth >= 3 && !showDeepReplies}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import { SvelteMap } from 'svelte/reactivity';
|
import { SvelteMap } from 'svelte/reactivity';
|
||||||
import RichTextEditor from './RichTextEditor.svelte';
|
import RichTextEditor from './RichTextEditor.svelte';
|
||||||
import { openModal } from '$lib/stores/modal';
|
import { openModal } from '$lib/stores/modal';
|
||||||
|
import { RefreshCw } from '@lucide/svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
pasteId: string;
|
pasteId: string;
|
||||||
@@ -236,29 +237,41 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section id="comments-section" class="mt-6 rounded border border-neutral-800 p-4">
|
<section id="comments-section" class="mt-6 rounded border border-neutral-700 bg-neutral-900 p-4">
|
||||||
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
|
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||||
<h2 class="text-xl font-semibold text-neutral-100">Comments ({comments.length})</h2>
|
<div class="flex items-center gap-2">
|
||||||
|
<h2 class="text-lg font-semibold text-neutral-100">Comments</h2>
|
||||||
|
<span
|
||||||
|
class="rounded border border-neutral-700 bg-neutral-800 px-2 py-0.5 text-xs text-neutral-300"
|
||||||
|
>
|
||||||
|
{comments.length}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded border border-neutral-700 px-2 py-1 text-xs text-neutral-300 hover:text-neutral-100"
|
class="flex h-8 items-center gap-2 rounded px-2 text-xs text-neutral-300 hover:bg-neutral-800 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-500"
|
||||||
onclick={refreshComments}
|
onclick={refreshComments}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
|
aria-label="Refresh comments"
|
||||||
>
|
>
|
||||||
{loading ? 'Refreshing...' : 'Refresh'}
|
<RefreshCw class="h-3.5 w-3.5 {loading ? 'animate-spin' : ''}" />
|
||||||
|
{loading ? 'Refreshing' : 'Refresh'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if $user}
|
{#if $user}
|
||||||
|
<div class="mb-5">
|
||||||
<RichTextEditor
|
<RichTextEditor
|
||||||
bind:value={newComment}
|
bind:value={newComment}
|
||||||
placeholder="Write a comment..."
|
placeholder="Add a comment..."
|
||||||
onSubmit={submitTopLevelComment}
|
onSubmit={submitTopLevelComment}
|
||||||
disabled={posting}
|
disabled={posting}
|
||||||
submitting={posting}
|
submitting={posting}
|
||||||
|
compact
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="mb-4 rounded border border-neutral-800 p-3 text-sm text-neutral-400">
|
<div class="mb-4 rounded border border-neutral-700 bg-neutral-800 p-3 text-sm text-neutral-300">
|
||||||
Sign in to post comments and reactions.
|
Sign in to post comments and reactions.
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -270,15 +283,15 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if loading && comments.length === 0}
|
{#if loading && comments.length === 0}
|
||||||
<div class="rounded border border-neutral-800 p-3 text-sm text-neutral-400">
|
<div class="rounded border border-neutral-700 bg-neutral-800 p-3 text-sm text-neutral-300">
|
||||||
Loading comments...
|
Loading comments...
|
||||||
</div>
|
</div>
|
||||||
{:else if threadedComments.length === 0}
|
{:else if threadedComments.length === 0}
|
||||||
<div class="rounded border border-neutral-800 p-3 text-sm text-neutral-400">
|
<div class="rounded border border-neutral-700 bg-neutral-800 p-3 text-sm text-neutral-300">
|
||||||
No comments yet.
|
No comments yet.
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="space-y-3">
|
<div class="space-y-2">
|
||||||
{#each threadedComments as node (node.id)}
|
{#each threadedComments as node (node.id)}
|
||||||
<PasteCommentItem
|
<PasteCommentItem
|
||||||
{node}
|
{node}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Bold, Italic, CodeXml, Quote } from '@lucide/svelte';
|
import { Bold, Italic, CodeXml, Quote, Send, Eye, Pencil } from '@lucide/svelte';
|
||||||
import { parseCommentMarkdown } from '$lib/utils/markdown';
|
import { parseCommentMarkdown } from '$lib/utils/markdown';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
submitting?: boolean;
|
submitting?: boolean;
|
||||||
|
compact?: boolean;
|
||||||
submitLabel?: string;
|
submitLabel?: string;
|
||||||
submittingLabel?: string;
|
submittingLabel?: string;
|
||||||
onSubmit?: (value: string) => void | Promise<void>;
|
onSubmit?: (value: string) => void | Promise<void>;
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
placeholder = 'Write a comment...',
|
placeholder = 'Write a comment...',
|
||||||
disabled = false,
|
disabled = false,
|
||||||
submitting = false,
|
submitting = false,
|
||||||
|
compact = false,
|
||||||
submitLabel = 'Post comment',
|
submitLabel = 'Post comment',
|
||||||
submittingLabel = 'Posting...',
|
submittingLabel = 'Posting...',
|
||||||
onSubmit
|
onSubmit
|
||||||
@@ -30,6 +32,7 @@
|
|||||||
const isDisabled = $derived(disabled || submitting);
|
const isDisabled = $derived(disabled || submitting);
|
||||||
const canSubmit = $derived(!isDisabled && value.trim().length > 0);
|
const canSubmit = $derived(!isDisabled && value.trim().length > 0);
|
||||||
const parsedHtml = $derived(parseCommentMarkdown(value));
|
const parsedHtml = $derived(parseCommentMarkdown(value));
|
||||||
|
const editorMinHeight = $derived(compact ? 'min-h-20' : 'min-h-24');
|
||||||
|
|
||||||
function focusEditor() {
|
function focusEditor() {
|
||||||
editor?.focus();
|
editor?.focus();
|
||||||
@@ -133,11 +136,13 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="mb-4 flex flex-col rounded {className}">
|
<div
|
||||||
|
class="mb-4 overflow-hidden rounded border border-neutral-700 bg-neutral-900 shadow-sm {className}"
|
||||||
|
>
|
||||||
{#if mode === 'raw'}
|
{#if mode === 'raw'}
|
||||||
<textarea
|
<textarea
|
||||||
bind:this={editor}
|
bind:this={editor}
|
||||||
class="min-h-24 w-full rounded-t border border-b-0 border-neutral-700 bg-neutral-900 p-2 font-mono text-sm text-neutral-100 outline-none"
|
class="{editorMinHeight} w-full resize-y border-0 bg-neutral-900 p-3 font-mono text-sm text-neutral-100 placeholder:text-neutral-400 focus:bg-neutral-800/60"
|
||||||
{placeholder}
|
{placeholder}
|
||||||
maxlength={5000}
|
maxlength={5000}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
@@ -145,11 +150,9 @@
|
|||||||
onkeydown={handleKeydown}
|
onkeydown={handleKeydown}
|
||||||
></textarea>
|
></textarea>
|
||||||
{:else}
|
{:else}
|
||||||
<div
|
<div class="{editorMinHeight} w-full overflow-auto bg-neutral-900 p-3 text-sm text-neutral-100">
|
||||||
class="min-h-24 w-full rounded-t border border-b-0 border-neutral-700 bg-neutral-900 p-2 text-sm text-neutral-100"
|
|
||||||
>
|
|
||||||
{#if value.trim().length === 0}
|
{#if value.trim().length === 0}
|
||||||
<div class="text-neutral-500">{placeholder}</div>
|
<div class="text-neutral-400">{placeholder}</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="text-sm leading-relaxed wrap-break-word text-neutral-200">
|
<div class="text-sm leading-relaxed wrap-break-word text-neutral-200">
|
||||||
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
|
||||||
@@ -159,57 +162,71 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div
|
<div
|
||||||
class="flex w-full flex-col gap-2 rounded-b border border-neutral-700 bg-neutral-800 p-2 md:flex-row md:gap-0"
|
class="flex w-full flex-col gap-2 border-t border-neutral-700 bg-neutral-800 p-2 md:flex-row md:items-center md:gap-0"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded px-2 py-1 text-sm text-neutral-300 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-600"
|
class="flex h-8 w-8 items-center justify-center rounded text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-500"
|
||||||
onclick={addBold}
|
onclick={addBold}
|
||||||
disabled={isDisabled || mode === 'preview'}
|
disabled={isDisabled || mode === 'preview'}
|
||||||
|
aria-label="Bold"
|
||||||
|
title="Bold"
|
||||||
>
|
>
|
||||||
<Bold class="h-4 w-4" />
|
<Bold class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded px-2 py-1 text-sm text-neutral-300 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-600"
|
class="flex h-8 w-8 items-center justify-center rounded text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-500"
|
||||||
onclick={addItalic}
|
onclick={addItalic}
|
||||||
disabled={isDisabled || mode === 'preview'}
|
disabled={isDisabled || mode === 'preview'}
|
||||||
|
aria-label="Italic"
|
||||||
|
title="Italic"
|
||||||
>
|
>
|
||||||
<Italic class="h-4 w-4" />
|
<Italic class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded px-2 py-1 text-sm text-neutral-300 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-600"
|
class="flex h-8 w-8 items-center justify-center rounded text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-500"
|
||||||
onclick={addQuote}
|
onclick={addQuote}
|
||||||
disabled={isDisabled || mode === 'preview'}
|
disabled={isDisabled || mode === 'preview'}
|
||||||
|
aria-label="Quote"
|
||||||
|
title="Quote"
|
||||||
>
|
>
|
||||||
<Quote class="h-4 w-4" />
|
<Quote class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="rounded px-2 py-1 text-sm text-neutral-300 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-600"
|
class="flex h-8 w-8 items-center justify-center rounded text-neutral-300 hover:bg-neutral-700 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-500"
|
||||||
onclick={addCode}
|
onclick={addCode}
|
||||||
disabled={isDisabled || mode === 'preview'}
|
disabled={isDisabled || mode === 'preview'}
|
||||||
|
aria-label="Inline code"
|
||||||
|
title="Inline code"
|
||||||
>
|
>
|
||||||
<CodeXml class="h-5 w-5" />
|
<CodeXml class="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col items-center gap-2 md:ml-auto md:flex-row">
|
<div class="flex flex-col items-stretch gap-2 md:ml-auto md:flex-row md:items-center">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="ml-auto w-full rounded border border-neutral-600 px-3 py-1 text-sm text-neutral-200 hover:border-neutral-500 hover:text-neutral-100 md:w-auto"
|
class="flex h-8 w-full items-center justify-center gap-2 rounded px-3 text-sm text-neutral-200 hover:bg-neutral-700 hover:text-neutral-100 disabled:cursor-not-allowed disabled:text-neutral-500 md:w-auto"
|
||||||
onclick={toggleMode}
|
onclick={toggleMode}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
>
|
>
|
||||||
|
{#if mode === 'preview'}
|
||||||
|
<Pencil class="h-4 w-4" />
|
||||||
|
{:else}
|
||||||
|
<Eye class="h-4 w-4" />
|
||||||
|
{/if}
|
||||||
{mode === 'preview' ? 'Raw' : 'Preview'}
|
{mode === 'preview' ? 'Raw' : 'Preview'}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="w-full rounded border border-neutral-600 px-3 py-1 text-sm text-neutral-100 hover:bg-neutral-600 disabled:cursor-not-allowed disabled:border-neutral-700 disabled:text-neutral-500 md:ml-2 md:w-auto"
|
class="flex h-8 w-full items-center justify-center gap-2 rounded border border-neutral-600 bg-neutral-700 px-3 text-sm font-medium text-neutral-100 hover:border-neutral-500 hover:bg-neutral-600 disabled:cursor-not-allowed disabled:border-neutral-700 disabled:bg-neutral-800 disabled:text-neutral-500 md:w-auto"
|
||||||
onclick={submit}
|
onclick={submit}
|
||||||
disabled={!canSubmit}
|
disabled={!canSubmit}
|
||||||
>
|
>
|
||||||
|
<Send class="h-4 w-4" />
|
||||||
{submitting ? submittingLabel : submitLabel}
|
{submitting ? submittingLabel : submitLabel}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user