2020-10-16 12:38:04 +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 ".";
|
2021-02-25 21:19:45 +00:00
|
|
|
import Button from "@appserver/components/button";
|
2020-10-16 12:38:04 +00:00
|
|
|
import withReadme from "storybook-readme/with-readme";
|
|
|
|
import { withKnobs, boolean, text } from "@storybook/addon-knobs/react";
|
|
|
|
import Readme from "./README.md";
|
2020-04-19 20:06:17 +00:00
|
|
|
|
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: "",
|
2020-10-16 12:38:04 +00:00
|
|
|
title: "",
|
|
|
|
},
|
2020-05-05 13:23:29 +00:00
|
|
|
];
|
2020-04-30 07:35:02 +00:00
|
|
|
class MediaViewerStory extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
2020-10-16 12:38:04 +00:00
|
|
|
visible: false,
|
2020-04-29 14:11:01 +00:00
|
|
|
};
|
2020-04-30 07:35:02 +00:00
|
|
|
}
|
|
|
|
buttonClick = () => {
|
|
|
|
this.setState({
|
2020-10-16 12:38:04 +00:00
|
|
|
visible: true,
|
2020-04-30 07:35:02 +00:00
|
|
|
});
|
2020-10-16 12:38:04 +00:00
|
|
|
};
|
2020-04-30 07:35:02 +00:00
|
|
|
onClose = () => {
|
|
|
|
this.setState({
|
2020-10-16 12:38:04 +00:00
|
|
|
visible: false,
|
2020-04-30 07:35:02 +00:00
|
|
|
});
|
|
|
|
};
|
2020-04-29 14:11:01 +00:00
|
|
|
|
2020-04-30 07:35:02 +00:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<Section>
|
2020-10-16 12:38:04 +00:00
|
|
|
<div style={{ marginBottom: "20px" }}>
|
|
|
|
<Button label="Open" onClick={this.buttonClick} />
|
2020-04-30 07:35:02 +00:00
|
|
|
</div>
|
|
|
|
<MediaViewer
|
2020-10-16 12:38:04 +00:00
|
|
|
currentFileId={0}
|
2020-04-30 07:35:02 +00:00
|
|
|
allowConvert={true}
|
2020-10-16 12:38:04 +00:00
|
|
|
canDelete={(fileId) => {
|
|
|
|
if (fileId == 1) return false;
|
|
|
|
return true;
|
2020-05-05 13:23:29 +00:00
|
|
|
}}
|
2020-04-30 07:35:02 +00:00
|
|
|
visible={this.state.visible}
|
2020-05-05 13:23:29 +00:00
|
|
|
playlist={playlist}
|
2020-10-16 12:38:04 +00:00
|
|
|
onDelete={(fileId) => action("On delete")(fileId)}
|
|
|
|
onDownload={(fileId) => action("On download")(fileId)}
|
2020-04-30 07:35:02 +00:00
|
|
|
onClose={this.onClose}
|
2020-10-16 12:38:04 +00:00
|
|
|
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-30 07:35:02 +00:00
|
|
|
/>
|
2020-04-29 14:11:01 +00:00
|
|
|
</Section>
|
2020-10-16 12:38:04 +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
|
|
|
|
2020-10-16 12:38:04 +00:00
|
|
|
storiesOf("Components|MediaViewer", module)
|
2020-04-30 07:35:02 +00:00
|
|
|
.addDecorator(withKnobs)
|
|
|
|
.addDecorator(withReadme(Readme))
|
2020-10-16 12:38:04 +00:00
|
|
|
.add("base", () => (
|
2020-04-30 07:35:02 +00:00
|
|
|
<Section>
|
|
|
|
<MediaViewerStory />
|
|
|
|
</Section>
|
|
|
|
));
|