forked from ProtonMail/WebClients
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autogenerate sidebar names using getTitle function
- Loading branch information
1 parent
55d96a8
commit da04754
Showing
40 changed files
with
157 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import _startcase from 'lodash.startcase'; | ||
|
||
const caseString = (str: string, caseFilename: boolean = true) => { | ||
// avoid _startcase stripping the '/' | ||
return str | ||
.split('/') | ||
.map((item, index, arr) => { | ||
if (!caseFilename && index === arr.length - 1) { | ||
return item; | ||
} | ||
|
||
return _startcase(item); | ||
}) | ||
.join('/'); | ||
}; | ||
|
||
export const getTitle = (filename: string, caseFilename?: boolean) => { | ||
const directoryPrefix = 'src/stories/'; | ||
const storySuffix = /.stories.(tsx|mdx)/; | ||
const strippedFileName = filename.replace(directoryPrefix, '').replace(storySuffix, ''); | ||
|
||
return caseString(strippedFileName, caseFilename); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { Meta, Description } from '@storybook/addon-docs/blocks'; | ||
|
||
import { getTitle } from '../helpers/title'; | ||
import changelog from '../../CHANGELOG.md'; | ||
|
||
<Meta title="Changelog" /> | ||
<Meta title={getTitle(__filename)} /> | ||
|
||
<Description>{changelog}</Description> |
18 changes: 9 additions & 9 deletions
18
applications/storybook/src/stories/Introduction.stories.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import { Meta } from '@storybook/addon-docs/blocks'; | ||
import { getTitle } from '../helpers/title'; | ||
|
||
<Meta title="Introduction" /> | ||
<Meta title={getTitle(__filename)} /> | ||
|
||
# Proton Storybook | ||
|
||
|
||
Welcome to ProtonMail Design System. The goals of these pages are: | ||
|
||
- Having a more consistent experience for users | ||
- Having a consistent reference for all the teams | ||
- Improving/simplifying work discussions between design and devs, and between all front-end team (same language, same conventions, same objectives) | ||
- Improving/simplifying Front-End maintenability/scalability | ||
- Avoid reinventing the wheel for Front-End | ||
- Documentaaaation! Because it is important. © | ||
- Facilitating the onboarding of newcomers in the team. | ||
- Having a more consistent experience for users | ||
- Having a consistent reference for all the teams | ||
- Improving/simplifying work discussions between design and devs, and between all front-end team (same language, same conventions, same objectives) | ||
- Improving/simplifying Front-End maintenability/scalability | ||
- Avoid reinventing the wheel for Front-End | ||
- Documentaaaation! Because it is important. © | ||
- Facilitating the onboarding of newcomers in the team. |
4 changes: 3 additions & 1 deletion
4
applications/storybook/src/stories/components/Alert.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Badge.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
applications/storybook/src/stories/components/ButtonGroup.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Card.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Copy.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Countdown.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
applications/storybook/src/stories/components/DateInput.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Dropzone.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
6 changes: 4 additions & 2 deletions
6
...stories/components/InputField.stories.tsx → ...ries/components/InputFieldTwo.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/LabelStack.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Meter.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
applications/storybook/src/stories/components/MiddleEllipsis.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/MiddleEllipsis.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Notification.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Price.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Progress.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
applications/storybook/src/stories/components/Scale.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
applications/storybook/src/stories/components/Select.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
applications/storybook/src/stories/components/Tabs.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.