Skip to content

Commit

Permalink
Refactor #5592 - Message components
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Apr 30, 2024
1 parent a247c49 commit 527bae0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions components/lib/message/Message.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ export interface MessagePassThroughOptions<T = any> {
*/
root?: MessagePassThroughOptionType<T>;
/**
* Used to pass attributes to the wrapper's DOM element.
* Used to pass attributes to the content's DOM element.
*/
wrapper?: MessagePassThroughOptionType<T>;
content?: MessagePassThroughOptionType<T>;
/**
* Used to pass attributes to the icon's DOM element.
*/
Expand Down
2 changes: 1 addition & 1 deletion components/lib/message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<transition name="p-message" appear v-bind="ptmi('transition')">
<div v-show="visible" :class="cx('root')" role="alert" aria-live="assertive" aria-atomic="true" v-bind="ptm('root')">
<slot v-if="$slots.container" name="container" :onClose="close" :closeCallback="close"></slot>
<div v-else :class="cx('wrapper')" v-bind="ptm('wrapper')">
<div v-else :class="cx('content')" v-bind="ptm('content')">
<slot name="messageicon" class="p-message-icon">
<component :is="icon ? 'span' : iconComponent" :class="[cx('icon'), icon]" v-bind="ptm('icon')"></component>
</slot>
Expand Down
16 changes: 6 additions & 10 deletions components/lib/toast/Toast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,17 @@ export interface ToastPassThroughOptions {
*/
message?: ToastPassThroughOptionType;
/**
* Used to pass attributes to the container's DOM element.
* Used to pass attributes to the message content's DOM element.
*/
container?: ToastPassThroughOptionType;
messageContent?: ToastPassThroughOptionType;
/**
* Used to pass attributes to the content's DOM element.
* Used to pass attributes to the message icon's DOM element.
*/
content?: ToastPassThroughOptionType;
messageIcon?: ToastPassThroughOptionType;
/**
* Used to pass attributes to the icon's DOM element.
* Used to pass attributes to the message text's DOM element.
*/
icon?: ToastPassThroughOptionType;
/**
* Used to pass attributes to the text's DOM element.
*/
text?: ToastPassThroughOptionType;
messageText?: ToastPassThroughOptionType;
/**
* Used to pass attributes to the summary's DOM element.
*/
Expand Down
8 changes: 4 additions & 4 deletions components/lib/toast/ToastMessage.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div :class="[cx('container'), message.styleClass]" role="alert" aria-live="assertive" aria-atomic="true" v-bind="ptm('container')">
<div :class="[cx('message'), message.styleClass]" role="alert" aria-live="assertive" aria-atomic="true" v-bind="ptm('message')">
<component v-if="templates.container" :is="templates.container" :message="message" :onClose="onCloseClick" :closeCallback="onCloseClick" />
<div v-else :class="[cx('content'), message.contentStyleClass]" v-bind="ptm('content')">
<div v-else :class="[cx('messageContent'), message.contentStyleClass]" v-bind="ptm('messageContent')">
<template v-if="!templates.message">
<component :is="templates.icon ? templates.icon : iconComponent && iconComponent.name ? iconComponent : 'span'" :class="cx('icon')" v-bind="ptm('icon')" />
<div :class="cx('text')" v-bind="ptm('text')">
<component :is="templates.icon ? templates.icon : iconComponent && iconComponent.name ? iconComponent : 'span'" :class="cx('messageIcon')" v-bind="ptm('messageIcon')" />
<div :class="cx('messageText')" v-bind="ptm('messageText')">
<span :class="cx('summary')" v-bind="ptm('summary')">{{ message.summary }}</span>
<div :class="cx('detail')" v-bind="ptm('detail')">{{ message.detail }}</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions components/lib/toast/style/ToastStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const classes = {
'p-ripple-disabled': instance.$primevue.config.ripple === false
}
],
container: ({ props }) => [
message: ({ props }) => [
'p-toast-message',
{
'p-toast-message-info': props.message.severity === 'info' || props.message.severity === undefined,
Expand All @@ -29,8 +29,8 @@ const classes = {
'p-toast-message-contrast': props.message.severity === 'contrast'
}
],
content: 'p-toast-message-content',
icon: ({ props }) => [
messageContent: 'p-toast-message-content',
messageIcon: ({ props }) => [
'p-toast-message-icon',
{
[props.infoIcon]: props.message.severity === 'info',
Expand All @@ -39,7 +39,7 @@ const classes = {
[props.successIcon]: props.message.severity === 'success'
}
],
text: 'p-toast-message-text',
messageText: 'p-toast-message-text',
summary: 'p-toast-summary',
detail: 'p-toast-detail',
closeButton: 'p-toast-close-button',
Expand Down

0 comments on commit 527bae0

Please sign in to comment.