Skip to content

Commit

Permalink
chore(Notification)!: rename to closeButton and actionButton for …
Browse files Browse the repository at this point in the history
…consistency
  • Loading branch information
benjamincanac committed May 29, 2023
1 parent daca463 commit 4458656
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/content/1.getting-started/3.theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default defineAppConfig({
},
notification: {
default: {
close: {
closeButton: {
icon: 'i-octicon-x-24'
}
}
Expand Down
10 changes: 5 additions & 5 deletions docs/content/5.overlays/6.notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ function onCallback () {

### Close

Use the `close` prop to hide or customize the close button on the Notification.
Use the `close-button` prop to hide or customize the close button on the Notification.

You can pass all the props of the [Button](/elements/button) component to customize it through the `close` prop or globally through `ui.notifications.default.close`.
You can pass all the props of the [Button](/elements/button) component to customize it through the `close-button` prop or globally through `ui.notifications.default.closeButton`.

::component-card
---
Expand All @@ -198,7 +198,7 @@ baseProps:
title: 'Notification'
timeout: 0
props:
close:
closeButton:
icon: 'i-heroicons-archive-box-x-mark'
color: 'primary'
variant: 'outline'
Expand All @@ -207,7 +207,7 @@ props:
ui:
rounded: 'rounded-full'
excludedProps:
- close
- closeButton
---
::

Expand All @@ -230,7 +230,7 @@ const toast = useToast()
```
::

Like for `close`, you can pass all the props of the [Button](/elements/button) component inside the action or globally through `ui.notifications.default.action`.
Like for `closeButton`, you can pass all the props of the [Button](/elements/button) component inside the action or globally through `ui.notifications.default.actionButton`.

::component-card
---
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,13 @@ const notification = {
default: {
color: 'primary',
icon: null,
close: {
closeButton: {
icon: 'i-heroicons-x-mark-20-solid',
color: 'gray',
variant: 'link',
padded: false
},
action: {
actionButton: {
size: 'xs',
color: 'white'
}
Expand Down
10 changes: 5 additions & 5 deletions src/runtime/components/overlays/Notification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
</p>

<div v-if="description && actions.length" class="mt-3 flex items-center gap-2">
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.action, ...action }" @click.stop="onAction(action)" />
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
</div>
</div>
<div class="flex-shrink-0 flex items-center gap-3">
<div v-if="!description && actions.length" class="flex items-center gap-2">
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.action, ...action }" @click.stop="onAction(action)" />
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...ui.default.actionButton, ...action }" @click.stop="onAction(action)" />
</div>

<UButton v-if="close" v-bind="{ ...ui.default.close, ...close }" @click.stop="onClose" />
<UButton v-if="closeButton" v-bind="{ ...ui.default.closeButton, ...closeButton }" @click.stop="onClose" />
</div>
</div>
</div>
Expand Down Expand Up @@ -80,9 +80,9 @@ export default defineComponent({
type: Object as PropType<Partial<Avatar>>,
default: null
},
close: {
closeButton: {
type: Object as PropType<Partial<Button>>,
default: () => appConfig.ui.notification.default.close
default: () => appConfig.ui.notification.default.closeButton
},
timeout: {
type: Number,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/types/notification.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Notification {
description: string
icon?: string
avatar?: Partial<Avatar>
close?: Partial<Button>
closeButton?: Partial<Button>
timeout: number
actions?: NotificationAction[]
click?: Function
Expand Down

1 comment on commit 4458656

@vercel
Copy link

@vercel vercel bot commented on 4458656 May 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui.nuxtlabs.com
ui-git-dev-nuxtlabs.vercel.app
ui-nuxtlabs.vercel.app

Please sign in to comment.