mirror of
https://github.com/immich-app/static-pages.git
synced 2026-09-30 13:23:05 +08:00
@@ -1,26 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { Link } from '@immich/ui';
|
||||
|
||||
type Props = {
|
||||
org?: string;
|
||||
repo?: string;
|
||||
number: number;
|
||||
};
|
||||
|
||||
let { org = 'immich-app', repo = 'immich', number }: Props = $props();
|
||||
|
||||
const getLink = (org: string, repo: string, number: number) => {
|
||||
const href = `https://github.com/${org}/${repo}/issues/${number}`;
|
||||
let text = repo === 'immich' ? `#${number}` : `${repo}#${number}`;
|
||||
|
||||
if (org !== 'immich-app') {
|
||||
text = `${org}/${repo}#${number}`;
|
||||
}
|
||||
|
||||
return { href, text };
|
||||
};
|
||||
|
||||
let { href, text } = $derived(getLink(org, repo, number));
|
||||
</script>
|
||||
|
||||
<Link {href}>{text}</Link>
|
||||
@@ -12,14 +12,11 @@
|
||||
<Heading size="small" class="mt-4">Another org</Heading>
|
||||
<GithubLink org="kysely-org" repo="kysely" number={64} />
|
||||
|
||||
<Heading size="small" class="mt-4">No icon</Heading>
|
||||
<GithubLink number={64} icon={false} />
|
||||
|
||||
<Stack gap={4} class="mt-4">
|
||||
<ComponentSizes>
|
||||
{#snippet child({ size })}
|
||||
<Text {size}>
|
||||
For example, issue <GithubLink {size} number={1} /> is a link to github.
|
||||
For example, issue <GithubLink number={1} /> is a link to github.
|
||||
</Text>
|
||||
{/snippet}
|
||||
</ComponentSizes>
|
||||
|
||||
@@ -1,40 +1,10 @@
|
||||
<script lang="ts">
|
||||
import Icon from '$lib/components/Icon/Icon.svelte';
|
||||
import Link from '$lib/components/Link/Link.svelte';
|
||||
import type { GithubLinkProps } from '$lib/types.js';
|
||||
import { asGithubLink } from '$lib/utilities/common.js';
|
||||
import { siGithub } from 'simple-icons';
|
||||
|
||||
const { org, repo, number, type, size = 'medium', icon = true, ...rest }: GithubLinkProps = $props();
|
||||
const { org, repo, number, type, ...rest }: GithubLinkProps = $props();
|
||||
const { href, text } = $derived(asGithubLink({ org, repo, number, type }));
|
||||
|
||||
const resolvedSize = $derived.by(() => {
|
||||
switch (size) {
|
||||
case 'tiny': {
|
||||
return '7px';
|
||||
}
|
||||
case 'small': {
|
||||
return '8px';
|
||||
}
|
||||
case 'medium': {
|
||||
return '10px';
|
||||
}
|
||||
case 'large': {
|
||||
return '12px';
|
||||
}
|
||||
case 'giant': {
|
||||
return '14px';
|
||||
}
|
||||
default: {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<Link {...rest} {href} class="inline-flex items-center">
|
||||
{#if icon}
|
||||
<Icon icon={siGithub} size={resolvedSize} class="me-1" />
|
||||
{/if}
|
||||
{text}
|
||||
</Link>
|
||||
<Link {...rest} {href} class="inline-flex items-center">{text}</Link>
|
||||
|
||||
@@ -492,13 +492,7 @@ export type LinkProps = {
|
||||
|
||||
export type GithubLinkType = 'issue' | 'pr' | 'discussion';
|
||||
|
||||
export type GithubLinkOptions = { org?: string; repo?: string; number?: number; type?: GithubLinkType };
|
||||
|
||||
export type GithubLinkProps = {
|
||||
icon?: boolean;
|
||||
size?: Size;
|
||||
} & GithubLinkOptions &
|
||||
LinkCommon;
|
||||
export type GithubLinkProps = { org?: string; repo?: string; number?: number; type?: GithubLinkType } & LinkCommon;
|
||||
|
||||
export type MarkdownAlertVariant = 'note' | 'tip' | 'important' | 'warning' | 'caution' | 'info' | 'success' | 'danger';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user