Skip to content

Commit

Permalink
feat(core): export PopupIcons
Browse files Browse the repository at this point in the history
  • Loading branch information
adenvt committed Mar 26, 2024
1 parent 237f4d9 commit 893d999
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/components/popup/Popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,18 @@ import type { Component, PropType } from 'vue-demi'
import {
computed,
h,
markRaw,
} from 'vue-demi'
import type {
PopupActionOption,
PopupStyleVariant,
PopupTypeVariant,
} from '.'
import IconInfo from '@privyid/persona-icon/vue/information-circle-solid/20.vue'
import IconSuccess from '@privyid/persona-icon/vue/checkmark/20.vue'
import IconWarning from '@privyid/persona-icon/vue/exclamation-circle-solid/20.vue'
import IconError from '@privyid/persona-icon/vue/exclamation-triangle-solid/20.vue'
import IconClose from '@privyid/persona-icon/vue/close/16.vue'
import { vPMd } from '../markdown'
import type { ColorVariant } from '../button'
import type { AdditionalAttr } from '../global/types'
import { useNotifyItem } from '../notify'
const ToastIcons = {
info : markRaw(IconInfo),
success: markRaw(IconSuccess),
warning: markRaw(IconWarning),
error : markRaw(IconError),
}
import { PopupIcons } from '.'
const props = defineProps({
title: {
Expand Down Expand Up @@ -155,7 +144,7 @@ const classIcon = computed(() => {
const toastIcon = computed(() => {
if (!props.icon)
return ToastIcons[props.type]
return PopupIcons[props.type]
if (typeof props.icon === 'string') {
return () => h('img', {
Expand Down
12 changes: 12 additions & 0 deletions src/components/popup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import type { RequireAtLeastOne } from 'type-fest'
import type pPopup from './Popup.vue'
import { showNotify } from '../notify'

import IconInfo from '@privyid/persona-icon/vue/information-circle-solid/20.vue'
import IconSuccess from '@privyid/persona-icon/vue/checkmark/20.vue'
import IconWarning from '@privyid/persona-icon/vue/exclamation-circle-solid/20.vue'
import IconError from '@privyid/persona-icon/vue/exclamation-triangle-solid/20.vue'

export type PopupTypeVariant = 'info' | 'success' | 'warning' | 'error'

export type PopupStyleVariant = 'simple' | 'filled'
Expand All @@ -32,6 +37,13 @@ interface Option extends Omit<NotifyOption, 'component'> {
actions?: PopupActionOption[],
}

export const PopupIcons = {
info : markRaw(IconInfo),
success: markRaw(IconSuccess),
warning: markRaw(IconWarning),
error : markRaw(IconError),
}

export type PopupOption = RequireAtLeastOne<Option, 'text' | 'title'>

async function showPopup (text: string, title?: string, type?: PopupTypeVariant, variant?: PopupStyleVariant): Promise<PopupInstance>
Expand Down
1 change: 1 addition & 0 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export {

export {
default as popup,
PopupIcons,
} from '../components/popup'

export {
Expand Down

0 comments on commit 893d999

Please sign in to comment.