-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Storybook: Add Image Editor Component
- Loading branch information
Showing
1 changed file
with
142 additions
and
0 deletions.
There are no files selected for viewing
142 changes: 142 additions & 0 deletions
142
packages/block-editor/src/components/image-editor/stories/index.story.js
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,142 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import ImageEditor from '..'; | ||
|
||
const meta = { | ||
title: 'BlockEditor/ImageEditor', | ||
component: ImageEditor, | ||
parameters: { | ||
docs: { | ||
canvas: { sourceState: 'shown' }, | ||
description: { | ||
component: | ||
'The `ImageEditor` component is used to edit images in the block editor', | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
id: { | ||
control: { | ||
type: 'text', | ||
}, | ||
description: 'The id of the image being edited', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
url: { | ||
control: { | ||
type: 'text', | ||
}, | ||
description: 'The url of the image being edited', | ||
table: { | ||
type: { | ||
summary: 'string', | ||
}, | ||
}, | ||
}, | ||
width: { | ||
control: { | ||
type: 'number', | ||
}, | ||
description: 'The width of the image being edited', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
}, | ||
height: { | ||
control: { | ||
type: 'number', | ||
}, | ||
description: 'The height of the image being edited', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
}, | ||
naturalHeight: { | ||
control: { | ||
type: 'number', | ||
}, | ||
description: 'The natural height of the image being edited', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
}, | ||
naturalWidth: { | ||
control: { | ||
type: 'number', | ||
}, | ||
description: 'The natural width of the image being edited', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
}, | ||
onSaveImage: { | ||
control: { | ||
type: 'function', | ||
}, | ||
description: 'Function to call when the image is saved', | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
}, | ||
onFinishEditing: { | ||
control: { | ||
type: 'function', | ||
}, | ||
description: 'Function to call when editing is finished', | ||
table: { | ||
type: { | ||
summary: 'function', | ||
}, | ||
}, | ||
}, | ||
borderProps: { | ||
control: { | ||
type: 'object', | ||
}, | ||
description: 'Border properties of the image being edited', | ||
table: { | ||
type: { | ||
summary: 'object', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default = { | ||
args: { | ||
id: 'image-id', | ||
url: 'https://cdn-icons-png.flaticon.com/512/174/174881.png', | ||
width: 300, | ||
height: 200, | ||
naturalHeight: 600, | ||
naturalWidth: 800, | ||
onSaveImage: () => {}, | ||
onFinishEditing: () => {}, | ||
borderProps: { | ||
borderRadius: 5, | ||
borderWidth: 1, | ||
borderColor: 'green', | ||
}, | ||
}, | ||
render: function Template( args ) { | ||
return <ImageEditor { ...args } />; | ||
}, | ||
}; |