-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: storybook updated to version 7
- Loading branch information
Showing
11 changed files
with
90 additions
and
68 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
22 changes: 14 additions & 8 deletions
22
baseProject/config/storybook/gluestackStories/Checkbox.stories.ts
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
27 changes: 15 additions & 12 deletions
27
baseProject/config/storybook/gluestackStories/RadioButton.stories.ts
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,40 +1,43 @@ | ||
import { ExampleGluestackRadioButton } from './RadioButton'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const MyRadioButtonMeta = { | ||
const meta = { | ||
title: 'RadioButton', | ||
component: ExampleGluestackRadioButton, | ||
argTypes: { | ||
value: 'change', | ||
onPress: { action: 'radio button is selected!' }, | ||
}, | ||
args: { | ||
isInvalid: false, | ||
isDisabled: false, | ||
size: 'md', | ||
label: 'Label', | ||
}, | ||
}; | ||
} satisfies Meta<typeof ExampleGluestackRadioButton>; | ||
|
||
export default meta; | ||
|
||
export default MyRadioButtonMeta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic = {}; | ||
|
||
export const Default = { | ||
export const Default: Story = { | ||
args: { | ||
value: 'change', | ||
label: 'Radio button' | ||
label: 'Radio button', | ||
}, | ||
}; | ||
|
||
export const Large = { | ||
export const Large: Story = { | ||
args: { | ||
value: 'change', | ||
size: 'lg', | ||
label: 'Radio button' | ||
label: 'Radio button', | ||
}, | ||
}; | ||
|
||
export const Small = { | ||
export const Small: Story = { | ||
args: { | ||
value: 'change', | ||
size: 'sm', | ||
label: 'Radio button' | ||
label: 'Radio button', | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,31 @@ | ||
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config'); | ||
|
||
{{#if hasStorybook}} | ||
const path = require('path'); | ||
const { generate } = require('@storybook/react-native/scripts/generate'); | ||
{{/if}} | ||
/** | ||
* Metro configuration | ||
* https://facebook.github.io/metro/docs/configuration | ||
* | ||
* @type {import('metro-config').MetroConfig} | ||
*/ | ||
{{#if hasStorybook}} | ||
|
||
const storybookSourceExt = | ||
process.env.STORYBOOK_ENABLED === 'true' | ||
? ['storybook.tsx', 'storybook.ts', 'storybook.js', 'storybook.jsx'] | ||
: []; | ||
const defaultConfig = getDefaultConfig(__dirname); | ||
let config = {}; | ||
{{#if hasStorybook}} | ||
|
||
module.exports = (async () => { | ||
const defaultConfig = await getDefaultConfig(__dirname) | ||
// Add the transformer option to your custom config | ||
const customConfig = { | ||
resolver: { | ||
resolverMainFields: ['sbmodern', 'react-native', 'browser', 'main'], | ||
}, | ||
}; | ||
generate({ | ||
configPath: path.resolve(__dirname, './.storybook'), | ||
}); | ||
|
||
if (process.env.STORYBOOK_ENABLED) { | ||
defaultConfig.resolver.sourceExts = [...storybookSourceExt, ...defaultConfig.resolver.sourceExts]; | ||
} | ||
|
||
// Merge your custom config with the default config | ||
return mergeConfig(defaultConfig, customConfig); | ||
})(); | ||
{{else}} | ||
const config = {}; | ||
module.exports = mergeConfig(getDefaultConfig(__dirname), config); | ||
config = { | ||
transformer: { | ||
unstable_allowRequireContext: true, | ||
}, | ||
resolver: { | ||
sourceExts: [...defaultConfig.resolver.sourceExts, 'mjs'], | ||
}, | ||
}; | ||
{{/if}} | ||
|
||
module.exports = mergeConfig(defaultConfig, config); |
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