-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add annotations support for addons (#612)
* Add preview support * preview re-export * omit dist * add deep controls (#1) * bump storybook-addon-deep-controls * fix: add more examples and show output * fix: enhancers to work for a list * fix: addon file resolution * fix * fix * fix: update version --------- Co-authored-by: Daniel Williams <[email protected]>
- Loading branch information
Showing
12 changed files
with
153 additions
and
14 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
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
72 changes: 72 additions & 0 deletions
72
examples/expo-example/other_components/DeepControls/DeepControls.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,72 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { Text, View } from 'react-native'; | ||
|
||
const DeepControls = ({ | ||
objectArg, | ||
}: { | ||
objectArg: { | ||
string: string; | ||
number: number; | ||
boolean: boolean; | ||
enumString: string; | ||
nested: { number: number; boolean: boolean }; | ||
}; | ||
}) => { | ||
return ( | ||
<View style={{ gap: 10 }}> | ||
<Text>Testing story with deep controls (storybook-addon-deep-controls)</Text> | ||
<Text>{JSON.stringify(objectArg, null, 2)}</Text> | ||
</View> | ||
); | ||
}; | ||
|
||
export default { | ||
title: 'DeepControls', | ||
component: DeepControls, | ||
} satisfies Meta<typeof DeepControls>; | ||
|
||
export const Basic: StoryObj<typeof DeepControls> = { | ||
parameters: { | ||
deepControls: { enabled: true }, | ||
}, | ||
args: { | ||
objectArg: { | ||
string: 'foo', | ||
number: 42, | ||
boolean: true, | ||
enumString: 'value2', // we only want specific values for this | ||
nested: { | ||
number: 222, | ||
boolean: false, | ||
}, | ||
}, | ||
}, | ||
argTypes: { | ||
// so we define an argType for the property to use a radio control with specific values | ||
// @ts-expect-error | ||
'objectArg.enumString': { | ||
control: 'radio', | ||
options: ['value1', 'value2', 'value3'], | ||
}, | ||
|
||
'objectArg.boolean': { | ||
control: 'boolean', | ||
}, | ||
|
||
'objectArg.number': { | ||
control: 'number', | ||
}, | ||
|
||
'objectArg.string': { | ||
control: 'text', | ||
}, | ||
|
||
'objectArg.nested.boolean': { | ||
control: 'boolean', | ||
}, | ||
|
||
'objectArg.nested.number': { | ||
control: 'number', | ||
}, | ||
}, | ||
}; |
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 @@ | ||
export * from '@storybook/addon-actions/preview'; |
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 @@ | ||
export * from '@storybook/addon-actions/preview'; |
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
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