From 9073f07705488601ab4ff59e3828fe698083894e Mon Sep 17 00:00:00 2001 From: Michael Han <107991372+shimmyshimmer@users.noreply.github.com> Date: Sat, 18 Jul 2026 21:08:55 -0700 Subject: [PATCH] fix(studio): equal padding in the dataset source segmented control (#7230) * fix(studio): equal padding in dataset source segmented control * fix(studio): scope dataset source pill layoutId per component instance --- .../studio/sections/dataset-section.tsx | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/studio/frontend/src/features/studio/sections/dataset-section.tsx b/studio/frontend/src/features/studio/sections/dataset-section.tsx index e7bab1f47f..6aa9329609 100644 --- a/studio/frontend/src/features/studio/sections/dataset-section.tsx +++ b/studio/frontend/src/features/studio/sections/dataset-section.tsx @@ -70,11 +70,13 @@ import { } from "@hugeicons/core-free-icons"; import { HugeiconsIcon } from "@hugeicons/react"; import { useNavigate } from "@tanstack/react-router"; +import { motion, useReducedMotion } from "motion/react"; import { type ChangeEvent, type DragEvent, useCallback, useEffect, + useId, useMemo, useRef, useState, @@ -153,6 +155,9 @@ function normalizeSliceInput(value: string): string | null { export function DatasetSection() { const t = useT(); const navigate = useNavigate(); + const reducedMotion = useReducedMotion(); + // Scopes the pill layoutId so multiple instances never share one. + const sourcePillLayoutId = useId(); const { dataset, datasetSource, @@ -686,6 +691,9 @@ export function DatasetSection() { {(() => { // Hub-style sliding-pill segmented control, matching the Hub tabs // via the shared .hub-tab-toggle / .hub-tab-toggle-pill classes. + // flex-auto buttons share leftover space equally so padding stays + // equal for all labels; the pill sits inside the active button so + // it always matches its bounds. const sourceTabs: { value: "huggingface" | "upload" | "s3"; label: string; @@ -696,24 +704,12 @@ export function DatasetSection() { ? [] : [{ value: "s3" as const, label: "Amazon S3" }]), ]; - const activeIndex = Math.max( - 0, - sourceTabs.findIndex((item) => item.value === datasetSource), - ); return (
-