Skip to content

Commit 2ee9ccb

Browse files
committed
review fixes
1 parent 54aeff7 commit 2ee9ccb

File tree

1 file changed

+8
-41
lines changed
  • packages/dialtone-vue2/components/toast

1 file changed

+8
-41
lines changed

packages/dialtone-vue2/components/toast/toast.vue

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<toast-layout-alternate
3-
v-if="layout === 'alternate'"
2+
<component
3+
:is="selectedLayout"
44
:is-shown="isShown"
55
:title-id="titleId"
66
:content-id="contentId"
@@ -33,42 +33,7 @@
3333
<template #action>
3434
<slot name="action" />
3535
</template>
36-
</toast-layout-alternate>
37-
<toast-layout-default
38-
v-else
39-
:is-shown="isShown"
40-
:title-id="titleId"
41-
:content-id="contentId"
42-
:title="title"
43-
:message="message"
44-
:role="role"
45-
:kind="kind"
46-
:important="important"
47-
:close-button-props="closeButtonProps"
48-
:hide-close="hideClose"
49-
:hide-icon="hideIcon"
50-
:hide-action="hideAction"
51-
v-on="$listeners"
52-
@close="handleClose"
53-
>
54-
<!-- @slot Slot for custom icon -->
55-
<template #icon>
56-
<slot name="icon" />
57-
</template>
58-
<template #titleOverride>
59-
<!-- @slot Allows you to override the title, only use this if you need to override
60-
with something other than text. Otherwise use the "title" prop. -->
61-
<slot name="titleOverride" />
62-
</template>
63-
<!-- @slot the main textual content of the toast -->
64-
<slot>
65-
{{ message }}
66-
</slot>
67-
<!-- @slot Enter a possible action for the user to take, such as a link to another page -->
68-
<template #action>
69-
<slot name="action" />
70-
</template>
71-
</toast-layout-default>
36+
</component>
7237
</template>
7338

7439
<script>
@@ -216,9 +181,7 @@ export default {
216181
},
217182
218183
/**
219-
* The duration in ms the toast will display before disappearing.
220-
* The toast won't disappear if the duration is not provided.
221-
* If it's provided, it should be equal to or greater than 6000.
184+
* The layout / styling you wish to use for the toast.
222185
* @values default, alternate
223186
*/
224187
layout: {
@@ -257,6 +220,10 @@ export default {
257220
shouldSetTimeout () {
258221
return !!this.duration && this.duration >= this.minDuration;
259222
},
223+
224+
selectedLayout () {
225+
return this.layout === 'alternate' ? ToastLayoutAlternate : ToastLayoutDefault;
226+
},
260227
},
261228
262229
watch: {

0 commit comments

Comments
 (0)