diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 1b49dc18..d7df89c9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"], + "recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"] } diff --git a/src/SidebarTop.tsx b/src/SidebarTop.tsx index c51c7b61..4e53fa80 100644 --- a/src/SidebarTop.tsx +++ b/src/SidebarTop.tsx @@ -1,3 +1,4 @@ +import { FailedIcon, PassedIcon } from "@storybook/icons"; import { type API, useStorybookState } from "@storybook/manager-api"; import { color } from "@storybook/theming"; import pluralize from "pluralize"; @@ -84,10 +85,7 @@ export const SidebarTop = ({ api }: SidebarTopProps) => { headline: "Build started", subHeadline: "Check the visual test addon to see the progress of your build.", }, - icon: { - name: "passed", - color: color.positive, - }, + icon: , // @ts-expect-error `duration` and `onClick` require a newer version of Storybook duration: 8_000, onClick: clickNotification, @@ -104,10 +102,7 @@ export const SidebarTop = ({ api }: SidebarTopProps) => { headline: "Build canceled", subHeadline: "Aborted by user.", }, - icon: { - name: "failed", - color: color.negative, - }, + icon: , // @ts-expect-error `duration` and `onClick` require a newer version of Storybook duration: 8_000, onClick: clickNotification, @@ -132,10 +127,7 @@ export const SidebarTop = ({ api }: SidebarTopProps) => { )}` : "No visual changes detected", }, - icon: { - name: "passed", - color: color.positive, - }, + icon: , // @ts-expect-error `duration` and `onClick` require a newer version of Storybook duration: 8_000, onClick: clickNotification, @@ -152,10 +144,7 @@ export const SidebarTop = ({ api }: SidebarTopProps) => { headline: "Build error", subHeadline: "Check the Storybook process on the command line for more details.", }, - icon: { - name: "failed", - color: color.negative, - }, + icon: , // @ts-expect-error `duration` and `onClick` require a newer version of Storybook onClick: clickNotification, }); @@ -169,10 +158,7 @@ export const SidebarTop = ({ api }: SidebarTopProps) => { subHeadline: "Your account has insufficient snapshots remaining to run this build. Visit your billing page to find out more.", }, - icon: { - name: "failed", - color: color.negative, - }, + icon: , // @ts-expect-error `duration` and `onClick` require a newer version of Storybook onClick: clickNotification, }); diff --git a/src/components/ActionButton.tsx b/src/components/ActionButton.tsx index 707299bb..7cc3df84 100644 --- a/src/components/ActionButton.tsx +++ b/src/components/ActionButton.tsx @@ -4,8 +4,8 @@ import { ComponentProps } from "react"; import { IconButton } from "./IconButton"; -const themeColors = ({ theme, secondary, status }: { theme: Theme } & ActionButtonProps) => { - if (secondary) { +const themeColors = ({ theme, status, variant }: { theme: Theme } & ActionButtonProps) => { + if (variant === "outline") { return { color: theme.base === "light" ? theme.color.dark : theme.color.medium, backgroundColor: theme.background.app, @@ -54,29 +54,29 @@ const themeColors = ({ theme, secondary, status }: { theme: Theme } & ActionButt }; interface ActionButtonProps extends ComponentProps { - containsIcon?: boolean; + square?: boolean; side?: "left" | "right"; } export const ActionButton: React.FC = styled(IconButton)( - ({ containsIcon }) => ({ + ({ square }) => ({ border: `1px solid transparent`, boxShadow: "none", fontSize: 12, fontWeight: 700, height: 28, - padding: containsIcon ? "8px 6px" : 8, + padding: square ? "8px 6px" : 8, transition: "background-color 150ms ease-out", "@container (min-width: 300px)": { height: 32, - width: containsIcon ? 32 : "auto", - padding: containsIcon ? "9px 8px" : 9, + width: square ? 32 : "auto", + padding: square ? "9px 8px" : 9, }, "@container (min-width: 800px)": { height: 28, fontSize: 12, - width: containsIcon ? 28 : "auto", - padding: containsIcon ? "8px 6px" : 8, + width: square ? 28 : "auto", + padding: square ? "8px 6px" : 8, }, }), themeColors, diff --git a/src/components/IconButton.tsx b/src/components/IconButton.tsx index e62ddb6b..7485a073 100644 --- a/src/components/IconButton.tsx +++ b/src/components/IconButton.tsx @@ -13,18 +13,17 @@ const getStatusStyles = (theme: Theme, status?: IconButtonProps["status"]) => interface IconButtonProps extends ComponentProps { active?: boolean; as?: string; - secondary?: boolean; status?: "positive" | "warning"; } export const IconButton: React.FC = styled(BaseIconButton)( - ({ active, secondary, theme }) => ({ + ({ active, variant, theme }) => ({ display: "inline-flex", alignItems: "center", verticalAlign: "top", gap: 6, margin: 0, - color: active || secondary ? theme.color.secondary : theme.color.mediumdark, + color: active || variant === "outline" ? theme.color.secondary : theme.color.mediumdark, fontWeight: "normal", "& > svg": { width: "auto", diff --git a/src/components/SidebarTopButton.tsx b/src/components/SidebarTopButton.tsx index 2db560fb..254b42dc 100644 --- a/src/components/SidebarTopButton.tsx +++ b/src/components/SidebarTopButton.tsx @@ -1,5 +1,5 @@ import { WithTooltip } from "@storybook/components"; -import { PlayIcon, StopAltIcon, SyncIcon } from "@storybook/icons"; +import { PlayIcon, StopAltIcon } from "@storybook/icons"; import { keyframes, styled } from "@storybook/theming"; import React, { ComponentProps } from "react"; diff --git a/src/components/design-system/Link.tsx b/src/components/design-system/Link.tsx index 34045a9e..b30143d4 100644 --- a/src/components/design-system/Link.tsx +++ b/src/components/design-system/Link.tsx @@ -1,4 +1,4 @@ -import { css, styled } from "@storybook/theming"; +import { styled } from "@storybook/theming"; import { darken } from "polished"; import React, { ComponentProps, forwardRef } from "react"; @@ -20,7 +20,6 @@ const LinkInner = styled.span<{ withArrow: boolean }>( ); export interface StyledLinkProps { - containsIcon?: boolean; secondary?: boolean; tertiary?: boolean; nochrome?: boolean; @@ -56,17 +55,6 @@ const StyledLink = styled.a( }, }, (props) => ({ - ...(props.containsIcon && { - svg: { - height: "1em", - width: "1em", - verticalAlign: "middle", - position: "relative", - bottom: 0, - marginRight: 0, - }, - }), - ...(props.secondary && { color: props.theme.base === "light" ? color.mediumdark : color.medium, @@ -137,19 +125,7 @@ export type LinkProps = React.ComponentProps & { // down to the styled component, so that we don't end up passing them to a // tag which would throw warnings for non-standard props. const LinkComponentPicker = forwardRef( - ( - { - containsIcon, - inverse, - isButton, - LinkWrapper, - nochrome, - secondary, - tertiary, - ...rest - }: LinkProps, - ref - ) => { + ({ inverse, isButton, LinkWrapper, nochrome, secondary, tertiary, ...rest }: LinkProps, ref) => { // Use the UnstyledLink here to avoid duplicating styles and creating // specificity conflicts by first rendering the StyledLink higher up the chain // and then re-rendering it through the 'as' prop. @@ -194,7 +170,6 @@ Link.displayName = "Link"; Link.defaultProps = { withArrow: false, isButton: false, - containsIcon: false, secondary: false, tertiary: false, nochrome: false, diff --git a/src/components/design-system/Spinner.tsx b/src/components/design-system/Spinner.tsx index 7b6b9618..28884cb0 100644 --- a/src/components/design-system/Spinner.tsx +++ b/src/components/design-system/Spinner.tsx @@ -1,4 +1,4 @@ -import { css, styled } from "@storybook/theming"; +import { styled } from "@storybook/theming"; import React, { ComponentProps, FunctionComponent } from "react"; import { rotate360 } from "./shared/animation"; diff --git a/src/manager.tsx b/src/manager.tsx index d4e34909..78980477 100644 --- a/src/manager.tsx +++ b/src/manager.tsx @@ -1,3 +1,4 @@ +import { FailedIcon } from "@storybook/icons"; import { addons, type API } from "@storybook/manager-api"; import { color } from "@storybook/theming"; import { Addon_TypesEnum } from "@storybook/types"; @@ -49,10 +50,7 @@ addons.register(ADDON_ID, (api) => { headline: "Connection lost", subHeadline: "Lost connection to the Storybook server. Try refreshing the page.", }, - icon: { - name: "failed", - color: color.negative, - }, + icon: , // @ts-expect-error SB needs a proper API for no link link: undefined, }); diff --git a/src/screens/GuidedTour/Tooltip.tsx b/src/screens/GuidedTour/Tooltip.tsx index 567f15da..e9da8d82 100644 --- a/src/screens/GuidedTour/Tooltip.tsx +++ b/src/screens/GuidedTour/Tooltip.tsx @@ -75,7 +75,7 @@ export const Tooltip = ({ isLastStep, step, primaryProps, tooltipProps }: Toolti ...primaryProps, // @tmeasday - I'm not sure if we ever use this, but this makes the types work onClick: primaryProps.onClick as (event: SyntheticEvent) => void, - primary: true, + variant: "solid", ...(step.onNextButtonClick ? { onClick: step.onNextButtonClick } : {}), }} > diff --git a/src/screens/VisualTests/BuildResults.tsx b/src/screens/VisualTests/BuildResults.tsx index dad45309..94d58b59 100644 --- a/src/screens/VisualTests/BuildResults.tsx +++ b/src/screens/VisualTests/BuildResults.tsx @@ -153,7 +153,7 @@ export const BuildResults = ({ disableSnapshot = true from the CSF file. -