-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 #25110 from storybookjs/docs_svelte_ts_example
Docs: Svelte docs and examples update
- Loading branch information
Showing
147 changed files
with
2,250 additions
and
1,068 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,5 @@ | |
setClient(mockedClient); | ||
</script> | ||
|
||
<div> | ||
<slot /> | ||
</div> | ||
<slot /> | ||
``` |
27 changes: 27 additions & 0 deletions
27
docs/snippets/svelte/apollo-wrapper-component.with-mock-implementation.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,27 @@ | ||
```html | ||
<!-- MockApolloWrapperClient.svelte --> | ||
|
||
<script lang="ts"> | ||
import { ApolloClient, InMemoryCache } from '@apollo/client'; | ||
import { setClient } from 'svelte-apollo'; | ||
const mockedClient = new ApolloClient({ | ||
uri: 'https://your-graphql-endpoint', | ||
cache: new InMemoryCache(), | ||
defaultOptions: { | ||
watchQuery: { | ||
fetchPolicy: 'no-cache', | ||
errorPolicy: 'all', | ||
}, | ||
query: { | ||
fetchPolicy: 'no-cache', | ||
errorPolicy: 'all', | ||
}, | ||
}, | ||
}); | ||
setClient(mockedClient); | ||
</script> | ||
|
||
<slot /> | ||
``` |
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
```ts | ||
// ButtonGroup.stories.ts | ||
|
||
import type { Meta, StoryObj } from '@storybook/svelte'; | ||
|
||
import ButtonGroup from './ButtonGroup.svelte'; | ||
|
||
//👇 Imports the Button stories | ||
import * as ButtonStories from './Button.stories'; | ||
|
||
const meta = { | ||
component: ButtonGroup, | ||
} satisfies Meta<typeof ButtonGroup>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Pair: Story = { | ||
args: { | ||
buttons: [{ ...ButtonStories.Primary.args }, { ...ButtonStories.Secondary.args }], | ||
orientation: 'horizontal', | ||
}, | ||
}; | ||
``` |
Oops, something went wrong.