Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(storybook): seo links #8162

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ packages/playground/docs/FAQ.md

# Ignore the generated storybook related files
packages/playground/_stories/**/*/argTypes.ts
packages/playground/_stories/**/*/*Overview.mdx
packages/playground/.storybook/custom-elements.json
packages/playground/docs/storybook/**/*
packages/playground/docs/storybook-pages/**/*
Expand Down
5 changes: 0 additions & 5 deletions docs/6-contributing/04-writing-samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ Every story has a `docs` page in the storybook's sidebar. Usually, this page is
export default {
title: "Main/Button",
component,
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component })
},
},
argTypes,
} as Meta<Button>;
```
Expand Down
45 changes: 0 additions & 45 deletions packages/playground/.storybook/docs.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions packages/playground/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import remarkGfm from 'remark-gfm';

const config = {
stories: ["../docs/**/*.mdx", "../_stories/**/*.stories.@(ts)"],
stories: ["../docs/**/*.mdx", "../_stories/**/*.stories.@(ts)", "../_stories/**/*.mdx"],
staticDirs: [
{ from: "../assets", to: "../assets" }, // from /assets to /dist/assets
{ from: "../docs/storybook-pages", to: "/" }, // from /docs/storybook-pages to /dist/playground
Expand Down Expand Up @@ -42,7 +42,7 @@ const config = {
reactDocgen: 'react-docgen'
},
docs: {
autodocs: true
autodocs: 'tag'
}
};
export default config;
56 changes: 49 additions & 7 deletions packages/playground/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,55 @@ export const parameters: Parameters = {
.replace(/^\s*[\r\n]/gm, ""),
},
options: {
storySort: {
order: [
"Docs",
"Main",
"Fiori"
],
},
// @ts-ignore
storySort: (a, b) => {
// Define the sorting order
const sortOrder = {
"Docs": 1,
"Main": 2,
"Fiori": 3,
};

const sortSubOrder = ['Overview', 'Basic'];

// Function to get the order value for a given category
// @ts-ignore
function getOrder(category) {
// @ts-ignore
return sortOrder[category] || 4;
}

// Function to get sub-order for 'Main' and 'Fiori'
// @ts-ignore
function getSubOrder(title) {
let index = sortSubOrder.findIndex(keyword => title.endsWith(keyword));
return index === -1 ? sortSubOrder.length : index; // Default sub-order for titles not listed or found at the end
}

const aTitle = `${a.title}/${a.name}`;
const bTitle = `${b.title}/${b.name}`;

const partsA = aTitle.split('/');
const partsB = bTitle.split('/');

// Sort by primary category (Docs, Main, Fiori)
const orderA = getOrder(partsA[0]);
const orderB = getOrder(partsB[0]);
if (orderA !== orderB) {
return orderA - orderB;
}

// Within 'Main' and 'Fiori', sort by sub-order
if (partsA[0] === 'Main' || partsA[0] === 'Fiori') {
const subOrderA = getSubOrder(partsA[2]);
const subOrderB = getSubOrder(partsB[2]);
if (subOrderA !== subOrderB) {
return subOrderA - subOrderB;
}
}

return 1;
}
},
};

Expand Down
12 changes: 1 addition & 11 deletions packages/playground/_stories/fiori/Bar/Bar.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@ import { ifDefined } from "lit/directives/if-defined.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import type { Meta, StoryFn } from "@storybook/web-components";

import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../types.js";

import { DocsPage } from "../../../.storybook/docs";

import type Bar from "@ui5/webcomponents-fiori/dist/Bar.js";
import BarDesign from "@ui5/webcomponents-fiori/dist/types/BarDesign.js";

const component = "ui5-bar";

export default {
title: "Fiori/Bar",
component: "Bar",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component })
},
},
argTypes,
} as Meta<Bar>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
import { html } from "lit";
import type { Meta } from "@storybook/web-components";

import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../types.js";

import { DocsPage } from "../../../.storybook/docs";

// @ts-ignore
import type BarcodeScannerDialog from "@ui5/webcomponents-fiori/dist/BarcodeScannerDialog.js";

const component = "ui5-barcode-scanner-dialog";

export default {
title: "Fiori/Barcode Scanner Dialog",
component: "BarcodeScannerDialog",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component }),
},
},
argTypes,
} as Meta<BarcodeScannerDialog>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,17 @@ import { ifDefined } from "lit/directives/if-defined.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import type { Meta, StoryFn } from "@storybook/web-components";

import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../types.js";

import { DocsPage } from "../../../.storybook/docs";

import type DynamicSideContent from "@ui5/webcomponents-fiori/dist/DynamicSideContent.js";
import SideContentPosition from "@ui5/webcomponents-fiori/dist/types/SideContentPosition.js";
import SideContentFallDown from "@ui5/webcomponents-fiori/dist/types/SideContentFallDown.js";
import SideContentVisibility from "@ui5/webcomponents-fiori/dist/types/SideContentVisibility.js";

const component = "ui5-dynamic-side-content";

export default {
title: "Fiori/DynamicSideContent",
component: "DynamicSideContent",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component })
},
},
argTypes,
} as Meta<DynamicSideContent>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,14 @@ import { ifDefined } from "lit/directives/if-defined.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import type { Meta } from "@storybook/web-components";

import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../types.js";

import { DocsPage } from "../../../.storybook/docs";

import type FlexibleColumnLayout from "@ui5/webcomponents-fiori/dist/FlexibleColumnLayout.js";

const component = "ui5-flexible-column-layout";

export default {
title: "Fiori/Flexible Column Layout",
component: "FlexibleColumnLayout",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component })
},
},
argTypes,
} as Meta<FlexibleColumnLayout>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@ import { ifDefined } from "lit/directives/if-defined.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import type { Meta, StoryFn } from "@storybook/web-components";

import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../types.js";

import { DocsPage } from "../../../.storybook/docs";

import type IllustratedMessage from "@ui5/webcomponents-fiori/dist/IllustratedMessage.js";
import IllustrationMessageType from "@ui5/webcomponents-fiori/dist/types/IllustrationMessageType.js";

const component = "ui5-illustrated-message";

export default {
title: "Fiori/Illustrated Message",
component: "IllustratedMessage",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component }),
},
},
argTypes,
} as Meta<IllustratedMessage>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ import { ifDefined } from "lit/directives/if-defined.js";
import type { Meta, StoryFn } from "@storybook/web-components";
import type { PartialStoryFn } from "@storybook/types";

import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../types.js";

import { DocsPage } from "../../../.storybook/docs";

import MediaGallery from "@ui5/webcomponents-fiori/dist/MediaGallery.js";
import TemplateMediaGalleryTypes from "./TemplateMediaGalleryTypes.js";

const component = "ui5-media-gallery";

const stylesDecorator = (storyFn: PartialStoryFn) => html`
<style>
ui5-media-gallery-item:not(:defined) {
Expand All @@ -33,11 +28,6 @@ const stylesDecorator = (storyFn: PartialStoryFn) => html`
export default {
title: "Fiori/Media Gallery",
component: "MediaGallery",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component }),
},
},
decorators: [stylesDecorator],
argTypes,
} as Meta<MediaGallery>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import { ifDefined } from "lit/directives/if-defined.js";
import type { Meta, StoryFn } from "@storybook/web-components";
import type { PartialStoryFn } from "@storybook/types";

import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../../types.js";

import { DocsPage } from "../../../../.storybook/docs.js";

import MediaGalleryItem from "@ui5/webcomponents-fiori/dist/MediaGalleryItem.js";

const component = "ui5-media-gallery-item";

const stylesDecorator = (storyFn: PartialStoryFn) => html`
<style>
ui5-media-gallery-item:not(:defined) {
Expand All @@ -32,11 +28,6 @@ const stylesDecorator = (storyFn: PartialStoryFn) => html`
export default {
title: "Fiori/Media Gallery/Media Gallery Item",
component: "MediaGalleryItem",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component, showDefaultStoryOnly: true }),
}
},
decorators: [stylesDecorator],
argTypes,
} as Meta<MediaGalleryItem>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ import { html } from "lit";
import { ifDefined } from "lit/directives/if-defined.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import type { Meta } from "@storybook/web-components";
import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../../types.js";
import { DocsPage } from "../../../../.storybook/docs.js";
import type NotificationAction from "@ui5/webcomponents-fiori/dist/NotificationAction.js";

const component = "ui5-notification-action";

export default {
title: "Fiori/Notification List Group Item/Notification Action",
component: "NotificationAction",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component, showDefaultStoryOnly: true }),
story: {
iframeHeight: "470px",
inline: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,17 @@ import { html } from "lit";
import { ifDefined } from "lit/directives/if-defined.js";
import { unsafeHTML } from "lit/directives/unsafe-html.js";
import type { Meta, StoryFn } from "@storybook/web-components";
import argTypes, { componentInfo } from "./argTypes.js";
import argTypes from "./argTypes.js";
import type { StoryArgsSlots } from "./argTypes.js";
import type { UI5StoryArgs } from "../../../types.js";
import { DocsPage } from "../../../.storybook/docs";
import type NotificationListGroupItem from "@ui5/webcomponents-fiori/dist/NotificationListGroupItem.js";
import Priority from "@ui5/webcomponents/dist/types/Priority.js";

const component = "ui5-li-notification-group";

export default {
title: "Fiori/Notification List Group Item",
component: "NotificationListGroupItem",
parameters: {
docs: {
page: DocsPage({ ...componentInfo, component }),
story: {
// Opt-out of inline rendering
inline: false,
Expand Down
Loading
Loading