mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Add InlineTitle component and use it in Issue/Patch lists
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<script lang="ts">
|
||||
import dompurify from "dompurify";
|
||||
import escape from "lodash/escape";
|
||||
|
||||
export let content: string;
|
||||
export let fontSize: "tiny" | "small" | "regular" | "medium" | "large" =
|
||||
"small";
|
||||
|
||||
function formatInlineTitle(input: string): string {
|
||||
return input.replaceAll(/`([^`]+)`/g, "<code>$1</code>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content :global(code) {
|
||||
font-family: var(--font-family-monospace);
|
||||
padding: 0.125rem 0.25rem;
|
||||
background-color: var(--color-fill-ghost);
|
||||
}
|
||||
</style>
|
||||
|
||||
<span
|
||||
class="content"
|
||||
class:txt-large={fontSize === "large"}
|
||||
class:txt-medium={fontSize === "medium"}
|
||||
class:txt-regular={fontSize === "regular"}
|
||||
class:txt-small={fontSize === "small"}
|
||||
class:txt-tiny={fontSize === "tiny"}>
|
||||
{@html dompurify.sanitize(formatInlineTitle(escape(content)))}
|
||||
</span>
|
||||
@@ -4,6 +4,7 @@
|
||||
import { formatOid } from "@app/lib/utils";
|
||||
|
||||
import Icon from "./Icon.svelte";
|
||||
import InlineTitle from "./InlineTitle.svelte";
|
||||
import NodeId from "./NodeId.svelte";
|
||||
|
||||
export let issue: Issue;
|
||||
@@ -60,7 +61,7 @@
|
||||
class="global-flex"
|
||||
style:flex-direction="column"
|
||||
style:align-items="flex-start">
|
||||
{issue.title}
|
||||
<InlineTitle content={issue.title} />
|
||||
<div class="global-flex txt-small">
|
||||
<NodeId
|
||||
nodeId={issue.author.did.replace("did:key:", "")}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { formatOid } from "@app/lib/utils";
|
||||
|
||||
import Icon from "./Icon.svelte";
|
||||
import InlineTitle from "./InlineTitle.svelte";
|
||||
import NodeId from "./NodeId.svelte";
|
||||
|
||||
export let patch: Patch;
|
||||
@@ -65,7 +66,7 @@
|
||||
class="global-flex"
|
||||
style:flex-direction="column"
|
||||
style:align-items="flex-start">
|
||||
{patch.title}
|
||||
<InlineTitle content={patch.title} />
|
||||
<div class="global-flex txt-small">
|
||||
<NodeId
|
||||
nodeId={patch.author.did.replace("did:key:", "")}
|
||||
|
||||
Reference in New Issue
Block a user