/*
* 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 { MemoryRouter } from "react-router-dom";
// import styled from "styled-components";
// import { Binder, ExtensionPoint, BinderContext } from "@scm-manager/ui-extensions";
// import { SecondaryNavigationProvider } from "./SecondaryNavigationContext";
// import SecondaryNavigation from "./SecondaryNavigation";
// import SecondaryNavigationItem from "./SecondaryNavigationItem";
// import SubNavigation from "./SubNavigation";
//
// 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")(
//
//
// {/*TODO: fix after useAcitveMatch works*/}
// route.location?.pathname === "/hog"}
// to="/heart-of-gold"
// icon="fas fa-star"
// label="Heart Of Gold"
// title="Heart Of Gold"
// />
//
// )
// );
import React from "react";
import { MemoryRouter } from "react-router-dom";
import styled from "styled-components";
import type { Meta, StoryObj } from "@storybook/react";
import { Binder, ExtensionPoint, BinderContext } from "@scm-manager/ui-extensions";
import { SecondaryNavigationProvider } from "./SecondaryNavigationContext";
import SecondaryNavigation from "./SecondaryNavigation";
import SecondaryNavigationItem from "./SecondaryNavigationItem";
import SubNavigation from "./SubNavigation";
// --- Helfer-Komponenten und Mock-Daten (aus der Original-Story übernommen) ---
const Columns = styled.div`
margin: 2rem;
`;
const starships = (
);
// --- Storybook Metadaten ---
const meta: Meta = {
title: "Navigation/SecondaryNavigation",
component: SecondaryNavigation,
// Dieser Decorator wendet das Layout und den notwendigen Provider auf alle Stories an.
decorators: [
(Story) => {Story()},
(Story) => (
),
],
tags: ["autodocs"],
};
export default meta;
// --- Story-Definitionen ---
type Story = StoryObj;
// Da jede Story eine andere initiale Route für den MemoryRouter benötigt,
// verwenden wir für jede Story eine `render`-Funktion.
export const Default: Story = {
render: () => (
),
};
export const WithSubNavigation: Story = {
name: "With Sub-Navigation",
render: () => (
{starships}
),
};
export const WithExtensionPoint: Story = {
name: "With Extension Point",
render: () => {
const binder = new Binder("menu");
binder.bind("subnav.sample", starships);
return (
);
},
};
export const ActiveWhenMatch: Story = {
name: "Active When Match",
render: () => (
{/*TODO: fix after useAcitveMatch works*/}
route.location?.pathname === "/hog"}
to="/heart-of-gold"
icon="fas fa-star"
label="Heart Of Gold"
title="Heart Of Gold"
/>
),
};