diff --git a/.changeset/proud-chairs-study.md b/.changeset/proud-chairs-study.md new file mode 100644 index 00000000000..cec2457a873 --- /dev/null +++ b/.changeset/proud-chairs-study.md @@ -0,0 +1,5 @@ +--- +"@primer/react": major +--- + +Remove sx support from SubNav component diff --git a/e2e/components/SubNav.test.ts b/e2e/components/SubNav.test.ts index 2f4cb036db3..474438085f4 100644 --- a/e2e/components/SubNav.test.ts +++ b/e2e/components/SubNav.test.ts @@ -21,24 +21,6 @@ test.describe('SubNav', () => { } }) - test.describe('Dev: With Sx', () => { - for (const theme of themes) { - test.describe(theme, () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-subnav-dev--with-sx', - globals: { - colorScheme: theme, - }, - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`SubNav.Dev.WithSx.${theme}.png`) - }) - }) - } - }) - test.describe('Dev: With CSS', () => { for (const theme of themes) { test.describe(theme, () => { @@ -56,22 +38,4 @@ test.describe('SubNav', () => { }) } }) - - test.describe('Dev: With Sx and CSS', () => { - for (const theme of themes) { - test.describe(theme, () => { - test('default @vrt', async ({page}) => { - await visit(page, { - id: 'components-subnav-dev--with-sx-and-css', - globals: { - colorScheme: theme, - }, - }) - - // Default state - expect(await page.screenshot()).toMatchSnapshot(`SubNav.Dev.WithSxAndCSS.${theme}.png`) - }) - }) - } - }) }) diff --git a/packages/react/src/SubNav/SubNav.dev.stories.tsx b/packages/react/src/SubNav/SubNav.dev.stories.tsx index e1419de9567..b2d8e24e0d1 100644 --- a/packages/react/src/SubNav/SubNav.dev.stories.tsx +++ b/packages/react/src/SubNav/SubNav.dev.stories.tsx @@ -27,48 +27,3 @@ export const WithCss = () => ( ) - -export const WithSx = () => ( - - - - Home - - - Documentation - - - Support - - - -) - -export const WithSxAndCSS = () => ( - - - - Home - - - Documentation - - - Support - - - -) diff --git a/packages/react/src/SubNav/SubNav.tsx b/packages/react/src/SubNav/SubNav.tsx index 7e68ecde7b0..6976fb1f104 100644 --- a/packages/react/src/SubNav/SubNav.tsx +++ b/packages/react/src/SubNav/SubNav.tsx @@ -1,60 +1,48 @@ import {clsx} from 'clsx' import type {To} from 'history' import React from 'react' -import type {ComponentProps} from '../utils/types' import styles from './SubNav.module.css' -import type {SxProp} from '../sx' -import {BoxWithFallback} from '../internal/components/BoxWithFallback' -type StyledSubNavProps = React.ComponentProps<'nav'> & { +export type SubNavProps = React.ComponentProps<'nav'> & { actions?: React.ReactNode align?: 'right' full?: boolean label?: string -} & SxProp -type StyledSubNavLinksProps = React.ComponentProps<'div'> & SxProp -type StyledSubNavLinkProps = React.ComponentProps<'a'> & {to?: To; selected?: boolean} & SxProp +} +export type SubNavLinksProps = React.ComponentProps<'div'> +export type SubNavLinkProps = React.ComponentProps<'a'> & {to?: To; selected?: boolean} -const SubNav = React.forwardRef(function SubNav( +const SubNav = React.forwardRef(function SubNav( {actions, className, children, label, ...rest}, forwardRef, ) { return ( - + ) }) SubNav.displayName = 'SubNav' // SubNav.Links -const SubNavLinks = React.forwardRef( - ({children, className, ...rest}, forwardRef) => { - return ( - - {children} - - ) - }, -) +const SubNavLinks = React.forwardRef(({children, className, ...rest}, forwardRef) => { + return ( +
+ {children} +
+ ) +}) SubNavLinks.displayName = 'SubNav.Links' // SubNav.Link -const SubNavLink = React.forwardRef( +const SubNavLink = React.forwardRef( ({children, className, ...rest}, forwardRef) => { return ( - ( {...rest} > {children} - + ) }, ) SubNavLink.displayName = 'SubNav.Link' -export type SubNavProps = ComponentProps -export type SubNavLinksProps = ComponentProps -export type SubNavLinkProps = ComponentProps export default Object.assign(SubNav, {Link: SubNavLink, Links: SubNavLinks})