-
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.
Merge pull request #351 from PrestaShopCorp/doc-puik-config-provider-…
…story docs: [Storybook][PuikConfigProvider] - fix #350 - create doc + update fr translations
- Loading branch information
Showing
3 changed files
with
123 additions
and
4 deletions.
There are no files selected for viewing
9 changes: 7 additions & 2 deletions
9
packages/components/config-provider/src/config-provider-props.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
86 changes: 86 additions & 0 deletions
86
packages/components/config-provider/stories/config-provider.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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { PuikConfigProvider, PuikPagination, PuikLabel, PuikConfigProviderLocale } from '@prestashopcorp/puik-components'; | ||
import type { Meta, StoryFn, Args } from '@storybook/vue3'; | ||
import { ref } from 'vue'; | ||
|
||
const configProviderLocales = Object.values(PuikConfigProviderLocale); | ||
const configProviderLocalesSummary = configProviderLocales.join('|'); | ||
|
||
export default { | ||
title: 'Components/ConfigProvider', | ||
component: PuikConfigProvider, | ||
argTypes: { | ||
locale: { | ||
description: | ||
'defines language', | ||
control: 'select', | ||
options: configProviderLocales, | ||
table: { | ||
type: { | ||
summary: configProviderLocalesSummary | ||
}, | ||
defaultValue: { | ||
summary: PuikConfigProviderLocale.En | ||
} | ||
} | ||
} | ||
}, | ||
args: {} | ||
} as Meta; | ||
|
||
const DefaultTemplate: StoryFn = (args: Args) => ({ | ||
components: { | ||
PuikConfigProvider, | ||
PuikPagination, | ||
PuikLabel | ||
}, | ||
setup() { | ||
const page = ref(1); | ||
const itemsPerPage = ref(5); | ||
return { args, page, itemsPerPage }; | ||
}, | ||
template: ` | ||
<puik-config-provider v-bind="args"> | ||
<div style="display: flex; flex-direction: column; gap: 1rem;" > | ||
<p style="margin-left: 32px;">Translation feature: examples with PuikLabel and PuikPagination</p> | ||
<puik-label style="margin-left: 32px;" readonly for="input"> | ||
Label | ||
</puik-label> | ||
<puik-pagination | ||
v-model:page="page" | ||
v-model:items-per-page="itemsPerPage" | ||
totalItem="150" | ||
variant="large" | ||
></puik-pagination> | ||
</div> | ||
</puik-config-provider> | ||
` | ||
}); | ||
|
||
export const Default = { | ||
render: DefaultTemplate, | ||
args: {}, | ||
parameters: { | ||
docs: { | ||
source: { | ||
code: ` | ||
<!-- VueJS Snippet --> | ||
<!-- Translation feature: examples with PuikLabel and PuikPagination --> | ||
<!-- $locales: ${configProviderLocalesSummary} --> | ||
<puik-config-provider locale="{$locale}"> | ||
<puik-label> | ||
Label | ||
</puik-label> | ||
<puik-pagination | ||
v-model:page="page" | ||
:total-item="150" | ||
variant="large" | ||
></puik-pagination> | ||
</puik-config-provider> | ||
`, | ||
language: 'html' | ||
} | ||
} | ||
} | ||
}; |
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