mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-11-19 18:08:13 +00:00
54 lines
1.4 KiB
React
54 lines
1.4 KiB
React
import React from 'react';
|
|
import cx from 'classnames';
|
|
|
|
import NaturalCritIcon from '@components/svg/naturalcrit-d20.svg.jsx';
|
|
|
|
const Nav = {
|
|
base : ({ children, className, ...props })=>{
|
|
return <nav className={className}>
|
|
{children}
|
|
</nav>;
|
|
},
|
|
logo : ()=>{
|
|
return <a className='navLogo' href='https://www.naturalcrit.com'>
|
|
<NaturalCritIcon />
|
|
<span className='name'>
|
|
Natural<span className='crit'>Crit</span>
|
|
</span>
|
|
</a>;
|
|
},
|
|
|
|
section : ({ children, className, ...props })=>{
|
|
return <div className={cx([`navSection`, className])}>
|
|
{children}
|
|
</div>;
|
|
},
|
|
|
|
item : ({ icon, kbd, href, newTab, onClick, children, className, disabled, noDismiss, ...props })=>{
|
|
const classes = cx('navItem', className);
|
|
if(disabled) {
|
|
return <button className={classes} disabled>{icon && <i className={icon}></i>}{children}</button>;
|
|
}
|
|
if(href){
|
|
return <a className={classes} href={href} target={newTab ? '_blank' : '_self'} {...props}>
|
|
{icon && <i className={icon}></i>}
|
|
{children}
|
|
</a>;
|
|
} else {
|
|
return <button {...props} no-dismiss={noDismiss ? 'true' : undefined} className={classes} onClick={onClick} >
|
|
{icon && <i className={icon}></i>}
|
|
{children}
|
|
{kbd && <kbd>{kbd}</kbd>}
|
|
</button>;
|
|
}
|
|
},
|
|
header : ({ span, className, children, ...props })=>{
|
|
return <span className={cx([`navItem header`, className])} no-dismiss='true'>
|
|
{children}
|
|
</span>;
|
|
},
|
|
|
|
};
|
|
|
|
export default Nav;
|