Skip to content

Commit 8cb4da4

Browse files
authored
Fix radio button centering (#1733)
1 parent 9c1d75e commit 8cb4da4

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

frontend/viewer/src/lib/components/ui/context-menu/context-menu-radio-item.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
{#snippet children({ checked })}
2323
<span class="absolute left-2 flex size-3.5 items-center justify-center">
2424
{#if checked}
25+
<!-- If not centered, see the change made in radio-group-item.svelte -->
2526
<Icon icon="i-mdi-circle" class="size-3 text-current"/>
2627
{/if}
2728
</span>

frontend/viewer/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
{#snippet children({ checked })}
2323
<span class="absolute left-2 flex size-3.5 items-center justify-center">
2424
{#if checked}
25+
<!-- If not centered, see the change made in radio-group-item.svelte -->
2526
<Icon icon="i-mdi-circle" class="size-2 text-current" />
2627
{/if}
2728
</span>

frontend/viewer/src/lib/components/ui/radio-group/radio-group-item.svelte

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@
2626
{...restProps}
2727
>
2828
{#snippet children({ checked })}
29-
<!--
30-
The circle icon is not well centered depending on zoom level.
31-
There are multiple potential fixes worth trying in: https://github.com/shadcn-ui/ui/issues/3621
32-
-->
33-
<div class="flex items-center justify-center">
34-
{#if checked}
35-
<Icon icon="i-mdi-circle" class="size-3 text-current" />
36-
{/if}
37-
</div>
29+
{#if checked}
30+
<Icon icon="i-mdi-circle" class="text-current size-full scale-75 origin-center" />
31+
{/if}
3832
{/snippet}
3933
</RadioGroupPrimitive.Item>
4034
{/snippet}

0 commit comments

Comments
 (0)