2020-04-19 20:06:17 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
import Section from '../../../.storybook/decorators/section';
|
|
|
|
import MediaViewer from '.';
|
2020-04-29 14:11:01 +00:00
|
|
|
import { Button } from 'asc-web-components';
|
2020-04-19 20:06:17 +00:00
|
|
|
import withReadme from 'storybook-readme/with-readme';
|
|
|
|
import { withKnobs, boolean, text } from '@storybook/addon-knobs/react';
|
|
|
|
import Readme from './README.md';
|
|
|
|
|
2020-05-05 13:23:29 +00:00
|
|
|
var playlist = [
|
|
|
|
{
|
|
|
|
id: 0,
|
2020-05-13 07:18:28 +00:00
|
|
|
fileId: 0,
|
2020-05-05 13:23:29 +00:00
|
|
|
src: "",
|
|
|
|
title: ""
|
|
|
|
}
|
|
|
|
];
|
2020-04-30 07:35:02 +00:00
|
|
|
class MediaViewerStory extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
visible: false
|
2020-04-29 14:11:01 +00:00
|
|
|
};
|
2020-04-30 07:35:02 +00:00
|
|
|
}
|
|
|
|
buttonClick = () => {
|
|
|
|
this.setState({
|
|
|
|
visible: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
onClose = () => {
|
|
|
|
this.setState({
|
|
|
|
visible: false
|
|
|
|
});
|
|
|
|
};
|
2020-04-29 14:11:01 +00:00
|
|
|
|
2020-04-30 07:35:02 +00:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Section>
|
|
|
|
<div style={{ marginBottom: '20px' }}>
|
|
|
|
<Button
|
|
|
|
label="Open"
|
|
|
|
onClick={this.buttonClick}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<MediaViewer
|
2020-05-06 13:36:17 +00:00
|
|
|
currentFileId = {0}
|
2020-04-30 07:35:02 +00:00
|
|
|
allowConvert={true}
|
2020-05-05 13:23:29 +00:00
|
|
|
canDelete={(fileId) => {
|
|
|
|
if(fileId == 1) return false;
|
|
|
|
return true
|
|
|
|
}}
|
2020-04-30 07:35:02 +00:00
|
|
|
visible={this.state.visible}
|
2020-05-05 13:23:29 +00:00
|
|
|
playlist={playlist}
|
|
|
|
onDelete={ (fileId) => action('On delete')(fileId) }
|
|
|
|
onDownload={(fileId) => action('On download')(fileId)}
|
2020-04-30 07:35:02 +00:00
|
|
|
onClose={this.onClose}
|
|
|
|
extsMediaPreviewed={[".aac", ".flac", ".m4a", ".mp3", ".oga", ".ogg", ".wav", ".f4v", ".m4v", ".mov", ".mp4", ".ogv", ".webm", ".avi", ".mpg", ".mpeg", ".wmv"]}
|
|
|
|
extsImagePreviewed={[".bmp", ".gif", ".jpeg", ".jpg", ".png", ".ico", ".tif", ".tiff", ".webp"]}
|
|
|
|
/>
|
2020-04-29 14:11:01 +00:00
|
|
|
</Section>
|
2020-04-30 07:35:02 +00:00
|
|
|
)
|
2020-04-29 14:11:01 +00:00
|
|
|
}
|
2020-04-30 07:35:02 +00:00
|
|
|
}
|
2020-04-29 14:11:01 +00:00
|
|
|
|
|
|
|
storiesOf('Components|MediaViewer', module)
|
2020-04-30 07:35:02 +00:00
|
|
|
.addDecorator(withKnobs)
|
|
|
|
.addDecorator(withReadme(Readme))
|
|
|
|
.add('base', () => (
|
|
|
|
<Section>
|
|
|
|
|
|
|
|
<MediaViewerStory />
|
|
|
|
</Section>
|
|
|
|
));
|