import get from 'lodash.get' import Icon from 'shared/components/icon/index.js' import nav from 'site/prebuild/navigation.js' import Link from 'next/link' import orderBy from 'lodash.orderby' import Logo from '@freesewing/components/Logo' import ThemePicker from 'shared/components/theme-picker.js' // TODO: Clean this up after restructuring markdown content const hide = ['contributors', 'developers', 'editors', 'translators'] // Don't show children for blog and showcase posts const keepClosed = ['blog', 'showcase', ] // TODO: For now we force tailwind to pickup these styles // At some point this should 'just work' though, but let's not worry about it now const force = [

,

] // Component for the collapse toggle const Chevron = ({w=8, m=2}) => // Helper method to filter out the real children const currentChildren = current => Object.values(current) .filter(entry => (typeof entry === 'object')) // Component that renders a sublevel of navigation const SubLevel = ({ nodes={} }) => (

) // Component that renders a toplevel of navigation const TopLevel = ({ icon, title, nav, current, slug, showChildren=false }) => (
{icon} {/* Wrapping this in a div because tailwind doesn't pick up classes on the next js Link component */}
{title}
{showChildren && }
{showChildren && }
) // Component that renders the logo first entry const TopLogo = ({ app }) => (
freesewing.{app.site}

{app.pitch}

) // Component that renders the theme picker first entry const TopTheme = ({ app }) => ( <>
Theme
) // TODO: Get rid of this when markdown has been restructured const remove = ['contributors', 'developers', 'editors', 'translators'] const Navigation = ({ nav, app }) => { const output = [] for (const key of Object.keys(nav[app.language]).sort()) { if (hide.indexOf(key) === -1) output.push(} title={key} slug={key} key={key} showChildren={keepClosed.indexOf(key) === -1} nav={nav[app.language]} current={orderBy(nav[app.language][key], ['order', 'title'], ['asc', 'asc'])} />) } return output } const PrimaryMenu = props => { return ( ) } export default PrimaryMenu