2020-07-02 09:38:39 +03:00
|
|
|
import * as React from "react";
|
2021-08-18 23:12:57 +03:00
|
|
|
import * as System from "~/components/system";
|
2020-07-02 09:38:39 +03:00
|
|
|
|
2020-11-30 08:24:22 +03:00
|
|
|
import { css } from "@emotion/react";
|
2020-07-29 02:08:38 +03:00
|
|
|
|
|
|
|
const STYLES_FILE_HIDDEN = css`
|
|
|
|
height: 1px;
|
|
|
|
width: 1px;
|
|
|
|
opacity: 0;
|
|
|
|
visibility: hidden;
|
|
|
|
position: fixed;
|
|
|
|
top: -1px;
|
|
|
|
left: -1px;
|
|
|
|
`;
|
|
|
|
|
2020-07-16 08:48:51 +03:00
|
|
|
export default class SlateReactSystemPage extends React.Component {
|
2020-08-06 23:52:47 +03:00
|
|
|
async componentDidMount() {
|
|
|
|
const url = "/api/v1/get";
|
|
|
|
const response = await fetch(url, {
|
|
|
|
headers: {
|
2021-07-31 01:00:06 +03:00
|
|
|
Authorization: "SLA85621d2d-1bc1-4c35-9e3a-1e43689c155fTE",
|
2020-08-06 23:52:47 +03:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const json = await response.json();
|
|
|
|
}
|
|
|
|
|
2020-07-29 02:08:38 +03:00
|
|
|
_handleUpload = async (e) => {
|
|
|
|
e.persist();
|
|
|
|
|
2020-12-27 09:19:11 +03:00
|
|
|
const url = "https://uploads.slate.host/api/public/--";
|
2020-07-29 02:08:38 +03:00
|
|
|
let file = e.target.files[0];
|
|
|
|
let data = new FormData();
|
|
|
|
|
2020-08-03 19:41:26 +03:00
|
|
|
data.append("data", file);
|
2020-07-29 02:08:38 +03:00
|
|
|
const response = await fetch(url, {
|
|
|
|
method: "POST",
|
|
|
|
headers: {
|
2021-07-31 01:00:06 +03:00
|
|
|
Authorization: "--",
|
2020-07-29 02:08:38 +03:00
|
|
|
},
|
|
|
|
body: data,
|
|
|
|
});
|
|
|
|
|
|
|
|
const json = await response.json();
|
|
|
|
};
|
|
|
|
|
2020-07-02 09:38:39 +03:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
2020-11-26 02:19:02 +03:00
|
|
|
<System.GlobalTooltip />
|
2020-07-02 09:38:39 +03:00
|
|
|
<System.H1>Component Library Test</System.H1>
|
|
|
|
<br />
|
|
|
|
<br />
|
2021-07-07 23:50:57 +03:00
|
|
|
<System.P1>
|
2020-11-04 20:55:48 +03:00
|
|
|
If this works. That means the component library bundle is working correctly.
|
2021-07-07 23:50:57 +03:00
|
|
|
</System.P1>
|
2020-08-02 02:20:25 +03:00
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<div style={{ marginTop: 24 }}>
|
2020-11-04 20:55:48 +03:00
|
|
|
<input css={STYLES_FILE_HIDDEN} type="file" id="file" onChange={this._handleUpload} />
|
|
|
|
<System.ButtonPrimary style={{ margin: "0 16px 16px 0" }} type="label" htmlFor="file">
|
2020-09-13 04:12:56 +03:00
|
|
|
Upload file To network with API
|
2020-08-02 02:20:25 +03:00
|
|
|
</System.ButtonPrimary>
|
2020-11-26 02:19:02 +03:00
|
|
|
<System.TooltipAnchor
|
|
|
|
type="body"
|
|
|
|
id="another-unique-tooltip-id"
|
|
|
|
tooltip="Hello friends!"
|
|
|
|
/>
|
2020-08-02 02:20:25 +03:00
|
|
|
</div>
|
2020-07-02 09:38:39 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|