Skip to content

Commit 6c0238e

Browse files
Merge pull request #58 from jdm1219/main
refactor: Updated the �docs and type of the class option
2 parents 23cd00e + af28d1c commit 6c0238e

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ You can style your toasts globally with the `toastOptions` prop in the `Toaster`
288288
<Toaster
289289
:toastOptions="{
290290
style: { background: 'red' },
291-
className: 'my-toast',
292-
descriptionClassName: 'my-toast-description'
291+
class: 'my-toast',
292+
descriptionClass: 'my-toast-description'
293293
}"
294294
/>
295295
```
@@ -301,8 +301,8 @@ toast('Event has been created', {
301301
style: {
302302
background: 'red'
303303
},
304-
className: 'my-toast',
305-
descriptionClassName: 'my-toast-description'
304+
class: 'my-toast',
305+
descriptionClass: 'my-toast-description'
306306
})
307307
```
308308

packages/types.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type PromiseData<ToastData = any> = ExternalToast & {
2222
finally?: () => void | Promise<void>
2323
}
2424

25-
export interface ToastClassnames {
25+
export interface ToastClasses {
2626
toast?: string
2727
title?: string
2828
description?: string
@@ -77,8 +77,8 @@ export type ToastT<T extends Component = Component> = {
7777
actionButtonStyle?: CSSProperties
7878
style?: CSSProperties
7979
unstyled?: boolean
80-
class?: any
81-
classes?: ToastClassnames
80+
class?: string
81+
classes?: ToastClasses
8282
descriptionClass?: string
8383
position?: Position
8484
}
@@ -98,15 +98,15 @@ export interface HeightT {
9898
}
9999

100100
export interface ToastOptions {
101-
class?: any
101+
class?: string
102102
closeButton?: boolean
103-
descriptionClass?: any
103+
descriptionClass?: string
104104
style?: CSSProperties
105105
cancelButtonStyle?: CSSProperties
106106
actionButtonStyle?: CSSProperties
107107
duration?: number
108108
unstyled?: boolean
109-
classes?: ToastClassnames
109+
classes?: ToastClasses
110110
}
111111

112112
export type CnFunction = (...classes: Array<string | undefined>) => string
@@ -123,7 +123,7 @@ export interface ToasterProps {
123123
visibleToasts?: number
124124
closeButton?: boolean
125125
toastOptions?: ToastOptions
126-
class?: any
126+
class?: string
127127
style?: CSSProperties
128128
offset?: string | number
129129
dir?: 'rtl' | 'ltr' | 'auto'
@@ -147,14 +147,14 @@ export interface ToastProps {
147147
closeButton: boolean
148148
interacting: boolean
149149
duration?: number
150-
descriptionClass?: any
150+
descriptionClass?: string
151151
style?: CSSProperties
152152
cancelButtonStyle?: CSSProperties
153153
actionButtonStyle?: CSSProperties
154154
unstyled?: boolean
155155
loadingIcon?: Component
156-
class: any
157-
classes?: ToastClassnames
156+
class: string
157+
classes?: ToastClasses
158158
icons?: ToastIcons
159159
closeButtonAriaLabel?: string
160160
pauseWhenPageIsHidden: boolean

src/components/Styling.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ const renderedCode = computed(() => {
6565
? `<Toaster
6666
:toastOptions="{
6767
style: { background: '#fda4af' },
68-
className: 'my-toast',
69-
descriptionClassName: 'my-toast-description'
68+
class: 'my-toast',
69+
descriptionClass: 'my-toast-description'
7070
}"
7171
/>`
7272
: `toast('Event has been created', {
7373
style: {
7474
background: '#6ee7b7'
7575
},
76-
className: 'my-toast',
77-
descriptionClassName: 'my-toast-description'
76+
class: 'my-toast',
77+
descriptionClass: 'my-toast-description'
7878
})`
7979
})
8080
@@ -84,8 +84,8 @@ const handleClick = (action: string) => {
8484
style: {
8585
background: currentAction.value === 'all' ? '#fda4af' : '#6ee7b7'
8686
},
87-
className: 'my-toast',
88-
descriptionClassName: 'my-toast-description'
87+
class: 'my-toast',
88+
descriptionClass: 'my-toast-description'
8989
})
9090
}
9191

0 commit comments

Comments
 (0)