2020-07-09 06:19:08 +03:00
|
|
|
import * as React from "react";
|
|
|
|
import * as Constants from "~/common/constants";
|
2020-09-05 02:15:29 +03:00
|
|
|
import * as SVG from "~/common/svg";
|
2020-08-25 21:08:42 +03:00
|
|
|
import * as Strings from "~/common/strings";
|
2020-04-09 00:29:13 +03:00
|
|
|
|
2020-11-30 08:24:22 +03:00
|
|
|
import { css } from "@emotion/react";
|
2020-04-09 00:29:13 +03:00
|
|
|
|
2020-08-20 23:33:08 +03:00
|
|
|
import SlateMediaObject from "~/components/core/SlateMediaObject";
|
2020-04-09 00:29:13 +03:00
|
|
|
|
|
|
|
const STYLES_FLEX = css`
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
flex-direction: column;
|
2020-08-10 13:18:43 +03:00
|
|
|
height: 100vh;
|
2020-08-02 10:29:24 +03:00
|
|
|
background-color: ${Constants.system.pitchBlack};
|
2020-04-09 00:29:13 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_TOP = css`
|
|
|
|
background: ${Constants.system.pitchBlack};
|
2020-06-09 21:00:36 +03:00
|
|
|
border-bottom: 1px solid ${Constants.system.black};
|
2020-04-09 00:29:13 +03:00
|
|
|
color: ${Constants.system.white};
|
|
|
|
width: 100%;
|
2020-08-02 10:29:24 +03:00
|
|
|
padding: 12px 16px 12px 16px;
|
2020-04-09 00:29:13 +03:00
|
|
|
flex-shrink: 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_LEFT = css`
|
|
|
|
min-width: 10%;
|
|
|
|
width: 100%;
|
2020-08-02 10:29:24 +03:00
|
|
|
padding-right: 16px;
|
2020-04-09 00:29:13 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_RIGHT = css`
|
|
|
|
flex-shrink: 0;
|
|
|
|
cursor: pointer;
|
|
|
|
height: 100%;
|
2020-08-02 10:29:24 +03:00
|
|
|
padding-top: 4px;
|
2020-04-09 00:29:13 +03:00
|
|
|
transition: 200ms ease color;
|
2020-08-02 10:29:24 +03:00
|
|
|
user-select: none;
|
2020-04-09 00:29:13 +03:00
|
|
|
|
|
|
|
:hover {
|
|
|
|
color: ${Constants.system.brand};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_BOTTOM = css`
|
|
|
|
background: ${Constants.system.pitchBlack};
|
|
|
|
color: ${Constants.system.white};
|
|
|
|
padding: 12px 16px 12px 48px;
|
|
|
|
width: 100%;
|
|
|
|
flex-shrink: 0;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const STYLES_PATH = css`
|
2020-07-09 06:19:08 +03:00
|
|
|
font-family: "mono";
|
2020-04-09 00:29:13 +03:00
|
|
|
color: ${Constants.system.white};
|
|
|
|
font-size: 12px;
|
|
|
|
text-transform: uppercase;
|
|
|
|
overflow-wrap: break-word;
|
2020-08-02 10:29:24 +03:00
|
|
|
user-select: none;
|
2020-04-09 00:29:13 +03:00
|
|
|
`;
|
|
|
|
|
|
|
|
export default class SceneFile extends React.Component {
|
|
|
|
render() {
|
2020-11-28 04:19:30 +03:00
|
|
|
const cid = this.props.data.cid;
|
2020-08-25 21:08:42 +03:00
|
|
|
const fileURL = Strings.getCIDGatewayURL(cid);
|
2020-04-09 00:29:13 +03:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div css={STYLES_FLEX}>
|
|
|
|
<div css={STYLES_TOP}>
|
|
|
|
<div css={STYLES_LEFT}>
|
2020-08-02 10:29:24 +03:00
|
|
|
<a css={STYLES_PATH} href={fileURL} target="_blank">
|
|
|
|
{fileURL}
|
|
|
|
</a>
|
2020-04-09 00:29:13 +03:00
|
|
|
</div>
|
|
|
|
<div css={STYLES_RIGHT} onClick={() => this.props.onBack()}>
|
|
|
|
<SVG.Dismiss height="24px" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-20 23:33:08 +03:00
|
|
|
<SlateMediaObject data={this.props.data} />
|
2020-04-09 00:29:13 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|