DocSpace-client/web/ASC.Web.Common/src/components/MediaViewer/MediaViewer.stories.js

75 lines
1.9 KiB
JavaScript
Raw Normal View History

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 '.';
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';
var playlist = [
{
id: 0,
fileId: 0,
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-30 07:35:02 +00:00
}
buttonClick = () => {
this.setState({
visible: true
});
}
onClose = () => {
this.setState({
visible: false
});
};
2020-04-30 07:35:02 +00:00
render() {
return (
<Section>
<div style={{ marginBottom: '20px' }}>
<Button
label="Open"
onClick={this.buttonClick}
/>
</div>
<MediaViewer
currentFileId = {0}
2020-04-30 07:35:02 +00:00
allowConvert={true}
canDelete={(fileId) => {
if(fileId == 1) return false;
return true
}}
2020-04-30 07:35:02 +00:00
visible={this.state.visible}
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"]}
/>
</Section>
2020-04-30 07:35:02 +00:00
)
}
2020-04-30 07:35:02 +00:00
}
storiesOf('Components|MediaViewer', module)
2020-04-30 07:35:02 +00:00
.addDecorator(withKnobs)
.addDecorator(withReadme(Readme))
.add('base', () => (
<Section>
<MediaViewerStory />
</Section>
));