mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-14 00:40:25 +00:00
vertical nav bar implemented
This commit is contained in:
parent
8a9dae6ddc
commit
81cff243f5
3 changed files with 67 additions and 0 deletions
41
src/common/VerticalNavBar/VerticalNavBar.js
Normal file
41
src/common/VerticalNavBar/VerticalNavBar.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
const React = require('react');
|
||||
const PropTypes = require('prop-types');
|
||||
const classnames = require('classnames');
|
||||
const NavTabButton = require('../NavBar/NavTabButton');
|
||||
const styles = require('./styles');
|
||||
|
||||
const VerticalNavBar = React.memo(({ className, tabs }) => {
|
||||
return (
|
||||
<nav className={classnames(className, styles['nav-bar-container'])}>
|
||||
{
|
||||
Array.isArray(tabs) && tabs.length > 0 ?
|
||||
tabs.map(({ href = '', icon = '', label = '', onClick }) => (
|
||||
<NavTabButton
|
||||
key={`${href}${icon}${label}`}
|
||||
className={styles['nav-tab-button']}
|
||||
href={href}
|
||||
icon={icon}
|
||||
label={label}
|
||||
onClick={onClick}
|
||||
/>
|
||||
))
|
||||
:
|
||||
null
|
||||
}
|
||||
</nav>
|
||||
);
|
||||
});
|
||||
|
||||
VerticalNavBar.displayName = 'VerticalNavBar';
|
||||
|
||||
VerticalNavBar.propTypes = {
|
||||
className: PropTypes.string,
|
||||
tabs: PropTypes.arrayOf(PropTypes.shape({
|
||||
icon: PropTypes.string,
|
||||
label: PropTypes.string,
|
||||
href: PropTypes.string,
|
||||
onClick: PropTypes.func
|
||||
}))
|
||||
};
|
||||
|
||||
module.exports = VerticalNavBar;
|
||||
3
src/common/VerticalNavBar/index.js
Normal file
3
src/common/VerticalNavBar/index.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
const VerticalNavBar = require('./VerticalNavBar');
|
||||
|
||||
module.exports = VerticalNavBar;
|
||||
23
src/common/VerticalNavBar/styles.less
Normal file
23
src/common/VerticalNavBar/styles.less
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
.nav-bar-container {
|
||||
--nav-bar-size: 4.4rem;
|
||||
width: var(--nav-bar-size);
|
||||
padding: 1rem 0;
|
||||
background-color: var(--color-backgroundlighter);
|
||||
|
||||
.nav-tab-button {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
height: var(--nav-bar-size);
|
||||
padding: 0.5rem;
|
||||
|
||||
> :first-child {
|
||||
margin: 0 0 0.5rem 0;
|
||||
}
|
||||
|
||||
> :last-child {
|
||||
max-height: 1.2em;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue