Merge pull request #44 from themesberg/chank1e/develop

fix: typings
This commit is contained in:
Alexandr P
2022-07-26 22:40:29 +03:00
committed by GitHub
3 changed files with 13 additions and 12 deletions

View File

@@ -58,7 +58,7 @@ function getComponents() {
function getUtils() { function getUtils() {
return [ return [
{ text: 'Flowbite Themable', link: '/components/flowbiteThemable/flowbiteThemable.md' }, { text: 'Flowbite Themable', link: '/components/flowbiteThemable/flowbiteThemable.md' },
{ text: 'ToastProvider', link: '/components/toastProvider/toastProvider.md' }, { text: 'Toast Provider', link: '/components/toastProvider/toastProvider.md' },
] ]
} }

View File

@@ -178,4 +178,3 @@ import { Toast } from 'flowbite-vue'
<ToastIconExample /> <ToastIconExample />
--- ---
<ToastProviderExample />

View File

@@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, h, provide, ref, resolveComponent } from 'vue' import { defineComponent, h, provide, ref, resolveComponent, TransitionGroup } from 'vue'
import { FLOWBITE_TOAST_INJECTION_KEY } from '@/components/Toast/components/ToastProvider/injection/config' import { FLOWBITE_TOAST_INJECTION_KEY } from '@/components/Toast/components/ToastProvider/injection/config'
import type { ToastItem, ToastItemWithId } from '@/components/Toast/components/ToastProvider/types' import type { ToastItem, ToastItemWithId } from '@/components/Toast/components/ToastProvider/types'
import { Toast } from '@/index' import { Toast } from '@/index'
@@ -56,19 +56,21 @@ export default defineComponent({
return h('div', {}, [ return h('div', {}, [
$slots.default ? $slots.default() : null, // rendering default slot $slots.default ? $slots.default() : null, // rendering default slot
h(resolveComponent('TransitionGroup'), { h(TransitionGroup, {
name: 'list', name: 'list',
tag: 'div', tag: 'div',
class: 'xl:w-1/6 md:w-1/4 sm:w-1/4 fixed top-3 right-3 flex flex-col gap-2 z-50', class: 'xl:w-1/6 md:w-1/4 sm:w-1/4 fixed top-3 right-3 flex flex-col gap-2 z-50',
}, },
toasts.map(_toast => // rendering every toast {
h(resolveComponent('Toast'), { default: () => toasts.map(_toast => // rendering every toast
h(Toast as any, {
closable: true, closable: true,
type: _toast.type, type: _toast.type,
key: _toast.id, key: _toast.id,
onClose: () => removeToast(_toast.id), onClose: () => removeToast(_toast.id),
}, _toast.text), }, () => _toast.text),
), ),
},
), ),
]) ])
}, },