Skip to content

Commit e409f69

Browse files
dobrinyonkovtsanislavgatev
authored andcommitted
docs(storybook): seo links (#8162)
* docs: stroybook seo links * docs: remove docs.tsx usage * chore: fix missing new lies
1 parent fa3d5c7 commit e409f69

File tree

119 files changed

+260
-1177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+260
-1177
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ packages/playground/docs/FAQ.md
8383

8484
# Ignore the generated storybook related files
8585
packages/playground/_stories/**/*/argTypes.ts
86+
packages/playground/_stories/**/*/*Overview.mdx
8687
packages/playground/.storybook/custom-elements.json
8788
packages/playground/docs/storybook/**/*
8889
packages/playground/docs/storybook-pages/**/*

docs/6-contributing/04-writing-samples.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ Every story has a `docs` page in the storybook's sidebar. Usually, this page is
119119
export default {
120120
title: "Main/Button",
121121
component,
122-
parameters: {
123-
docs: {
124-
page: DocsPage({ ...componentInfo, component })
125-
},
126-
},
127122
argTypes,
128123
} as Meta<Button>;
129124
```

packages/playground/.storybook/docs.tsx

Lines changed: 0 additions & 45 deletions
This file was deleted.

packages/playground/.storybook/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import remarkGfm from 'remark-gfm';
22

33
const config = {
4-
stories: ["../docs/**/*.mdx", "../_stories/**/*.stories.@(ts)"],
4+
stories: ["../docs/**/*.mdx", "../_stories/**/*.stories.@(ts)", "../_stories/**/*.mdx"],
55
staticDirs: [
66
{ from: "../assets", to: "../assets" }, // from /assets to /dist/assets
77
{ from: "../docs/storybook-pages", to: "/" }, // from /docs/storybook-pages to /dist/playground
@@ -42,7 +42,7 @@ const config = {
4242
reactDocgen: 'react-docgen'
4343
},
4444
docs: {
45-
autodocs: true
45+
autodocs: 'tag'
4646
}
4747
};
4848
export default config;

packages/playground/.storybook/preview.ts

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,55 @@ export const parameters: Parameters = {
3636
.replace(/^\s*[\r\n]/gm, ""),
3737
},
3838
options: {
39-
storySort: {
40-
order: [
41-
"Docs",
42-
"Main",
43-
"Fiori"
44-
],
45-
},
39+
// @ts-ignore
40+
storySort: (a, b) => {
41+
// Define the sorting order
42+
const sortOrder = {
43+
"Docs": 1,
44+
"Main": 2,
45+
"Fiori": 3,
46+
};
47+
48+
const sortSubOrder = ['Overview', 'Basic'];
49+
50+
// Function to get the order value for a given category
51+
// @ts-ignore
52+
function getOrder(category) {
53+
// @ts-ignore
54+
return sortOrder[category] || 4;
55+
}
56+
57+
// Function to get sub-order for 'Main' and 'Fiori'
58+
// @ts-ignore
59+
function getSubOrder(title) {
60+
let index = sortSubOrder.findIndex(keyword => title.endsWith(keyword));
61+
return index === -1 ? sortSubOrder.length : index; // Default sub-order for titles not listed or found at the end
62+
}
63+
64+
const aTitle = `${a.title}/${a.name}`;
65+
const bTitle = `${b.title}/${b.name}`;
66+
67+
const partsA = aTitle.split('/');
68+
const partsB = bTitle.split('/');
69+
70+
// Sort by primary category (Docs, Main, Fiori)
71+
const orderA = getOrder(partsA[0]);
72+
const orderB = getOrder(partsB[0]);
73+
if (orderA !== orderB) {
74+
return orderA - orderB;
75+
}
76+
77+
// Within 'Main' and 'Fiori', sort by sub-order
78+
if (partsA[0] === 'Main' || partsA[0] === 'Fiori') {
79+
const subOrderA = getSubOrder(partsA[2]);
80+
const subOrderB = getSubOrder(partsB[2]);
81+
if (subOrderA !== subOrderB) {
82+
return subOrderA - subOrderB;
83+
}
84+
}
85+
86+
return 1;
87+
}
4688
},
4789
};
4890

packages/playground/_stories/fiori/Bar/Bar.stories.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,15 @@ import { ifDefined } from "lit/directives/if-defined.js";
33
import { unsafeHTML } from "lit/directives/unsafe-html.js";
44
import type { Meta, StoryFn } from "@storybook/web-components";
55

6-
import argTypes, { componentInfo } from "./argTypes.js";
6+
import argTypes from "./argTypes.js";
77
import type { StoryArgsSlots } from "./argTypes.js";
88
import type { UI5StoryArgs } from "../../../types.js";
9-
10-
import { DocsPage } from "../../../.storybook/docs";
11-
129
import type Bar from "@ui5/webcomponents-fiori/dist/Bar.js";
1310
import BarDesign from "@ui5/webcomponents-fiori/dist/types/BarDesign.js";
1411

15-
const component = "ui5-bar";
16-
1712
export default {
1813
title: "Fiori/Bar",
1914
component: "Bar",
20-
parameters: {
21-
docs: {
22-
page: DocsPage({ ...componentInfo, component })
23-
},
24-
},
2515
argTypes,
2616
} as Meta<Bar>;
2717

packages/playground/_stories/fiori/BarcodeScannerDialog/BarcodeScannerDialog.stories.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
import { html } from "lit";
22
import type { Meta } from "@storybook/web-components";
33

4-
import argTypes, { componentInfo } from "./argTypes.js";
4+
import argTypes from "./argTypes.js";
55
import type { StoryArgsSlots } from "./argTypes.js";
66
import type { UI5StoryArgs } from "../../../types.js";
7-
8-
import { DocsPage } from "../../../.storybook/docs";
9-
107
// @ts-ignore
118
import type BarcodeScannerDialog from "@ui5/webcomponents-fiori/dist/BarcodeScannerDialog.js";
129

13-
const component = "ui5-barcode-scanner-dialog";
14-
1510
export default {
1611
title: "Fiori/Barcode Scanner Dialog",
1712
component: "BarcodeScannerDialog",
18-
parameters: {
19-
docs: {
20-
page: DocsPage({ ...componentInfo, component }),
21-
},
22-
},
2313
argTypes,
2414
} as Meta<BarcodeScannerDialog>;
2515

packages/playground/_stories/fiori/DynamicSideContent/DynamicSideContent.stories.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,17 @@ import { ifDefined } from "lit/directives/if-defined.js";
33
import { unsafeHTML } from "lit/directives/unsafe-html.js";
44
import type { Meta, StoryFn } from "@storybook/web-components";
55

6-
import argTypes, { componentInfo } from "./argTypes.js";
6+
import argTypes from "./argTypes.js";
77
import type { StoryArgsSlots } from "./argTypes.js";
88
import type { UI5StoryArgs } from "../../../types.js";
9-
10-
import { DocsPage } from "../../../.storybook/docs";
11-
129
import type DynamicSideContent from "@ui5/webcomponents-fiori/dist/DynamicSideContent.js";
1310
import SideContentPosition from "@ui5/webcomponents-fiori/dist/types/SideContentPosition.js";
1411
import SideContentFallDown from "@ui5/webcomponents-fiori/dist/types/SideContentFallDown.js";
1512
import SideContentVisibility from "@ui5/webcomponents-fiori/dist/types/SideContentVisibility.js";
1613

17-
const component = "ui5-dynamic-side-content";
18-
1914
export default {
2015
title: "Fiori/DynamicSideContent",
2116
component: "DynamicSideContent",
22-
parameters: {
23-
docs: {
24-
page: DocsPage({ ...componentInfo, component })
25-
},
26-
},
2717
argTypes,
2818
} as Meta<DynamicSideContent>;
2919

packages/playground/_stories/fiori/FlexibleColumnLayout/FlexibleColumnLayout.stories.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,14 @@ import { ifDefined } from "lit/directives/if-defined.js";
33
import { unsafeHTML } from "lit/directives/unsafe-html.js";
44
import type { Meta } from "@storybook/web-components";
55

6-
import argTypes, { componentInfo } from "./argTypes.js";
6+
import argTypes from "./argTypes.js";
77
import type { StoryArgsSlots } from "./argTypes.js";
88
import type { UI5StoryArgs } from "../../../types.js";
9-
10-
import { DocsPage } from "../../../.storybook/docs";
11-
129
import type FlexibleColumnLayout from "@ui5/webcomponents-fiori/dist/FlexibleColumnLayout.js";
1310

14-
const component = "ui5-flexible-column-layout";
15-
1611
export default {
1712
title: "Fiori/Flexible Column Layout",
1813
component: "FlexibleColumnLayout",
19-
parameters: {
20-
docs: {
21-
page: DocsPage({ ...componentInfo, component })
22-
},
23-
},
2414
argTypes,
2515
} as Meta<FlexibleColumnLayout>;
2616

packages/playground/_stories/fiori/IllustratedMessage/IllustratedMessage.stories.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,15 @@ import { ifDefined } from "lit/directives/if-defined.js";
33
import { unsafeHTML } from "lit/directives/unsafe-html.js";
44
import type { Meta, StoryFn } from "@storybook/web-components";
55

6-
import argTypes, { componentInfo } from "./argTypes.js";
6+
import argTypes from "./argTypes.js";
77
import type { StoryArgsSlots } from "./argTypes.js";
88
import type { UI5StoryArgs } from "../../../types.js";
9-
10-
import { DocsPage } from "../../../.storybook/docs";
11-
129
import type IllustratedMessage from "@ui5/webcomponents-fiori/dist/IllustratedMessage.js";
1310
import IllustrationMessageType from "@ui5/webcomponents-fiori/dist/types/IllustrationMessageType.js";
1411

15-
const component = "ui5-illustrated-message";
16-
1712
export default {
1813
title: "Fiori/Illustrated Message",
1914
component: "IllustratedMessage",
20-
parameters: {
21-
docs: {
22-
page: DocsPage({ ...componentInfo, component }),
23-
},
24-
},
2515
argTypes,
2616
} as Meta<IllustratedMessage>;
2717

0 commit comments

Comments
 (0)