Adding semi-functional rendering demo of app
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
|
||||
import DownloadIcon from 'react-feather/dist/icons/download';
|
||||
import LinkIcon from 'react-feather/dist/icons/link';
|
||||
|
||||
import style from './style.module.css';
|
||||
|
||||
import AppContext from 'components/App/context';
|
||||
|
||||
class FormActions extends React.PureComponent {
|
||||
static contextType = AppContext
|
||||
|
||||
downloadLink({ url, filename, type, label }) {
|
||||
return <li>
|
||||
<a href={ url } download={ filename } type={ type }>
|
||||
<DownloadIcon />{ label }
|
||||
</a>
|
||||
</li>;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
permalinkUrl,
|
||||
svgLink,
|
||||
pngLink
|
||||
} = this.context;
|
||||
|
||||
return <ul className={ style.actions }>
|
||||
{ pngLink && this.downloadLink(pngLink) }
|
||||
{ svgLink && this.downloadLink(svgLink) }
|
||||
{ permalinkUrl && <li>
|
||||
<a href={ permalinkUrl }><LinkIcon />Permalink</a>
|
||||
</li> }
|
||||
</ul>;
|
||||
}
|
||||
}
|
||||
|
||||
export default FormActions;
|
||||
@@ -0,0 +1,19 @@
|
||||
@import url('../../globals.module.css');
|
||||
|
||||
.actions {
|
||||
composes: inline-list with-separator-left;
|
||||
float: right;
|
||||
|
||||
@media (max-width: 700px) {
|
||||
& li {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
& svg {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
margin-right: 0.5rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user