-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
feat: nested grouping of stories with "group/story" syntax #486
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e8bcad1
init nested stories
dannyhw 3153cc0
render nested stories
dannyhw 8622e26
Merge remote-tracking branch 'origin/next' into feat/nested-stories
dannyhw ffd101c
update rn
dannyhw 5498e9e
vscode config
dannyhw cfbd469
minimise stories
dannyhw 8533769
fix tests
dannyhw ac1f753
add folder icon and chevron thing
dannyhw a8f4688
Merge remote-tracking branch 'origin/next' into feat/nested-stories
dannyhw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native', | ||
|
||
// overrides: [...conf.overrides, { files: ['*.ts', '*.tsx'], rules: { 'no-undef': 'off' } }], | ||
rules: { | ||
'react-native/no-inline-styles': 'off', | ||
}, | ||
}; |
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 |
---|---|---|
|
@@ -2,8 +2,6 @@ node_modules | |
*.log | ||
.idea | ||
*.iml | ||
.vscode/* | ||
!.vscode/launch.json | ||
*.sw* | ||
npm-shrinkwrap.json | ||
dist | ||
|
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,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default } from './.storybook/Storybook'; | ||
export { default } from './.storybook'; |
22 changes: 22 additions & 0 deletions
22
examples/expo-example/components/NestingExample/ChatMessage.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { ComponentMeta, ComponentStoryObj } from '@storybook/react-native'; | ||
import { Text } from 'react-native'; | ||
import React from 'react'; | ||
|
||
const MyComponent = ({ text }) => <Text>{text}</Text>; | ||
|
||
export default { | ||
title: 'Chat/Message', | ||
component: MyComponent, | ||
} as ComponentMeta<typeof MyComponent>; | ||
|
||
export const MessageFirst: ComponentStoryObj<typeof MyComponent> = { | ||
args: { | ||
text: 'Hello', | ||
}, | ||
}; | ||
|
||
export const MessageSecond: ComponentStoryObj<typeof MyComponent> = { | ||
args: { | ||
text: 'Message two', | ||
}, | ||
}; |
23 changes: 23 additions & 0 deletions
23
examples/expo-example/components/NestingExample/ChatMessageBubble.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { ComponentMeta, ComponentStoryObj } from '@storybook/react-native'; | ||
import { Text } from 'react-native'; | ||
import React from 'react'; | ||
|
||
const MyComponent = ({ text }) => <Text>{text}</Text>; | ||
|
||
export default { | ||
title: 'Chat/Message/bubble', | ||
component: MyComponent, | ||
} as ComponentMeta<typeof MyComponent>; | ||
|
||
export const First: ComponentStoryObj<typeof MyComponent> = { | ||
args: { | ||
text: 'First', | ||
}, | ||
}; | ||
|
||
export const Second: ComponentStoryObj<typeof MyComponent> = { | ||
storyName: 'Second Story', | ||
args: { | ||
text: 'Second', | ||
}, | ||
}; |
16 changes: 16 additions & 0 deletions
16
examples/expo-example/components/NestingExample/ChatMessageMessageInput.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { ComponentMeta, ComponentStoryObj } from '@storybook/react-native'; | ||
import { Text } from 'react-native'; | ||
import React from 'react'; | ||
|
||
const MyComponent = ({ text }) => <Text>{text}</Text>; | ||
|
||
export default { | ||
title: 'Chat/MessageInput', | ||
component: MyComponent, | ||
} as ComponentMeta<typeof MyComponent>; | ||
|
||
export const Basic: ComponentStoryObj<typeof MyComponent> = { | ||
args: { | ||
text: 'Hello', | ||
}, | ||
}; |
22 changes: 22 additions & 0 deletions
22
examples/expo-example/components/NestingExample/ChatMessageReactions.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { ComponentMeta, ComponentStoryObj } from '@storybook/react-native'; | ||
import { Text } from 'react-native'; | ||
import React from 'react'; | ||
|
||
const MyComponent = ({ text }) => <Text>{text}</Text>; | ||
|
||
export default { | ||
title: 'Chat/Message/Reactions', | ||
component: MyComponent, | ||
} as ComponentMeta<typeof MyComponent>; | ||
|
||
export const MessageOne: ComponentStoryObj<typeof MyComponent> = { | ||
args: { | ||
text: 'Hello', | ||
}, | ||
}; | ||
|
||
export const MessageTwo: ComponentStoryObj<typeof MyComponent> = { | ||
args: { | ||
text: 'Message two', | ||
}, | ||
}; |
71 changes: 71 additions & 0 deletions
71
examples/expo-example/components/NestingExample/StoryList.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { ComponentMeta, ComponentStoryObj } from '@storybook/react'; | ||
import StoryListView from '@storybook/react-native/dist/preview/components/StoryListView/StoryListView'; | ||
|
||
export default { | ||
title: 'StoryListView', | ||
component: StoryListView, | ||
} as ComponentMeta<typeof StoryListView>; | ||
|
||
export const Basic: ComponentStoryObj<typeof StoryListView> = { | ||
args: { | ||
storyIndex: { | ||
stories: { | ||
'chat-message--message-first': { | ||
id: 'chat-message--message-first', | ||
importPath: './components/NestingExample/ChatMessage.stories.tsx', | ||
name: 'Message First', | ||
title: 'Chat/Message', | ||
}, | ||
'chat-message--message-second': { | ||
id: 'chat-message--message-second', | ||
importPath: './components/NestingExample/ChatMessage.stories.tsx', | ||
name: 'Message Second', | ||
title: 'Chat/Message', | ||
}, | ||
'chat-message-bubble--first': { | ||
id: 'chat-message-bubble--first', | ||
importPath: './components/NestingExample/ChatMessageBubble.stories.tsx', | ||
name: 'First', | ||
title: 'Chat/Message/bubble', | ||
}, | ||
'chat-message-bubble--second': { | ||
id: 'chat-message-bubble--second', | ||
importPath: './components/NestingExample/ChatMessageBubble.stories.tsx', | ||
name: 'Second Story', | ||
title: 'Chat/Message/bubble', | ||
}, | ||
'chat-message-reactions--message-one': { | ||
id: 'chat-message-reactions--message-one', | ||
importPath: './components/NestingExample/ChatMessageReactions.stories.tsx', | ||
name: 'Message One', | ||
title: 'Chat/Message/Reactions', | ||
}, | ||
'chat-message-reactions--message-two': { | ||
id: 'chat-message-reactions--message-two', | ||
importPath: './components/NestingExample/ChatMessageReactions.stories.tsx', | ||
name: 'Message Two', | ||
title: 'Chat/Message/Reactions', | ||
}, | ||
'chat-messageinput--basic': { | ||
id: 'chat-messageinput--basic', | ||
importPath: './components/NestingExample/ChatMessageMessageInput.stories.tsx', | ||
name: 'Basic', | ||
title: 'Chat/MessageInput', | ||
}, | ||
'storylistview--basic': { | ||
id: 'storylistview--basic', | ||
importPath: './components/NestingExample/StoryList.stories.tsx', | ||
name: 'Basic', | ||
title: 'StoryListView', | ||
}, | ||
'text-control--basic': { | ||
id: 'text-control--basic', | ||
importPath: './components/ControlExamples/Text/Text.stories.tsx', | ||
name: 'Basic', | ||
title: 'Text control', | ||
}, | ||
}, | ||
v: 3, | ||
}, | ||
}, | ||
}; |
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
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not super clear from reading the calling code whether
item.stories
is a stable reference. Does it only change when Storybook core needs to update (because of HMR or whatever else)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When filtering the tree can be recreated, its based on the 'data' state which gets set when filtering