forked from storybookjs/storybook
-
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.
Merge pull request storybookjs#15568 from storybookjs/fix_toolbars_docs
Chore:(Docs) Fix toolbar docs with better examples and minor polish
- Loading branch information
Showing
15 changed files
with
244 additions
and
15 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
10 changes: 10 additions & 0 deletions
10
docs/snippets/angular/my-component-story-use-globaltype-backwards-compat.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,10 @@ | ||
```ts | ||
// MyComponent.stories.ts | ||
|
||
export const StoryWithLocale = ({ globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
template: `<p>${caption}</p>`, | ||
}; | ||
}; | ||
``` |
23 changes: 23 additions & 0 deletions
23
docs/snippets/angular/my-component-story-use-globaltype.mdx.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,23 @@ | ||
```md | ||
<!-- MyComponent.stories.mdx --> | ||
|
||
export const getCaptionForLocale = (locale) => { | ||
switch(locale) { | ||
case 'es': return 'Hola!'; | ||
case 'fr': return 'Bonjour!'; | ||
case 'kr': return '안녕하세요!'; | ||
case 'zh': return '你好!'; | ||
default: | ||
return 'Hello!'; | ||
} | ||
}; | ||
|
||
<Story name="StoryWithLocale"> | ||
{(args, { globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
template: `<p>${caption}</p>`, | ||
}; | ||
}} | ||
</Story> | ||
``` |
25 changes: 25 additions & 0 deletions
25
docs/snippets/angular/my-component-story-use-globaltype.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,25 @@ | ||
```ts | ||
// MyComponent.stories.ts | ||
|
||
const getCaptionForLocale = (locale) => { | ||
switch (locale) { | ||
case 'es': | ||
return 'Hola!'; | ||
case 'fr': | ||
return 'Bonjour!'; | ||
case 'kr': | ||
return '안녕하세요!'; | ||
case 'zh': | ||
return '你好!'; | ||
default: | ||
return 'Hello!'; | ||
} | ||
}; | ||
|
||
export const StoryWithLocale = (args, { globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
template: `<p>${caption}</p>`, | ||
}; | ||
}; | ||
``` |
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
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
13 changes: 13 additions & 0 deletions
13
docs/snippets/svelte/my-component-story-use-globaltype-backwards-compat.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,13 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
export const StoryWithLocale = ({ globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
component: SampleComponent, | ||
props: { | ||
locale: caption, | ||
}, | ||
}; | ||
}; | ||
``` |
28 changes: 28 additions & 0 deletions
28
docs/snippets/svelte/my-component-story-use-globaltype.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,28 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
const getCaptionForLocale = (locale) => { | ||
switch (locale) { | ||
case 'es': | ||
return 'Hola!'; | ||
case 'fr': | ||
return 'Bonjour!'; | ||
case 'kr': | ||
return '안녕하세요!'; | ||
case 'zh': | ||
return '你好!'; | ||
default: | ||
return 'Hello!'; | ||
} | ||
}; | ||
|
||
export const StoryWithLocale = (args, { globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
component: SampleComponent, | ||
props: { | ||
locale: caption, | ||
}, | ||
}; | ||
}; | ||
``` |
26 changes: 26 additions & 0 deletions
26
docs/snippets/svelte/my-component-story-use-globaltype.mdx.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,26 @@ | ||
```md | ||
<!-- MyComponent.stories.mdx --> | ||
|
||
export const getCaptionForLocale = (locale) => { | ||
switch(locale) { | ||
case 'es': return 'Hola!'; | ||
case 'fr': return 'Bonjour!'; | ||
case 'kr': return '안녕하세요!'; | ||
case 'zh': return '你好!'; | ||
default: | ||
return 'Hello!'; | ||
} | ||
}; | ||
|
||
<Story name="StoryWithLocale"> | ||
{(args, { globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
component: MyComponent, | ||
props: { | ||
locale: caption, | ||
}, | ||
}; | ||
}} | ||
</Story> | ||
``` |
10 changes: 10 additions & 0 deletions
10
docs/snippets/vue/my-component-story-use-globaltype-backwards-compat.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,10 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
export const StoryWithLocale = ({ globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
template: `<p>${caption}</p>`, | ||
}; | ||
}; | ||
``` |
25 changes: 25 additions & 0 deletions
25
docs/snippets/vue/my-component-story-use-globaltype.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,25 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
const getCaptionForLocale = (locale) => { | ||
switch (locale) { | ||
case 'es': | ||
return 'Hola!'; | ||
case 'fr': | ||
return 'Bonjour!'; | ||
case 'kr': | ||
return '안녕하세요!'; | ||
case 'zh': | ||
return '你好!'; | ||
default: | ||
return 'Hello!'; | ||
} | ||
}; | ||
|
||
export const StoryWithLocale = (args, { globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
template: `<p>${caption}</p>`, | ||
}; | ||
}; | ||
``` |
23 changes: 23 additions & 0 deletions
23
docs/snippets/vue/my-component-story-use-globaltype.mdx.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,23 @@ | ||
```md | ||
<!-- MyComponent.stories.mdx --> | ||
|
||
export const getCaptionForLocale = (locale) => { | ||
switch(locale) { | ||
case 'es': return 'Hola!'; | ||
case 'fr': return 'Bonjour!'; | ||
case 'kr': return '안녕하세요!'; | ||
case 'zh': return '你好!'; | ||
default: | ||
return 'Hello!'; | ||
} | ||
}; | ||
|
||
<Story name="StoryWithLocale"> | ||
{(args, { globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return { | ||
template: `<p>${caption}</p>`, | ||
}; | ||
}} | ||
</Story> | ||
``` |
10 changes: 10 additions & 0 deletions
10
...ippets/web-components/my-component-story-use-globaltype-backwards-compat.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,10 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
import { html } from 'lit-html'; | ||
|
||
export const StoryWithLocale = ({ globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return html`<p>${caption}</p>`; | ||
}; | ||
``` |
25 changes: 25 additions & 0 deletions
25
docs/snippets/web-components/my-component-story-use-globaltype.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,25 @@ | ||
```js | ||
// MyComponent.stories.js | ||
|
||
import { html } from 'lit-html'; | ||
|
||
const getCaptionForLocale = (locale) => { | ||
switch (locale) { | ||
case 'es': | ||
return 'Hola!'; | ||
case 'fr': | ||
return 'Bonjour!'; | ||
case 'kr': | ||
return '안녕하세요!'; | ||
case 'zh': | ||
return '你好!'; | ||
default: | ||
return 'Hello!'; | ||
} | ||
}; | ||
|
||
export const StoryWithLocale = ({ propA, propB }, { globals: { locale } }) => { | ||
const caption = getCaptionForLocale(locale); | ||
return html`<p>${caption}</p>`; | ||
}; | ||
``` |