import { nanoid } from 'nanoid'; import classNames from 'classnames'; import { useState, useEffect, useRef } from 'react'; import Layout from '../components/layout'; import { Latest, Hero, Icon, Button, H6, H5, H2, P, MS, normalizeSubtext, normalizeSlug, useMobileMedia } from '../components/jambonz-ui'; import { getData } from '../lib/data'; function Tech({data}) { return ( {data.notes.map((note) => { return ( {note.title} {note.text} ); })} ); } function Dilemma({data}) { const mobile = useMobileMedia(); const initialRef = useRef(); const [active, setActive] = useState(null); const handleToggle = (slug) => { if (!mobile) { return; } if (slug === active) { setActive(null); } else { setActive(slug); } }; // Make sure jambonz is the default open toggle on mobile... useEffect(() => { if (mobile && !active && !initialRef.current) { initialRef.current = true; setActive('jambonz'); } }, [mobile, active, setActive, initialRef]); return ( {data.headline} {/* Use dangerouslySetInnerHTML to render inline spans from YAML data */} {normalizeSubtext(data.subtext).map((subtext) => )} {data.tables.map((table) => { const slug = normalizeSlug(table.title); const isActiveToggle = (active === slug); const isTableLogo = (table.logo ? true : false); const tableClasses = { 'dilemma__table': true, 'dilemma__table--jambonz': isTableLogo, }; const pointsClasses = { 'dilemma__table__points': true, 'active': isActiveToggle, }; return ( handleToggle(slug)}> {table.logo ? : {table.title}} {isActiveToggle ? : } {table.points.map((point) => { const classes = { 'dilemma__table__point': true, [point.icon.toLowerCase()]: true, }; return ( {normalizeSubtext(point.text).map((text) => { return {text}; })} ); })} ); })} ); } function BYO({data}) { return ( {data.headline} {data.subtext} {data.icons.map((icon) => { return ; })} {/* Use dangerouslySetInnerHTML to render inline link from YAML data */} {data.cta} ); } export default function Home({ data }) { const latest = data.site.latest.find((item) => item.active); return ( {latest && } ); } export async function getStaticProps() { const data = getData('home'); return { props: { data, }, }; }
{table.title}