From 261771edc7beb023e14029cffe65b8a2e78746e0 Mon Sep 17 00:00:00 2001 From: Josiah Ivey Date: Wed, 28 Feb 2024 19:57:07 -0800 Subject: [PATCH] add background, fix coverage and ladle example --- src/components/Tabs.spec.tsx | 18 ++- src/components/Tabs.stories.tsx | 5 +- src/components/Tabs.tsx | 3 +- .../__snapshots__/Tabs.spec.tsx.snap | 114 ++++++++++++++---- 4 files changed, 112 insertions(+), 28 deletions(-) diff --git a/src/components/Tabs.spec.tsx b/src/components/Tabs.spec.tsx index afed40f09..de19d2fec 100644 --- a/src/components/Tabs.spec.tsx +++ b/src/components/Tabs.spec.tsx @@ -34,6 +34,22 @@ describe("Tabs component", () => { ); expect(asFragment()).toMatchSnapshot(); }); + + it("renders large size", () => { + const { asFragment } = render( + + + First Item + Second Item + Last Item + + First Content Panel + Second Content Panel + Third Content Panel + , + ); + expect(asFragment()).toMatchSnapshot(); + }); }); describe("button-bar styling", () => { @@ -71,7 +87,7 @@ describe("Tabs component", () => { it("renders large size", () => { const { asFragment } = render( - + First Item Second Item diff --git a/src/components/Tabs.stories.tsx b/src/components/Tabs.stories.tsx index 03268a3e4..be43650d5 100644 --- a/src/components/Tabs.stories.tsx +++ b/src/components/Tabs.stories.tsx @@ -29,8 +29,9 @@ export const Examples = () => { return diff --git a/src/components/Tabs.tsx b/src/components/Tabs.tsx index a1dfa0385..a40f6a665 100644 --- a/src/components/Tabs.tsx +++ b/src/components/Tabs.tsx @@ -20,7 +20,8 @@ const buttonBarCss = css` .react-aria-Tab { padding: 0 1.6rem; min-height: ${({ size }: TabsProps) => - size === 'small' ? '2.8' : '4.8'}rem; + size === 'small' ? '2.8' : ( size === 'large' ? '4.8' : '4.0')}rem; + background: #fff; &[data-selected] { background: ${colors.palette.neutralLight}; diff --git a/src/components/__snapshots__/Tabs.spec.tsx.snap b/src/components/__snapshots__/Tabs.spec.tsx.snap index ffd70067e..854f470a7 100644 --- a/src/components/__snapshots__/Tabs.spec.tsx.snap +++ b/src/components/__snapshots__/Tabs.spec.tsx.snap @@ -3,7 +3,7 @@ exports[`Tabs component button-bar styling renders correctly with button-bar variant 1`] = `
@@ -13,17 +13,17 @@ exports[`Tabs component button-bar styling renders correctly with button-bar var class="react-aria-TabList" data-orientation="horizontal" data-rac="" - id="react-aria-3" + id="react-aria-4" role="tablist" >
@@ -69,7 +69,7 @@ exports[`Tabs component button-bar styling renders correctly with button-bar var exports[`Tabs component button-bar styling renders correctly with button-bar variant and small size 1`] = `
@@ -79,17 +79,17 @@ exports[`Tabs component button-bar styling renders correctly with button-bar var class="react-aria-TabList" data-orientation="horizontal" data-rac="" - id="react-aria-4" + id="react-aria-5" role="tablist" >
@@ -135,7 +135,7 @@ exports[`Tabs component button-bar styling renders correctly with button-bar var exports[`Tabs component button-bar styling renders large size 1`] = `
@@ -145,17 +145,17 @@ exports[`Tabs component button-bar styling renders large size 1`] = ` class="react-aria-TabList" data-orientation="horizontal" data-rac="" - id="react-aria-5" + id="react-aria-6" role="tablist" >
@@ -329,3 +329,69 @@ exports[`Tabs component normal styling renders correctly with small size 1`] = `
`; + +exports[`Tabs component normal styling renders large size 1`] = ` + +
+
+ + + +
+
+ First Content Panel +
+
+
+`;