p5.js-web-editor/client/modules/IDE/components/ShareModal.jsx

41 lines
1,007 B
React
Raw Normal View History

2016-09-07 02:37:29 +00:00
import React, { PropTypes } from 'react';
2017-10-30 18:38:41 +00:00
import CopyableInput from './CopyableInput';
2017-10-30 18:38:41 +00:00
class ShareModal extends React.PureComponent {
render() {
const {
projectId,
ownerUsername,
projectName
} = this.props;
const hostname = window.location.origin;
return (
<div className="share-modal">
<h3 className="share-modal__project-name">
{projectName}
</h3>
<CopyableInput
label="Embed"
value={`<iframe src="${hostname}/embed/${projectId}"></iframe>`}
/>
2017-10-30 18:38:41 +00:00
<CopyableInput
label="Fullscreen"
value={`${hostname}/full/${projectId}`}
/>
2017-10-30 18:38:41 +00:00
<CopyableInput
label="Edit"
value={`${hostname}/${ownerUsername}/sketches/${projectId}`}
/>
</div>
2017-10-30 18:38:41 +00:00
);
}
2016-09-07 02:37:29 +00:00
}
ShareModal.propTypes = {
projectId: PropTypes.string.isRequired,
2017-10-30 18:38:41 +00:00
ownerUsername: PropTypes.string.isRequired,
projectName: PropTypes.string.isRequired
2016-09-07 02:37:29 +00:00
};
export default ShareModal;