mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 05:18:19 +00:00
Fix a couple frontend rendering flaws
This commit is contained in:
parent
6a10bcc3fc
commit
1727694dfc
2 changed files with 6 additions and 11 deletions
|
@ -13,6 +13,8 @@
|
|||
export let selectedIndex: number | undefined = undefined;
|
||||
export let disabled = false;
|
||||
|
||||
$: mixed = selectedIndex === undefined && !disabled;
|
||||
|
||||
function handleEntryClick(radioEntryData: RadioEntryData) {
|
||||
const index = entries.indexOf(radioEntryData);
|
||||
dispatch("selectedIndex", index);
|
||||
|
@ -23,20 +25,12 @@
|
|||
|
||||
<LayoutRow class="radio-input" classes={{ disabled }}>
|
||||
{#each entries as entry, index}
|
||||
<button
|
||||
class:active={index === selectedIndex}
|
||||
class:mixed={selectedIndex === undefined}
|
||||
class:disabled
|
||||
on:click={() => handleEntryClick(entry)}
|
||||
title={entry.tooltip}
|
||||
tabindex={index === selectedIndex ? -1 : 0}
|
||||
{disabled}
|
||||
>
|
||||
<button class:active={index === selectedIndex} class:mixed class:disabled on:click={() => handleEntryClick(entry)} title={entry.tooltip} tabindex={index === selectedIndex ? -1 : 0} {disabled}>
|
||||
{#if entry.icon}
|
||||
<IconLabel icon={entry.icon} />
|
||||
{/if}
|
||||
{#if entry.label}
|
||||
<TextLabel italic={selectedIndex === undefined}>{entry.label}</TextLabel>
|
||||
<TextLabel italic={mixed}>{entry.label}</TextLabel>
|
||||
{/if}
|
||||
</button>
|
||||
{/each}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue