Make IDs copyable by clicking anywhere in the body

This commit is contained in:
Rūdolfs Ošiņš
2023-11-09 10:55:10 +01:00
parent ca28fc28b2
commit 179f22cf66
8 changed files with 62 additions and 68 deletions
+1 -3
View File
@@ -32,9 +32,7 @@
{#each embeds as embed}
<Badge variant="neutral">
<span class="txt-overflow">{embed.name}</span>
<Clipboard
text={`![${embed.name}](${embed.content.substring(4)})`}
small />
<Clipboard text={`![${embed.name}](${embed.content.substring(4)})`} />
</Badge>
{:else}
<div class="txt-missing">No attachments</div>
+5 -5
View File
@@ -4,10 +4,10 @@
import { formatCommit } from "@app/lib/utils";
import Changeset from "@app/views/projects/Changeset.svelte";
import Clipboard from "@app/components/Clipboard.svelte";
import CommitAuthorship from "@app/views/projects/Commit/CommitAuthorship.svelte";
import InlineMarkdown from "@app/components/InlineMarkdown.svelte";
import Layout from "./Layout.svelte";
import CopyableId from "@app/components/CopyableId.svelte";
export let baseUrl: BaseUrl;
export let commit: Commit;
@@ -49,12 +49,12 @@
<InlineMarkdown fontSize="medium" content={header.summary} />
</div>
<div class="layout-desktop-flex txt-monospace sha1">
<span>{header.id}</span>
<Clipboard small text={header.id} />
<CopyableId id={header.id} />
</div>
<div class="layout-mobile-flex txt-monospace sha1 txt-small">
{formatCommit(header.id)}
<Clipboard small text={header.id} />
<CopyableId id={header.id}>
{formatCommit(header.id)}
</CopyableId>
</div>
</div>
<pre class="description txt-small">{header.description}</pre>
+4 -19
View File
@@ -8,12 +8,12 @@
import { twemoji, isLocal } from "@app/lib/utils";
import Button from "@app/components/Button.svelte";
import Clipboard from "@app/components/Clipboard.svelte";
import CloneButton from "@app/views/projects/Header/CloneButton.svelte";
import Link from "@app/components/Link.svelte";
import Header from "./Header.svelte";
import TrackButton from "./Header/TrackButton.svelte";
import CopyableId from "@app/components/CopyableId.svelte";
export let activeTab: ActiveTab = undefined;
export let baseUrl: BaseUrl;
@@ -45,23 +45,9 @@
.project-name:hover {
color: inherit;
}
.id {
color: var(--color-fill-secondary);
overflow-wrap: anywhere;
display: flex;
justify-content: left;
align-items: center;
gap: 0.125rem;
margin: 1rem 0 3rem 0;
}
.description :global(a) {
border-bottom: 1px solid var(--color-foreground-contrast);
}
.truncate {
white-space: nowrap;
text-overflow: ellipsis;
overflow-x: hidden;
}
.content {
width: 100%;
max-width: var(--content-max-width);
@@ -91,7 +77,7 @@
<div class="header">
<div class="title">
<span class="truncate">
<span class="txt-overflow">
<Link
route={{
resource: "project.source",
@@ -131,9 +117,8 @@
{@html render(project.description)}
</div>
<div class="id">
<span class="truncate global-hash">{project.id}</span>
<Clipboard small text={project.id} />
<div style:margin-bottom="3rem">
<CopyableId id={project.id} />
</div>
<Header {project} {activeTab} {baseUrl} />