refactor: Use spacing tokens in SplitButton, InputSelect, Drawer, Popover

Pixel-identical substitution of hardcoded margin/padding values with
spacing tokens from @shared/styles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014Hpjg2EbSwW1RTqkMdWQyT
This commit is contained in:
Claude committed 2026-07-08 11:03:14 +00:00
1 parent 866e2c42e0
commit ec456bf17b
5 files changed
+24 -24

No files matched your search

+4 -4
View File
@@ -2,7 +2,7 @@ import * as VisuallyHidden from "@radix-ui/react-visually-hidden";
import * as React from "react";
import styled from "styled-components";
import { Drawer as DrawerPrimitive } from "vaul";
import { depths, s } from "@shared/styles";
import { depths, s, space, spacing } from "@shared/styles";
import Flex from "../Flex";
import Text from "../Text";
import { Overlay } from "./components/Overlay";
@@ -101,13 +101,13 @@ const StyledContent = styled(m.div)`
`;
const StyledInnerContent = styled(Flex)`
padding: 6px;
padding-bottom: calc(6px + var(--sab, 0px));
padding: ${spacing.sm}px;
padding-bottom: calc(${spacing.sm}px + var(--sab, 0px));
height: 100%;
`;
const TitleWrapper = styled(Flex)`
padding: 8px 0;
padding: ${space("md", 0)};
`;
export { Drawer, DrawerTrigger, DrawerHandle, DrawerContent, DrawerTitle };
+5 -5
View File
@@ -2,7 +2,7 @@ import * as InputSelectPrimitive from "@radix-ui/react-select";
import * as React from "react";
import styled from "styled-components";
import Text from "@shared/components/Text";
import { depths, s } from "@shared/styles";
import { depths, s, space, spacing } from "@shared/styles";
import type { Props as ButtonProps } from "~/components/Button";
import { fadeAndSlideDown, fadeAndSlideUp } from "~/styles/animations";
import {
@@ -108,7 +108,7 @@ const InputSelectSeparator = React.forwardRef<
InputSelectSeparator.displayName = InputSelectPrimitive.Separator.displayName;
const Separator = styled.hr`
margin: 6px 0;
margin: ${space("sm", 0)};
`;
/** Non-selectable heading rendered to group options in the menu. */
@@ -130,8 +130,8 @@ const Heading = styled(Text).attrs({
weight: "bold",
})`
display: block;
padding-block: 8px 4px;
padding-inline: 8px;
padding-block: ${spacing.md}px ${spacing.xs}px;
padding-inline: ${spacing.md}px;
text-transform: uppercase;
letter-spacing: 0.04em;
`;
@@ -144,7 +144,7 @@ const StyledContent = styled(InputSelectPrimitive.Content)`
min-height: 44px;
max-height: 350px;
padding: 4px;
padding: ${spacing.xs}px;
border-radius: 6px;
background: ${s("menuBackground")};
box-shadow: ${s("menuShadow")};
+2 -2
View File
@@ -2,7 +2,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
import * as React from "react";
import { mergeRefs } from "react-merge-refs";
import styled from "styled-components";
import { depths, s } from "@shared/styles";
import { depths, s, space } from "@shared/styles";
import { fadeAndScaleIn } from "~/styles/animations";
import { usePortalContext } from "../Portal";
@@ -113,7 +113,7 @@ const StyledContent = styled(PopoverPrimitive.Content)<StyledContentProps>`
border-radius: 6px;
outline: none;
padding: ${({ $shrink }) => ($shrink ? "6px 0" : "12px 24px")};
padding: ${({ $shrink }) => ($shrink ? space("sm", 0) : space("lg", "xxl"))};
${({ $width }) => $width && `width: ${$width}px`};
${({ $minWidth }) => $minWidth && `min-width: ${$minWidth}px`};
+7 -7
View File
@@ -3,7 +3,7 @@ import { CheckmarkIcon, ExpandedIcon } from "outline-icons";
import { transparentize } from "polished";
import * as React from "react";
import styled, { css } from "styled-components";
import { s } from "@shared/styles";
import { s, space, spacing } from "@shared/styles";
import { fadeAndScaleIn } from "~/styles/animations";
import { undraggableOnDesktop } from "~/styles";
@@ -177,7 +177,7 @@ const MainButton = styled.button<{ $neutral?: boolean }>`
${buttonReset}
display: flex;
align-items: center;
padding: 0 8px;
padding: ${space(0, "md")};
border-radius: 6px 0 0 6px;
white-space: nowrap;
transition: background 200ms ease-out;
@@ -196,7 +196,7 @@ const DisclosureButton = styled.button<{ $neutral?: boolean }>`
display: flex;
align-items: center;
justify-content: center;
padding: 0 4px;
padding: ${space(0, "xs")};
border-radius: 0 6px 6px 0;
transition: background 200ms ease-out;
@@ -213,7 +213,7 @@ const DisclosureButton = styled.button<{ $neutral?: boolean }>`
const Divider = styled.span<{ $neutral?: boolean }>`
width: 1px;
align-self: stretch;
margin: 6px 0;
margin: ${space("sm", 0)};
background: ${(props) =>
props.$neutral
? transparentize(0.7, props.theme.buttonNeutralText)
@@ -231,7 +231,7 @@ const MenuContent = styled.div`
background: ${s("menuBackground")};
box-shadow: ${s("menuShadow")};
border-radius: 6px;
padding: 6px;
padding: ${spacing.sm}px;
outline: none;
transform-origin: var(--radix-dropdown-menu-content-transform-origin);
@@ -250,8 +250,8 @@ const MenuItem = styled.button`
font-size: 14px;
color: ${s("textSecondary")};
border-radius: 4px;
padding: 4px 12px;
gap: 8px;
padding: ${space("xs", "lg")};
gap: ${spacing.md}px;
user-select: none;
&[data-highlighted] {
@@ -6,7 +6,7 @@ import { CheckmarkIcon } from "outline-icons";
import { forwardRef } from "react";
import styled, { css } from "styled-components";
import breakpoint from "styled-components-breakpoint";
import { s } from "@shared/styles";
import { s, spacing } from "@shared/styles";
import Button, { Inner } from "~/components/Button";
import Flex from "~/components/Flex";
import Text from "~/components/Text";
@@ -73,8 +73,8 @@ export const SelectButton = styled(Button)<{ $nude?: boolean }>`
${Inner} {
line-height: 28px;
padding-inline-start: 12px;
padding-inline-end: 4px;
padding-inline-start: ${spacing.lg}px;
padding-inline-end: ${spacing.xs}px;
}
svg {
@@ -95,7 +95,7 @@ const ItemContainer = styled(Flex)`
color: ${s("textSecondary")};
background: none;
margin: 0;
padding: 12px;
padding: ${spacing.lg}px;
border: 0;
border-radius: 4px;
outline: 0;
@@ -131,8 +131,8 @@ const ItemContainer = styled(Flex)`
${breakpoint("tablet")`
font-size: 14px;
padding: 4px;
padding-inline-start: 8px;
padding: ${spacing.xs}px;
padding-inline-start: ${spacing.md}px;
`}
`;