-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'trunk' into ts-sandbox
- Loading branch information
Showing
6 changed files
with
111 additions
and
3 deletions.
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
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
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
38 changes: 38 additions & 0 deletions
38
packages/components/src/responsive-wrapper/stories/index.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,38 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ResponsiveWrapper from '..'; | ||
|
||
const meta: ComponentMeta< typeof ResponsiveWrapper > = { | ||
component: ResponsiveWrapper, | ||
title: 'Components/ResponsiveWrapper', | ||
argTypes: { | ||
children: { control: { type: null } }, | ||
}, | ||
parameters: { | ||
controls: { expanded: true }, | ||
docs: { source: { state: 'open' } }, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
const Template: ComponentStory< typeof ResponsiveWrapper > = ( args ) => ( | ||
<ResponsiveWrapper { ...args } /> | ||
); | ||
|
||
export const Default = Template.bind( {} ); | ||
Default.args = { | ||
naturalWidth: 2000, | ||
naturalHeight: 680, | ||
children: ( | ||
<img | ||
src="https://s.w.org/style/images/about/WordPress-logotype-standard.png" | ||
alt="WordPress" | ||
/> | ||
), | ||
}; |
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,20 @@ | ||
export type ResponsiveWrapperProps = { | ||
/** | ||
* The intrinsic width of the element to wrap. Will be used to determine the aspect ratio. | ||
*/ | ||
naturalWidth: number; | ||
/** | ||
* The intrinsic height of the element to wrap. Will be used to determine the aspect ratio. | ||
*/ | ||
naturalHeight: number; | ||
/** | ||
* The element to wrap. | ||
*/ | ||
children: React.ReactElement; | ||
/** | ||
* If true, the wrapper will be `span` instead of `div`. | ||
* | ||
* @default false | ||
*/ | ||
isInline?: boolean; | ||
}; |
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