import React, { useEffect, useState } from "react"; import Route from "../inc/Route"; import NavigationHeaderButton from "./NavigationHeaderButton"; /** * Navigation component. * * @param {Object} props component properties * @param {Array} props.routes routes array * @param {string | null} props.currentRoutePath current route path * @param {Function} props.setRoute set route path * @class */ function Navigation({ routes, currentRoutePath, setRoute }) { const [calculatedStyle, setCalculatedStyles] = useState({}); /** * useEffect hook. */ useEffect(() => { const style = { gridTemplateColumns: `repeat(${routes.length}, minmax(0,1fr))`, }; setCalculatedStyles(style); }, [routes]); return (
{routes.map(routeObj => { return ( ); })}
); } /** * @module Navigation */ export default Navigation;