mirror of
https://github.com/moroshko/rxviz.git
synced 2026-01-25 16:46:24 +00:00
* Fixed Vercel CI * Next.js updated from 3.0.0-beta9 to 9.5.1 * Removed deprecated default prefetch attribute * Fixed _error.js warning * Moved deprecated static/ directory to public/ * Fixed missing return on the error404 component * Fixed Link component used for an external URL * Feedback page updated to a function component with useEffect * Editor component updated to use global jsx styles * CodeMirror updated from 5.26.0 to 5.56.0 * Client-side default example 'redirect' on the root path * Update feedback.js * Update feedback.js Co-authored-by: Misha Moroshko <michael.moroshko@gmail.com>
50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import Link from 'next/link';
|
|
|
|
const renderItem = ({ text, isActive }) => (
|
|
<a className={isActive ? 'active' : null}>
|
|
{text}
|
|
<style jsx>{`
|
|
a {
|
|
padding: 12px 25px;
|
|
display: block;
|
|
color: #eeeff0;
|
|
text-decoration: none;
|
|
cursor: default;
|
|
opacity: 0.6;
|
|
transition: opacity 0.1s linear;
|
|
}
|
|
a:hover {
|
|
background-color: #2c3038;
|
|
}
|
|
a[href] {
|
|
cursor: pointer;
|
|
}
|
|
.active {
|
|
padding-left: 22px;
|
|
border-left: 3px solid #e0168f;
|
|
background-color: #2c3038;
|
|
opacity: 1;
|
|
}
|
|
`}</style>
|
|
</a>
|
|
);
|
|
|
|
const SidebarItem = ({ text, isActive, href, as }) =>
|
|
isActive ? (
|
|
renderItem({ text, isActive })
|
|
) : (
|
|
<Link as={as} href={href}>
|
|
{renderItem({ text, isActive })}
|
|
</Link>
|
|
);
|
|
|
|
SidebarItem.propTypes = {
|
|
text: PropTypes.string.isRequired,
|
|
isActive: PropTypes.bool.isRequired,
|
|
href: PropTypes.string.isRequired,
|
|
as: PropTypes.string
|
|
};
|
|
|
|
export default SidebarItem;
|