-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into install_docs
- Loading branch information
Showing
45 changed files
with
3,516 additions
and
3,665 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
|
||
import MyComponent from './MyI18n.vue' | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction | ||
|
||
const meta = { | ||
title: 'Modules/I18n', | ||
component: MyComponent, | ||
argTypes: { | ||
lang: { control: 'select', options: ['en', 'fr', 'ar'] }, | ||
}, | ||
|
||
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof MyComponent> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
/* | ||
*👇 Render functions are a framework specific feature to allow you control on how the component renders. | ||
* See https://storybook.js.org/docs/vue/api/csf | ||
* to learn how to use render functions. | ||
*/ | ||
|
||
export const FrenchStory: Story = { | ||
args: { lang: 'fr' }, | ||
} | ||
|
||
export const EnglishStory: Story = { | ||
args: { lang: 'en' }, | ||
} | ||
|
||
export const ArabicStory: Story = { | ||
args: { lang: 'ar' }, | ||
} |
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,47 @@ | ||
<script lang="ts" setup> | ||
import '../assets/button.css' | ||
const props = defineProps<{ | ||
lang: string | ||
message?: string | ||
}>() | ||
const { t, locale } = useI18n() | ||
const rtl = computed(() => props.lang === 'ar') | ||
locale.value = props.lang | ||
watch( | ||
() => props.lang, | ||
(lang: unknown) => { | ||
locale.value = lang | ||
}, | ||
) | ||
</script> | ||
|
||
<template> | ||
<div class="storybook lang-selector"> | ||
<button | ||
class="storybook-button storybook-button--small" | ||
@click="locale = 'en'" | ||
> | ||
en | ||
</button> | ||
<button | ||
class="storybook-button storybook-button--small" | ||
@click="locale = 'fr'" | ||
> | ||
fr | ||
</button> | ||
<button | ||
class="storybook-button storybook-button--small" | ||
@click="locale = 'ar'" | ||
> | ||
ar | ||
</button> | ||
</div> | ||
<div class="storybook welcome" :style="{ direction: rtl ? 'rtl' : 'ltr' }"> | ||
<div>{{ t('welcome', { name: 'Storybook' }) }}</div> | ||
<div>{{ t('welcome', { name: 'Nuxt' }) }}</div> | ||
<div>{{ t('welcome', { name: 'I18n' }) }}</div> | ||
</div> | ||
|
||
<p>language : {{ lang }}</p> | ||
</template> |
15 changes: 6 additions & 9 deletions
15
...arter/components/MyNuxtWelcome.stories.js → ...wcase/components/MyNuxtWelcome.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 |
---|---|---|
@@ -1,22 +1,19 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
|
||
import MyNuxtWelcome from './MyWelcome.vue' | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/vue/writing-stories/introduction | ||
|
||
const meta = { | ||
title: 'Example/NuxtWelcome', | ||
component: MyNuxtWelcome, | ||
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/vue/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
} | ||
} satisfies Meta<typeof MyNuxtWelcome> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
/* | ||
*👇 Render functions are a framework specific feature | ||
to allow you control on how the component renders. | ||
* See https://storybook.js.org/docs/vue/api/csf | ||
* to learn how to use render functions. | ||
*/ | ||
|
||
export const NuxtWelcomeStory = { | ||
export const NuxtWelcomeStory: Story = { | ||
args: {}, | ||
} |
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,40 @@ | ||
<template> | ||
<h1>Welcome Nuxt to Storybook</h1> | ||
<NuxtWelcome /> | ||
</template> | ||
|
||
<style> | ||
.readmore { | ||
-webkit-text-size-adjust: 100%; | ||
tab-size: 4; | ||
box-sizing: border-box; | ||
border-width: 0; | ||
border-style: solid; | ||
border-color: #e0e0e0; | ||
--tw-ring-inset: var(--tw-empty,); | ||
--tw-ring-offset-width: 0px; | ||
--tw-ring-offset-color: #fff; | ||
--tw-ring-color: rgba(14, 165, 233, 0.5); | ||
--tw-ring-offset-shadow: 0 0 #0000; | ||
--tw-ring-shadow: 0 0 #0000; | ||
--tw-shadow: 0 0 #0000; | ||
font-family: | ||
'Nunito Sans', | ||
-apple-system, | ||
'.SFNSText-Regular', | ||
'San Francisco', | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
'Helvetica Neue', | ||
Helvetica, | ||
Arial, | ||
sans-serif; | ||
margin: 0; | ||
-webkit-font-smoothing: antialiased; | ||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); | ||
line-height: 24px; | ||
color: #029cfd; | ||
text-decoration: none; | ||
font-size: 14px; | ||
} | ||
</style> |
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,17 @@ | ||
<template> | ||
<button @click="handleClick">Click me!</button> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
function handleClick() { | ||
alert('Button clicked!') | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
button { | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
cursor: pointer; | ||
} | ||
</style> |
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 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
|
||
import SimpleButton from './SimpleButton.vue' | ||
|
||
/** | ||
* Shows how to use a decorator to wrap the story with extra markup. | ||
* https://storybook.js.org/docs/writing-stories/decorators | ||
*/ | ||
const meta = { | ||
title: 'Storybook Feature/Use Decorators', | ||
component: SimpleButton, | ||
tags: ['autodocs'], | ||
decorators: [ | ||
() => ({ template: '<div style="margin: 3em;"><story/></div>' }), | ||
], | ||
} satisfies Meta<typeof SimpleButton> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const UseDecoratorsStory: Story = { | ||
args: {}, | ||
} |
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,16 @@ | ||
export default defineI18nConfig(() => ({ | ||
legacy: false, | ||
locale: 'en', | ||
defaultLocale: 'en', | ||
messages: { | ||
en: { | ||
welcome: 'Welcome to Storybook ❤️ {name} ', | ||
}, | ||
fr: { | ||
welcome: 'Bienvenue a Storybook ❤️ {name} ', | ||
}, | ||
ar: { | ||
welcome: ' ناكست ❤️ {name} ❤️ مرحبا بكم في ستوري بوك ', | ||
}, | ||
}, | ||
})) |
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,4 +23,4 @@ logs | |
.env.* | ||
!.env.example | ||
|
||
*storybook.log | ||
*storybook.log |
10 changes: 4 additions & 6 deletions
10
examples/starter/.storybook/main.js → examples/starter/.storybook/main.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 |
---|---|---|
@@ -1,20 +1,18 @@ | ||
/** @type { import('storybook-vue').StorybookConfig } */ | ||
const config = { | ||
import type { StorybookConfig } from '@storybook-vue/nuxt' | ||
|
||
const config: StorybookConfig = { | ||
stories: [ | ||
'../components/**/*.mdx', | ||
'../components/**/*.stories.@(js|jsx|ts|tsx|mdx)', | ||
], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions', | ||
], | ||
framework: { | ||
name: '@storybook-vue/nuxt', | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
} | ||
export default config |
4 changes: 3 additions & 1 deletion
4
examples/starter/.storybook/preview.js → examples/starter/.storybook/preview.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
Oops, something went wrong.