From 43daeb3c879f08fcfa0113f0b4ebe4aff2b0a447 Mon Sep 17 00:00:00 2001 From: wasimTQ Date: Fri, 29 Dec 2023 21:55:44 +0530 Subject: [PATCH] feat: add examples for carousel api handling --- apps/www/__registry__/index.ts | 14 +++++ .../src/content/docs/components/carousel.md | 45 +++++++++++++++- .../registry/default/example/CarouselApi.vue | 51 +++++++++++++++++++ .../registry/new-york/example/CarouselApi.vue | 51 +++++++++++++++++++ 4 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 apps/www/src/lib/registry/default/example/CarouselApi.vue create mode 100644 apps/www/src/lib/registry/new-york/example/CarouselApi.vue diff --git a/apps/www/__registry__/index.ts b/apps/www/__registry__/index.ts index e53557cb..be7d57fc 100644 --- a/apps/www/__registry__/index.ts +++ b/apps/www/__registry__/index.ts @@ -184,6 +184,13 @@ export const Index = { component: () => import('../src/lib/registry/default/example/CardWithForm.vue').then(m => m.default), files: ['../src/lib/registry/default/example/CardWithForm.vue'], }, + CarouselApi: { + name: 'CarouselApi', + type: 'components:example', + registryDependencies: ['carousel', 'button'], + component: () => import('../src/lib/registry/default/example/CarouselApi.vue').then(m => m.default), + files: ['../src/lib/registry/default/example/CarouselApi.vue'], + }, CarouselDemo: { name: 'CarouselDemo', type: 'components:example', @@ -1005,6 +1012,13 @@ export const Index = { component: () => import('../src/lib/registry/new-york/example/CardWithForm.vue').then(m => m.default), files: ['../src/lib/registry/new-york/example/CardWithForm.vue'], }, + CarouselApi: { + name: 'CarouselApi', + type: 'components:example', + registryDependencies: ['carousel', 'button'], + component: () => import('../src/lib/registry/new-york/example/CarouselApi.vue').then(m => m.default), + files: ['../src/lib/registry/new-york/example/CarouselApi.vue'], + }, CarouselDemo: { name: 'CarouselDemo', type: 'components:example', diff --git a/apps/www/src/content/docs/components/carousel.md b/apps/www/src/content/docs/components/carousel.md index 73bfdeaa..d32afe9c 100644 --- a/apps/www/src/content/docs/components/carousel.md +++ b/apps/www/src/content/docs/components/carousel.md @@ -171,4 +171,47 @@ You can pass options to the carousel using the `opts` prop. See the [Embla Carou -``` \ No newline at end of file +``` + +## API + +Use the `useCarousel` hook to get the instance of the API. + + + +## Events + +You can listen to events using the api instance from `useCarousel()`. + +```vue + + + +``` + +See the [Embla Carousel docs](https://www.embla-carousel.com/api/events/) for more information on using events. \ No newline at end of file diff --git a/apps/www/src/lib/registry/default/example/CarouselApi.vue b/apps/www/src/lib/registry/default/example/CarouselApi.vue new file mode 100644 index 00000000..0b25dc94 --- /dev/null +++ b/apps/www/src/lib/registry/default/example/CarouselApi.vue @@ -0,0 +1,51 @@ + + + diff --git a/apps/www/src/lib/registry/new-york/example/CarouselApi.vue b/apps/www/src/lib/registry/new-york/example/CarouselApi.vue new file mode 100644 index 00000000..cf3d838d --- /dev/null +++ b/apps/www/src/lib/registry/new-york/example/CarouselApi.vue @@ -0,0 +1,51 @@ + + +