Tweak the design of the RadioInput widget

This commit is contained in:
Keavon Chambers 2025-05-24 16:04:06 -07:00
parent 8a8e496058
commit 63cce26755
8 changed files with 55 additions and 49 deletions

View File

@ -42,7 +42,7 @@
width: calc(100% + 2 * 4px); width: calc(100% + 2 * 4px);
margin-top: 8px; margin-top: 8px;
span { .text-label {
white-space: wrap; white-space: wrap;
} }
} }

View File

@ -994,7 +994,7 @@
{/if} {/if}
<div class="details"> <div class="details">
<!-- TODO: Allow the user to edit the name, just like in the Layers panel --> <!-- TODO: Allow the user to edit the name, just like in the Layers panel -->
<span>{node.displayName}</span> <TextLabel>{node.displayName}</TextLabel>
</div> </div>
<div class="solo-drag-grip" title="Drag only this layer without pushing others outside the stack"></div> <div class="solo-drag-grip" title="Drag only this layer without pushing others outside the stack"></div>
<IconButton <IconButton
@ -1585,7 +1585,7 @@
.details { .details {
margin: 0 8px; margin: 0 8px;
span { .text-label {
white-space: nowrap; white-space: nowrap;
line-height: 48px; line-height: 48px;
} }

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { isWidgetSpanColumn, isWidgetSpanRow, isWidgetSection, type WidgetLayout, isWidgetTable } from "@graphite/messages"; import { isWidgetSpanColumn, isWidgetSpanRow, isWidgetSection, type WidgetLayout, isWidgetTable } from "@graphite/messages";
import TextLabel from "@graphite/components/widgets/labels/TextLabel.svelte";
import WidgetSection from "@graphite/components/widgets/WidgetSection.svelte"; import WidgetSection from "@graphite/components/widgets/WidgetSection.svelte";
import WidgetSpan from "@graphite/components/widgets/WidgetSpan.svelte"; import WidgetSpan from "@graphite/components/widgets/WidgetSpan.svelte";
import WidgetTable from "@graphite/components/widgets/WidgetTable.svelte"; import WidgetTable from "@graphite/components/widgets/WidgetTable.svelte";
@ -19,7 +20,7 @@
{:else if isWidgetTable(layoutGroup)} {:else if isWidgetTable(layoutGroup)}
<WidgetTable widgetData={layoutGroup} layoutTarget={layout.layoutTarget} /> <WidgetTable widgetData={layoutGroup} layoutTarget={layout.layoutTarget} />
{:else} {:else}
<span style="color: #d6536e">Error: The widget layout that belongs here has an invalid layout group type</span> <TextLabel styles={{ color: "#d6536e" }}>Error: The widget layout that belongs here has an invalid layout group type</TextLabel>
{/if} {/if}
{/each} {/each}

View File

@ -65,11 +65,11 @@
{#if isWidgetSpanRow(layoutGroup)} {#if isWidgetSpanRow(layoutGroup)}
<WidgetSpan widgetData={layoutGroup} {layoutTarget} /> <WidgetSpan widgetData={layoutGroup} {layoutTarget} />
{:else if isWidgetSpanColumn(layoutGroup)} {:else if isWidgetSpanColumn(layoutGroup)}
<span style="color: #d6536e">Error: The WidgetSpan used here should be a row not a column</span> <TextLabel styles={{ color: "#d6536e" }}>Error: The WidgetSpan used here should be a row not a column</TextLabel>
{:else if isWidgetSection(layoutGroup)} {:else if isWidgetSection(layoutGroup)}
<svelte:self widgetData={layoutGroup} {layoutTarget} /> <svelte:self widgetData={layoutGroup} {layoutTarget} />
{:else} {:else}
<span style="color: #d6536e">Error: The widget that belongs here has an invalid layout group type</span> <TextLabel styles={{ color: "#d6536e" }}>Error: The widget that belongs here has an invalid layout group type</TextLabel>
{/if} {/if}
{/each} {/each}
</LayoutCol> </LayoutCol>

View File

@ -155,7 +155,7 @@
&.disabled { &.disabled {
background: var(--color-2-mildblack); background: var(--color-2-mildblack);
span { .text-label {
color: var(--color-8-uppergray); color: var(--color-8-uppergray);
} }

View File

@ -156,7 +156,7 @@
&.open { &.open {
background: var(--color-6-lowergray); background: var(--color-6-lowergray);
span { .text-label {
color: var(--color-f-white); color: var(--color-f-white);
} }
} }
@ -168,7 +168,7 @@
&.disabled { &.disabled {
background: var(--color-2-mildblack); background: var(--color-2-mildblack);
span { .text-label {
color: var(--color-8-uppergray); color: var(--color-8-uppergray);
} }
} }

View File

@ -24,14 +24,14 @@
} }
</script> </script>
<LayoutRow class="radio-input" classes={{ disabled }} styles={{ ...(minWidth > 0 ? { "min-width": `${minWidth}px` } : {}) }}> <LayoutRow class="radio-input" classes={{ disabled, mixed }} styles={{ ...(minWidth > 0 ? { "min-width": `${minWidth}px` } : {}) }}>
{#each entries as entry, index} {#each entries as entry, index}
<button class:active={index === selectedIndex} class:mixed class:disabled on:click={() => handleEntryClick(entry)} title={entry.tooltip} tabindex={index === selectedIndex ? -1 : 0} {disabled}> <button class:active={!mixed ? index === selectedIndex : undefined} on:click={() => handleEntryClick(entry)} title={entry.tooltip} tabindex={index === selectedIndex ? -1 : 0} {disabled}>
{#if entry.icon} {#if entry.icon}
<IconLabel icon={entry.icon} /> <IconLabel icon={entry.icon} />
{/if} {/if}
{#if entry.label} {#if entry.label}
<TextLabel italic={mixed}>{entry.label}</TextLabel> <TextLabel>{entry.label}</TextLabel>
{/if} {/if}
</button> </button>
{/each} {/each}
@ -39,12 +39,17 @@
<style lang="scss" global> <style lang="scss" global>
.radio-input { .radio-input {
background: var(--color-5-dullgray);
border-radius: 2px;
height: 24px;
button { button {
background: var(--color-5-dullgray); background: var(--color-5-dullgray);
fill: var(--color-e-nearwhite); fill: var(--color-e-nearwhite);
height: 24px; border-radius: 2px;
margin: 0; height: 20px;
padding: 0; padding: 0;
margin: 2px 1px;
border: none; border: none;
display: flex; display: flex;
align-items: center; align-items: center;
@ -54,8 +59,12 @@
min-width: fit-content; min-width: fit-content;
flex: 1 1 0; flex: 1 1 0;
&.mixed { &:first-of-type {
background: var(--color-4-dimgray); margin-left: 2px;
}
&:last-of-type {
margin-right: 2px;
} }
&:hover { &:hover {
@ -76,7 +85,34 @@
} }
} }
&.disabled { .icon-label {
margin: 2px;
+ .text-label {
margin-left: 0;
}
}
.text-label {
margin: 0 8px;
overflow: hidden;
flex: 0 0 auto;
}
}
&.mixed {
background: var(--color-4-dimgray);
button:not(:hover),
&.disabled button:hover {
background: var(--color-5-dullgray);
}
}
&.disabled {
background: var(--color-4-dimgray);
button {
background: var(--color-4-dimgray); background: var(--color-4-dimgray);
color: var(--color-8-uppergray); color: var(--color-8-uppergray);
@ -93,37 +129,6 @@
} }
} }
} }
& + button {
margin-left: 1px;
}
&:first-of-type {
border-radius: 2px 0 0 2px;
}
&:last-of-type {
border-radius: 0 2px 2px 0;
}
.icon-label {
margin: 0 4px;
+ .text-label {
margin-left: 0;
}
}
.text-label {
margin: 0 8px;
overflow: hidden;
flex: 0 0 auto;
}
}
&.combined-before button:first-of-type,
&.combined-after button:last-of-type {
border-radius: 0;
} }
} }
</style> </style>

View File

@ -248,7 +248,7 @@
} }
} }
span { .text-label {
flex: 1 1 100%; flex: 1 1 100%;
overflow-x: hidden; overflow-x: hidden;
white-space: nowrap; white-space: nowrap;