Browse Source

feat: add issue icons

currently using the same status events as patches
master
DanConwayDev 2 years ago
parent
commit
9ec0988006
No known key found for this signature in database
GPG Key ID: 68E15486D73F75E1
  1. 18
      src/lib/components/issues/icons.ts
  2. 28
      src/lib/components/proposals/ProposalsListItem.svelte

18
src/lib/components/issues/icons.ts

@ -0,0 +1,18 @@
// icon are MIT licenced
export const issue_icon_path = {
// https://icon-sets.iconify.design/octicon/issue-opened-16/
open: [
'M8 9.5a1.5 1.5 0 1 0 0-3a1.5 1.5 0 0 0 0 3',
'M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0M1.5 8a6.5 6.5 0 1 0 13 0a6.5 6.5 0 0 0-13 0',
],
// https://icon-sets.iconify.design/octicon/issue-closed-16/
resolved: [
'M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69L5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0z',
'M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-1.5 0a6.5 6.5 0 1 0-13 0a6.5 6.5 0 0 0 13 0',
],
// https://icon-sets.iconify.design/octicon/no-entry-16/
closed: [
'M4.25 7.25a.75.75 0 0 0 0 1.5h7.5a.75.75 0 0 0 0-1.5z',
'M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-1.5 0a6.5 6.5 0 1 0-13 0a6.5 6.5 0 0 0 13 0',
],
}

28
src/lib/components/proposals/ProposalsListItem.svelte

@ -13,6 +13,7 @@
proposal_status_draft, proposal_status_draft,
proposal_status_open, proposal_status_open,
} from '$lib/kinds' } from '$lib/kinds'
import { issue_icon_path } from '../issues/icons'
dayjs.extend(relativeTime) dayjs.extend(relativeTime)
export let type: 'issue' | 'proposal' = 'proposal' export let type: 'issue' | 'proposal' = 'proposal'
@ -50,15 +51,29 @@
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16" viewBox="0 0 16 16"
class="h-5 w-5 flex-none fill-success pt-1" class="h-5 w-5 flex-none fill-success pt-1"
><path d={proposal_icon_path.open_patch} /></svg
> >
{#if type === 'proposal'}
<path d={proposal_icon_path.open_patch} />
{:else if type === 'issue'}
{#each issue_icon_path.open as p}
<path d={p} />
{/each}
{/if}
</svg>
{:else if status === proposal_status_closed} {:else if status === proposal_status_closed}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16" viewBox="0 0 16 16"
class="h-5 w-5 flex-none fill-neutral-content pt-1" class="h-5 w-5 flex-none fill-neutral-content pt-1"
><path d={proposal_icon_path.close} /></svg
> >
{#if type === 'proposal'}
<path d={proposal_icon_path.close} />
{:else if type === 'issue'}
{#each issue_icon_path.closed as p}
<path d={p} />
{/each}
{/if}
</svg>
{:else if status === proposal_status_draft} {:else if status === proposal_status_draft}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -71,8 +86,15 @@
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16" viewBox="0 0 16 16"
class="h-5 w-5 flex-none fill-primary pt-1" class="h-5 w-5 flex-none fill-primary pt-1"
><path d={proposal_icon_path.applied} /></svg
> >
{#if type === 'proposal'}
<path d={proposal_icon_path.applied} />
{:else if type === 'issue'}
{#each issue_icon_path.resolved as p}
<path d={p} />
{/each}
{/if}
</svg>
{/if} {/if}
<a <a
href="/repo/{repo_identifier}/{type}/{id}" href="/repo/{repo_identifier}/{type}/{id}"

Loading…
Cancel
Save