Skip to content

Commit

Permalink
Merge pull request #58 from jdm1219/main
Browse files Browse the repository at this point in the history
refactor: Updated the �docs and type of the class option
  • Loading branch information
xiaoluoboding authored Mar 6, 2024
2 parents 23cd00e + af28d1c commit 6c0238e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ You can style your toasts globally with the `toastOptions` prop in the `Toaster`
<Toaster
:toastOptions="{
style: { background: 'red' },
className: 'my-toast',
descriptionClassName: 'my-toast-description'
class: 'my-toast',
descriptionClass: 'my-toast-description'
}"
/>
```
Expand All @@ -301,8 +301,8 @@ toast('Event has been created', {
style: {
background: 'red'
},
className: 'my-toast',
descriptionClassName: 'my-toast-description'
class: 'my-toast',
descriptionClass: 'my-toast-description'
})
```

Expand Down
20 changes: 10 additions & 10 deletions packages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type PromiseData<ToastData = any> = ExternalToast & {
finally?: () => void | Promise<void>
}

export interface ToastClassnames {
export interface ToastClasses {
toast?: string
title?: string
description?: string
Expand Down Expand Up @@ -77,8 +77,8 @@ export type ToastT<T extends Component = Component> = {
actionButtonStyle?: CSSProperties
style?: CSSProperties
unstyled?: boolean
class?: any
classes?: ToastClassnames
class?: string
classes?: ToastClasses
descriptionClass?: string
position?: Position
}
Expand All @@ -98,15 +98,15 @@ export interface HeightT {
}

export interface ToastOptions {
class?: any
class?: string
closeButton?: boolean
descriptionClass?: any
descriptionClass?: string
style?: CSSProperties
cancelButtonStyle?: CSSProperties
actionButtonStyle?: CSSProperties
duration?: number
unstyled?: boolean
classes?: ToastClassnames
classes?: ToastClasses
}

export type CnFunction = (...classes: Array<string | undefined>) => string
Expand All @@ -123,7 +123,7 @@ export interface ToasterProps {
visibleToasts?: number
closeButton?: boolean
toastOptions?: ToastOptions
class?: any
class?: string
style?: CSSProperties
offset?: string | number
dir?: 'rtl' | 'ltr' | 'auto'
Expand All @@ -147,14 +147,14 @@ export interface ToastProps {
closeButton: boolean
interacting: boolean
duration?: number
descriptionClass?: any
descriptionClass?: string
style?: CSSProperties
cancelButtonStyle?: CSSProperties
actionButtonStyle?: CSSProperties
unstyled?: boolean
loadingIcon?: Component
class: any
classes?: ToastClassnames
class: string
classes?: ToastClasses
icons?: ToastIcons
closeButtonAriaLabel?: string
pauseWhenPageIsHidden: boolean
Expand Down
12 changes: 6 additions & 6 deletions src/components/Styling.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ const renderedCode = computed(() => {
? `<Toaster
:toastOptions="{
style: { background: '#fda4af' },
className: 'my-toast',
descriptionClassName: 'my-toast-description'
class: 'my-toast',
descriptionClass: 'my-toast-description'
}"
/>`
: `toast('Event has been created', {
style: {
background: '#6ee7b7'
},
className: 'my-toast',
descriptionClassName: 'my-toast-description'
class: 'my-toast',
descriptionClass: 'my-toast-description'
})`
})
Expand All @@ -84,8 +84,8 @@ const handleClick = (action: string) => {
style: {
background: currentAction.value === 'all' ? '#fda4af' : '#6ee7b7'
},
className: 'my-toast',
descriptionClassName: 'my-toast-description'
class: 'my-toast',
descriptionClass: 'my-toast-description'
})
}
Expand Down

0 comments on commit 6c0238e

Please sign in to comment.