Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Revert "feat(ui): give SegmentedControl the layers panes' pill variant"

Josh Corbettf0f14f3ada00
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx
index b2274f3fb7..894806e4e5 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryViewTabs.tsx
@@ -61,7 +61,6 @@ export const GalleryViewTabs = () => {
isFullWidth={false}
options={options}
value={gallery.galleryView}
- variant="pill"
onChange={handleViewChange}
/>
);
diff --git a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx
index 6e994c5e77..bd512c04f5 100644
--- a/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx
+++ b/invokeai/frontend/webv2/src/features/generation/ui/promptFields/DynamicPromptsButton.tsx
@@ -114,7 +114,6 @@ export const DynamicPromptsButton = ({
isFullWidth={false}
options={tabItems}
value={tab}
- variant="pill"
onChange={handleTabChange}
/>
{tab === 'preview' ? (
diff --git a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx
index abeb6ebf49..1f701b884a 100644
--- a/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx
+++ b/invokeai/frontend/webv2/src/features/workflow/ui/graph-preview/GraphPreviewDialog.tsx
@@ -224,13 +224,7 @@ export const GraphPreviewDialog = ({
{subtitle}
</Text>
</Stack>
- <SegmentedControl
- isFullWidth={false}
- options={modeOptions}
- value={mode}
- variant="pill"
- onChange={handleModeChange}
- />
+ <SegmentedControl isFullWidth={false} options={modeOptions} value={mode} onChange={handleModeChange} />
</Dialog.Header>
<Dialog.Body display="flex" flex="1" flexDirection="column" gap="3" minH="0">
{hasInvalidReasons ? (
diff --git a/invokeai/frontend/webv2/src/platform/ui/SegmentedControl.tsx b/invokeai/frontend/webv2/src/platform/ui/SegmentedControl.tsx
index 7647bf2031..5815a05978 100644
--- a/invokeai/frontend/webv2/src/platform/ui/SegmentedControl.tsx
+++ b/invokeai/frontend/webv2/src/platform/ui/SegmentedControl.tsx
@@ -5,20 +5,7 @@ import { useCallback } from 'react';
// Axe measures the checked label against the item's own background, not the
// moving indicator sibling painted behind it, so the item carries the fill too.
-const ACCENT_CHECKED_ITEM_STYLES = { bg: 'accent.solid', color: 'accent.contrast' } as const;
-const PILL_CHECKED_ITEM_STYLES = { bg: 'bg.emphasized', color: 'fg' } as const;
-
-// The layers panes' pill look: borderless track, neutral emphasized fill.
-const PILL_ROOT_CSS = {
- '--segment-indicator-bg': 'colors.bg.emphasized',
- '--segment-radius': 'radii.md',
- borderWidth: '0',
-} as const;
-// A translucent hover so it reads on panel and popover surfaces alike.
-const PILL_ITEM_CSS = {
- fontWeight: '600',
- _hover: { '&:not([data-state=checked])': { bg: 'bg.emphasized/50' } },
-} as const;
+const CHECKED_ITEM_STYLES = { bg: 'accent.solid', color: 'accent.contrast' } as const;
export interface SegmentedControlOption {
disabled?: boolean;
@@ -34,8 +21,6 @@ export interface SegmentedControlProps extends Omit<SegmentGroup.RootProps, 'onC
onChange: (value: string) => void;
options: readonly SegmentedControlOption[];
value: string | null;
- /** `accent`: bordered track with the accent fill. `pill`: the layers panes' neutral pill tabs. */
- variant?: 'accent' | 'pill';
}
/** The house segmented control: an `xs` group of equal centered segments with `2xs` labels. */
@@ -46,7 +31,6 @@ export const SegmentedControl = ({
onChange,
options,
value,
- variant = 'accent',
...rest
}: SegmentedControlProps) => {
const handleValueChange = useCallback(
@@ -58,12 +42,9 @@ export const SegmentedControl = ({
[onChange]
);
- const isPill = variant === 'pill';
-
return (
<SegmentGroup.Root
aria-label={ariaLabel}
- css={isPill ? PILL_ROOT_CSS : undefined}
disabled={disabled}
size="xs"
value={value}
@@ -75,16 +56,15 @@ export const SegmentedControl = ({
{options.map((option) => (
<SegmentGroup.Item
key={option.value}
- css={isPill ? PILL_ITEM_CSS : undefined}
disabled={option.disabled}
flex={isFullWidth ? '1' : undefined}
justifyContent={isFullWidth ? 'center' : undefined}
minW={isFullWidth ? '0' : undefined}
value={option.value}
- _checked={isPill ? PILL_CHECKED_ITEM_STYLES : ACCENT_CHECKED_ITEM_STYLES}
+ _checked={CHECKED_ITEM_STYLES}
>
<SegmentGroup.ItemHiddenInput />
- <SegmentGroup.ItemText fontSize={isPill ? 'xs' : '2xs'}>{option.label}</SegmentGroup.ItemText>
+ <SegmentGroup.ItemText fontSize="2xs">{option.label}</SegmentGroup.ItemText>
</SegmentGroup.Item>
))}
</SegmentGroup.Root>