-
-
Notifications
You must be signed in to change notification settings - Fork 612
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Blocks/Video/Edit component (#4960)
Co-authored-by: Nilesh <[email protected]>
- Loading branch information
1 parent
8615542
commit 1710f8b
Showing
3 changed files
with
163 additions
and
172 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Refactor Blocks/Video/Edit component from class to functional component. @Tishasoumya-02 |
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
57 changes: 57 additions & 0 deletions
57
packages/volto/src/components/manage/Blocks/Video/Edit.stories.jsx
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,57 @@ | ||
import { injectIntl } from 'react-intl'; | ||
import React from 'react'; | ||
import VideoComponent from './Edit'; | ||
import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook'; | ||
|
||
const IntlVideoComponent = injectIntl(VideoComponent); | ||
|
||
function StoryComponent(args) { | ||
return ( | ||
<Wrapper | ||
customStore={{ | ||
intl: { | ||
locale: 'en', | ||
messages: {}, | ||
}, | ||
}} | ||
> | ||
<div id="toolbar" style={{ display: 'none' }} /> | ||
<IntlVideoComponent | ||
data={{ | ||
...args, | ||
'@type': 'video', | ||
}} | ||
selected={false} | ||
block="1234" | ||
onChangeBlock={() => {}} | ||
onSelectBlock={() => {}} | ||
onDeleteBlock={() => {}} | ||
onFocusPreviousBlock={() => {}} | ||
onFocusNextBlock={() => {}} | ||
handleKeyDown={() => {}} | ||
index={1} | ||
/> | ||
</Wrapper> | ||
); | ||
} | ||
|
||
export const Video = StoryComponent.bind({}); | ||
|
||
Video.args = { | ||
url: 'https://www.youtube.com/watch?v=ayjNbKju-8s', | ||
}; | ||
|
||
export default { | ||
title: 'Public components/Video/Video', | ||
component: Video, | ||
decorators: [ | ||
(Story) => ( | ||
<div className="ui segment form attached" style={{ width: '600px' }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
argTypes: { | ||
// controlled value prop | ||
}, | ||
}; |