forked from processing/p5.js-web-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreviewNav.jsx
59 lines (55 loc) · 1.6 KB
/
PreviewNav.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import PropTypes from 'prop-types';
import React from 'react';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import LogoIcon from '../images/p5js-logo-small.svg';
import CodeIcon from '../images/code.svg';
const PreviewNav = ({ owner, project }) => {
const { t } = useTranslation();
return (
<nav className="nav preview-nav">
<div className="nav__items-left">
<div className="nav__item-logo">
<LogoIcon
role="img"
aria-label={t('Common.p5logoARIA')}
focusable="false"
className="svg__logo"
/>
</div>
<Link
className="nav__item"
to={`/${owner.username}/sketches/${project.id}`}
>
{project.name}
</Link>
<p className="toolbar__project-owner">{t('PreviewNav.ByUser')}</p>
<Link className="nav__item" to={`/${owner.username}/sketches/`}>
{owner.username}
</Link>
</div>
<div className="nav__items-right">
<Link
to={`/${owner.username}/sketches/${project.id}`}
aria-label={t('PreviewNav.EditSketchARIA')}
>
<CodeIcon
className="preview-nav__editor-svg"
focusable="false"
aria-hidden="true"
/>
</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
};
export default PreviewNav;