Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 update file list item #7324

Merged
merged 6 commits into from
Feb 18, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make fileStatusBadge design accessible
  • Loading branch information
PavelLaptev committed Feb 18, 2025
commit aa2418a326f60857476d44e38664917be456731d
61 changes: 41 additions & 20 deletions packages/ui/src/lib/file/FileStatusBadge.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import Badge from '$lib/Badge.svelte';
import Tooltip from '$lib/Tooltip.svelte';
import type { ComponentColorType } from '$lib/utils/colorTypes';
import type { FileStatus } from './types';

Expand Down Expand Up @@ -38,14 +39,40 @@
</script>

{#if style === 'dot'}
<div class="status-dot-wrap">
<div
class="status-dot"
class:added={status === 'A'}
class:modified={status === 'M'}
class:deleted={status === 'D'}
></div>
</div>
<Tooltip text={getFullStatusText(status)}>
<div class="status-dot-wrap">
<div
class="status-dot"
class:added={status === 'A'}
class:modified={status === 'M'}
class:deleted={status === 'D'}
></div>

<svg
width="10"
height="10"
viewBox="0 0 10 10"
fill="none"
xmlns="http://www.w3.org/2000/svg"
class="status-dot"
class:added={status === 'A'}
class:modified={status === 'M'}
class:deleted={status === 'D'}
>
<path
d="M3 0.75H7C8.24264 0.75 9.25 1.75736 9.25 3V7C9.25 8.24264 8.24264 9.25 7 9.25H3C1.75736 9.25 0.75 8.24264 0.75 7V3C0.75 1.75736 1.75736 0.75 3 0.75Z"
stroke-width="1.5"
/>
{#if status === 'A'}
<path d="M7.75 5H2.25M5 2.25V7.75" stroke-width="1.5" />
{:else if status === 'M'}
<path d="M6 4L4 6" stroke-width="2" />
{:else if status === 'D'}
<path d="M7.5 5H2.5" stroke-width="2" />
{/if}
</svg>
</div>
</Tooltip>
{:else if style === 'full'}
<Badge style={getStatusColor(status)}>{getFullStatusText(status)}</Badge>
{/if}
Expand All @@ -59,21 +86,15 @@
}

.status-dot {
border-radius: 100%;
width: 8px;
height: 8px;
border-radius: 100%;
flex-shrink: 0;
}
.status-dot.added {
background: var(--clr-scale-succ-60);
.status-dot.added path {
stroke: var(--clr-scale-succ-60);
}
.status-dot.modified {
background: var(--clr-scale-warn-60);
opacity: 0.6;
.status-dot.modified path {
stroke: var(--clr-scale-warn-60);
}
.status-dot.deleted {
background: var(--clr-scale-err-50);
opacity: 0.8;
.status-dot.deleted path {
stroke: var(--clr-scale-err-60);
}
</style>