2018-10-18 18:10:37 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
|
|
|
import { Link } from 'react-router';
|
2020-08-26 15:28:53 +00:00
|
|
|
import { withTranslation } from 'react-i18next';
|
2018-10-18 18:10:37 +00:00
|
|
|
|
2020-04-29 22:34:37 +00:00
|
|
|
import LogoIcon from '../images/p5js-logo-small.svg';
|
|
|
|
import CodeIcon from '../images/code.svg';
|
2018-10-18 18:10:37 +00:00
|
|
|
|
2020-08-26 15:28:53 +00:00
|
|
|
const PreviewNav = ({ owner, project, t }) => (
|
2019-11-07 21:56:46 +00:00
|
|
|
<nav className="nav preview-nav">
|
2018-10-18 18:10:37 +00:00
|
|
|
<div className="nav__items-left">
|
|
|
|
<div className="nav__item-logo">
|
2020-08-26 15:28:53 +00:00
|
|
|
<LogoIcon role="img" aria-label={t('Common.p5logoARIA')} focusable="false" className="svg__logo" />
|
2018-10-18 18:10:37 +00:00
|
|
|
</div>
|
|
|
|
<Link className="nav__item" to={`/${owner.username}/sketches/${project.id}`}>{project.name}</Link>
|
2020-08-26 15:28:53 +00:00
|
|
|
<p className="toolbar__project-owner">{t('PreviewNav.ByUser')}</p>
|
2018-10-18 18:10:37 +00:00
|
|
|
<Link className="nav__item" to={`/${owner.username}/sketches/`}>{owner.username}</Link>
|
|
|
|
</div>
|
|
|
|
<div className="nav__items-right">
|
2020-08-26 15:28:53 +00:00
|
|
|
<Link to={`/${owner.username}/sketches/${project.id}`} aria-label={t('PreviewNav.EditSketchARIA')} >
|
2020-05-05 23:03:58 +00:00
|
|
|
<CodeIcon className="preview-nav__editor-svg" focusable="false" aria-hidden="true" />
|
2018-10-18 18:10:37 +00:00
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
);
|
|
|
|
|
|
|
|
PreviewNav.propTypes = {
|
|
|
|
owner: PropTypes.shape({
|
|
|
|
username: PropTypes.string.isRequired
|
|
|
|
}).isRequired,
|
|
|
|
project: PropTypes.shape({
|
|
|
|
name: PropTypes.string.isRequired,
|
|
|
|
id: PropTypes.string.isRequired,
|
|
|
|
}).isRequired,
|
2020-08-26 15:28:53 +00:00
|
|
|
t: PropTypes.func.isRequired
|
2018-10-18 18:10:37 +00:00
|
|
|
};
|
|
|
|
|
2020-08-26 15:28:53 +00:00
|
|
|
export default withTranslation()(PreviewNav);
|