-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23605 from storybookjs/chore_env_vars_tweaks
Docs: Minor updates to the Environment variables docs (cherry picked from commit 265f214)
- Loading branch information
1 parent
d53f926
commit 2c6471e
Showing
16 changed files
with
126 additions
and
117 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: 22 additions & 0 deletions
22
docs/snippets/common/my-component-vite-env-variables.ts.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
```tsx | ||
// MyComponent.stories.ts|tsx | ||
|
||
// Replace your-framework with the name of your framework | ||
import type { Meta, StoryObj } from '@storybook/your-framework'; | ||
|
||
import { MyComponent } from './MyComponent'; | ||
|
||
const meta: Meta<typeof MyComponent> = { | ||
component: MyComponent, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof MyComponent>; | ||
|
||
export const ExampleStory: Story = { | ||
args: { | ||
propertyA: import.meta.env.STORYBOOK_DATA_KEY, | ||
propertyB: import.meta.env.VITE_CUSTOM_VAR, | ||
}, | ||
}; | ||
``` |
File renamed without changes.
5 changes: 3 additions & 2 deletions
5
...y-component-with-env-variables.ts-4-9.mdx → ...y-component-with-env-variables.ts-4-9.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
5 changes: 3 additions & 2 deletions
5
...ct/my-component-with-env-variables.ts.mdx → ...on/my-component-with-env-variables.ts.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
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
docs/snippets/common/storybook-read-environment-variables.vite-env.js.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
```js | ||
console.log(import.meta.env.STORYBOOK_THEME); | ||
console.log(import.meta.env.STORYBOOK_DATA_KEY); | ||
``` |
20 changes: 0 additions & 20 deletions
20
docs/snippets/solid/my-component-with-env-variables.ts.mdx
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
docs/snippets/svelte/my-component-with-env-variables.js.mdx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
docs/snippets/vue/my-component-with-env-variables.ts-4-9.mdx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
docs/snippets/web-components/my-component-vite-env-variables.js.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
export default { | ||
component: 'my-component', | ||
}; | ||
|
||
export const ExampleStory = { | ||
args: { | ||
propertyA: import.meta.env.STORYBOOK_DATA_KEY, | ||
propertyB: import.meta.env.VITE_CUSTOM_VAR, | ||
}, | ||
}; | ||
``` |
19 changes: 19 additions & 0 deletions
19
docs/snippets/web-components/my-component-vite-env-variables.ts.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
```ts | ||
// MyComponent.stories.ts | ||
|
||
import type { Meta, StoryObj } from '@storybook/web-components'; | ||
|
||
const meta: Meta = { | ||
component: 'my-component', | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj; | ||
|
||
export const ExampleStory: Story = { | ||
args: { | ||
propertyA: import.meta.env.STORYBOOK_DATA_KEY, | ||
propertyB: import.meta.env.VITE_CUSTOM_VAR, | ||
}, | ||
}; | ||
``` |