Skip to content

Commit

Permalink
feat(maz-ui): add new dialog plugin to display dialog modals programm…
Browse files Browse the repository at this point in the history
…atically
  • Loading branch information
LouisMazel committed Oct 2, 2024
1 parent a80b354 commit 88b8603
Show file tree
Hide file tree
Showing 30 changed files with 876 additions and 86 deletions.
1 change: 1 addition & 0 deletions packages/docs/docs/.vitepress/configs/composables.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const composables = {
items: [
{ text: 'useAos', link: '/composables/use-aos' },
{ text: 'useBreakpoints', link: '/composables/use-breakpoints' },
{ text: 'useDialog', link: '/composables/use-dialog' },
{ text: 'useFormValidator', link: '/composables/use-form-validator' },
{ text: 'useIdleTimeout', link: '/composables/use-idle-timeout' },
{ text: 'useReadingTime', link: '/composables/use-reading-time' },
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/docs/.vitepress/configs/plugins.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ export const plugins = {
text: 'Plugins',
collapsed: false,
items: [
{ text: 'toaster', link: '/plugins/toaster' },
{ text: 'aos (animation on scroll)', link: '/plugins/aos' },
{ text: 'dialog', link: '/plugins/dialog' },
{ text: 'toaster', link: '/plugins/toaster' },
{ text: 'wait', link: '/plugins/wait' },
]
} satisfies DefaultTheme.NavItemChildren | DefaultTheme.SidebarItem
3 changes: 2 additions & 1 deletion packages/docs/docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import googleAnalytics from 'vitepress-plugin-google-analytics'
import 'maz-ui/modules/plugins/aos/scss/index.scss'
import './main.css'

import { ToasterOptions, installToaster, installWait, AosOptions, installAos, getAosInstance, vFullscreenImgInstall } from 'maz-ui'
import { ToasterOptions, installToaster, installWait, AosOptions, installAos, getAosInstance, vFullscreenImgInstall, installDialog } from 'maz-ui'

import * as components from 'maz-ui/components/index'

Expand Down Expand Up @@ -54,6 +54,7 @@ const theme: typeof DefaultTheme = {
app.use(installToaster, toasterOptions)
app.use(installWait)
app.use(installAos, aosOptions)
app.use(installDialog)
app.use(vFullscreenImgInstall)

watch(
Expand Down
65 changes: 65 additions & 0 deletions packages/docs/docs/composables/use-dialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: useDialog
description: Vue composable for handling dialog plugin in your components
---

# {{ $frontmatter.title }}

{{ $frontmatter.description }}

::: warning
You must install [dialog plugin](./../plugins/dialog.md#install) before use it
:::

::: tip
More info about [dialog plugin](./../plugins/dialog.md) in its documentation
:::

## Usage

<ComponentDemo>
<MazBtn
@click="openDialog"
>
Open Dialog
</MazBtn>

<template #code>

```vue
<template>
<MazBtn @click="openDialog">
Open Dialog
</MazBtn>
</template>
<script lang="ts" setup>
import { useDialog } from 'maz-ui'
const dialog = useDialog()
function openDialog() {
dialog.open({
title: 'Dialog title',
message: 'Dialog message',
})
}
</script>
```

</template>

</ComponentDemo>

<script lang="ts" setup>
import { useDialog } from 'maz-ui'

const dialog = useDialog()

function openDialog() {
dialog.open({
title: 'Dialog title',
message: 'Dialog message',
})
}
</script>
5 changes: 1 addition & 4 deletions packages/docs/docs/composables/use-toast.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ More info about [toaster plugin](./../plugins/toaster.md) in its documentation
## Usage

```vue
<template>
<img data-maz-aos="scale-in" />
</template>
<script lang="ts" setup>
import { useToast } from 'maz-ui'
Expand Down Expand Up @@ -67,4 +63,5 @@ More info about [toaster plugin](./../plugins/toaster.md) in its documentation
})
toast.warning('warning message')
toast.error('error message')
toast.message('message')
</script>
Loading

0 comments on commit 88b8603

Please sign in to comment.