Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/fe_guide/storybook.md')
-rw-r--r--doc/development/fe_guide/storybook.md34
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/development/fe_guide/storybook.md b/doc/development/fe_guide/storybook.md
index 6049dd7c7d3..cbda9d5efa2 100644
--- a/doc/development/fe_guide/storybook.md
+++ b/doc/development/fe_guide/storybook.md
@@ -135,3 +135,37 @@ export const Default = Template.bind({});
Default.args = {};
```
+
+## Using a Vuex store
+
+To write a story for a component that requires access to a Vuex store, use the `createVuexStore` method provided in
+the Story context.
+
+```javascript
+import Vue from 'vue';
+import { withVuexStore } from 'storybook_addons/vuex_store';
+import DurationChart from './duration-chart.vue';
+
+const Template = (_, { argTypes, createVuexStore }) => {
+ return {
+ components: { DurationChart },
+ store: createVuexStore({
+ state: {},
+ getters: {},
+ modules: {},
+ }),
+ props: Object.keys(argTypes),
+ template: '<duration-chart />',
+ };
+};
+
+export default {
+ component: DurationChart,
+ title: 'ee/analytics/cycle_analytics/components/duration_chart',
+ decorators: [withVuexStore],
+};
+
+export const Default = Template.bind({});
+
+Default.args = {};
+```