From e7c10bcb0dbbfbbe48bbdea7cbd99d4535be1adb Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 Jan 2025 14:46:45 +0100 Subject: [PATCH] fix(Alert): allow actions wrap (#3083) --- playground/app/pages/components/alert.vue | 41 +++++++++++++++++++ src/theme/alert.ts | 2 +- .../__snapshots__/Alert-vue.spec.ts.snap | 4 +- .../__snapshots__/Alert.spec.ts.snap | 4 +- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/playground/app/pages/components/alert.vue b/playground/app/pages/components/alert.vue index ec6e5d95..34d86bb1 100644 --- a/playground/app/pages/components/alert.vue +++ b/playground/app/pages/components/alert.vue @@ -11,6 +11,46 @@ const actions = (color: string) => [{ } }] +const multipleActions = (color: string) => [ + { + label: 'Action', + color: color as any, + click() { + console.log('Action clicked') + } + }, + { + label: 'Another action', + color: color as any, + click() { + console.log('Another action clicked') + } + }, + { + label: 'One more action', + color: color as any, + click() { + console.log('One more action clicked') + } + }, + { + label: 'And one more', + color: color as any, + icon: 'i-lucide-info', + click() { + console.log('And one more clicked') + } + }, + { + label: 'Last one', + color: color as any, + icon: 'i-lucide-info', + click() { + console.log('Last one clicked') + } + } +] + const data = { title: 'Heads up!', description: 'You can change the primary color in your app config.', @@ -28,6 +68,7 @@ const data = { +
diff --git a/src/theme/alert.ts b/src/theme/alert.ts index bc68ab48..26411c4f 100644 --- a/src/theme/alert.ts +++ b/src/theme/alert.ts @@ -9,7 +9,7 @@ export default (options: Required) => ({ icon: 'shrink-0 size-5', avatar: 'shrink-0', avatarSize: '2xl', - actions: 'flex gap-1.5 shrink-0', + actions: 'flex flex-wrap gap-1.5 shrink-0', close: 'p-0.5' }, variants: { diff --git a/test/components/__snapshots__/Alert-vue.spec.ts.snap b/test/components/__snapshots__/Alert-vue.spec.ts.snap index 35d2d1f4..d53652db 100644 --- a/test/components/__snapshots__/Alert-vue.spec.ts.snap +++ b/test/components/__snapshots__/Alert-vue.spec.ts.snap @@ -43,7 +43,7 @@ exports[`Alert > renders with close correctly 1`] = `
-
@@ -70,7 +70,7 @@ exports[`Alert > renders with closeIcon correctly 1`] = ` -
diff --git a/test/components/__snapshots__/Alert.spec.ts.snap b/test/components/__snapshots__/Alert.spec.ts.snap index 7d771cb5..1d7fa744 100644 --- a/test/components/__snapshots__/Alert.spec.ts.snap +++ b/test/components/__snapshots__/Alert.spec.ts.snap @@ -43,7 +43,7 @@ exports[`Alert > renders with close correctly 1`] = ` -
@@ -70,7 +70,7 @@ exports[`Alert > renders with closeIcon correctly 1`] = ` -