-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add InlineTitle component and use it in Issue/Patch lists
- Loading branch information
Showing
5 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters