/* * Copyright (c) 2020 - present Cloudogu GmbH * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see https://www.gnu.org/licenses/. */ import { storiesOf } from "@storybook/react"; import React, { ReactElement } from "react"; import SecondaryNavigation from "./SecondaryNavigation"; import SecondaryNavigationItem from "./SecondaryNavigationItem"; import styled from "styled-components"; import SubNavigation from "./SubNavigation"; import { Binder, ExtensionPoint, BinderContext } from "@scm-manager/ui-extensions"; import { MemoryRouter } from "react-router-dom"; const Columns = styled.div` margin: 2rem; `; const starships = ( ); const withRoute = (route: string) => { return (story: ReactElement) => {story}; }; storiesOf("Secondary Navigation", module) .addDecorator((story) => (
{story()}
)) .add("Default", () => withRoute("/")( ) ) .add("Sub Navigation", () => withRoute("/")( {starships} ) ) .add("Extension Point", () => { const binder = new Binder("menu"); binder.bind("subnav.sample", starships); return withRoute("/hitchhiker/starships/titanic")( ); }) .add("Active when match", () => withRoute("/hog")( route.location?.pathname === "/hog"} to="/heart-of-gold" icon="fas fa-star" label="Heart Of Gold" title="Heart Of Gold" /> ) );