This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Storybook entry for
TotalsWrapper
(#11784)
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Canvas, Meta, ArgTypes, Primary, Source, Controls } from '@storybook/blocks'; | ||
|
||
import * as TotalsWrapperStories from '../stories/index.stories.tsx'; | ||
|
||
<Meta name="Docs" of={ TotalsWrapperStories } /> | ||
|
||
# TotalsWrapper | ||
|
||
A wrapper to go around any items displayed in the "Totals" area of the Cart/Checkout blocks. Usually it comes with additional padding so the component rendered inside it doesn't need to add its own padding. If this is being used to wrap a Slot (for use in Slot/Fill patterns) then no padding will be applied. | ||
|
||
<Primary /> | ||
|
||
### Props | ||
|
||
<Controls /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/components/totals-wrapper/stories/index.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { StoryFn, Meta } from '@storybook/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import TotalsWrapper, { TotalsWrapperProps } from '..'; | ||
|
||
export default { | ||
title: 'External Components/Totals/TotalsWrapper', | ||
component: TotalsWrapper, | ||
argTypes: { | ||
className: { | ||
control: 'text', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
children: { | ||
control: null, | ||
table: { | ||
type: { | ||
summary: 'React.Children', | ||
}, | ||
}, | ||
}, | ||
slotWrapper: { | ||
control: 'boolean', | ||
table: { | ||
type: { | ||
summary: 'boolean', | ||
}, | ||
}, | ||
description: | ||
'True if this `TotalsWrapper` is being used to wrap a Slot/Fill', | ||
}, | ||
}, | ||
} as Meta< TotalsWrapperProps >; | ||
const Template: StoryFn< TotalsWrapperProps > = ( args ) => { | ||
return ( | ||
<TotalsWrapper { ...args }> | ||
<div>Custom totals content</div> | ||
</TotalsWrapper> | ||
); | ||
}; | ||
|
||
export const Default = Template.bind( {} ); | ||
Default.args = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters