Skip to content

Commit 54729df

Browse files
committed
💥 add new required variable variant to MucBanner
1 parent aad7bcf commit 54729df

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

src/components/Banner/MucBanner.stories.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,47 @@ export default {
2121
export const Default = {
2222
args: {
2323
default: "Hi, I'm an Info-Banner!",
24+
variant: "content",
2425
type: "info",
2526
},
2627
};
2728

2829
export const Success = {
2930
args: {
3031
default: "Hi, I'm a Success-Banner!",
32+
variant: "content",
3133
type: "success",
3234
},
3335
};
3436

3537
export const Warning = {
3638
args: {
3739
default: "Hi, I'm a Warning-Banner!",
40+
variant: "content",
3841
type: "warning",
3942
},
4043
};
4144

4245
export const Emergency = {
4346
args: {
4447
default: "Hi, I'm an Emergency-Banner!",
48+
variant: "content",
4549
type: "emergency",
4650
},
4751
};
4852

53+
export const Header = {
54+
args: {
55+
default: "Hi, I'm an Info-Banner!",
56+
variant: "header",
57+
type: "info",
58+
},
59+
};
60+
4961
export const NoIcon = {
5062
args: {
51-
default: "Hi, I'm an Emergency-Banner!",
63+
default: "Hi, I'm a Warning-Banner!",
64+
variant: "content",
5265
type: "warning",
5366
noIcon: true,
5467
},

src/components/Banner/MucBanner.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@ import { computed } from "vue";
44
import { MucIcon } from "../Icon";
55
66
type bannerType = "info" | "success" | "warning" | "emergency";
7+
type bannerVariant = "content" | "header";
78
8-
const { type = "info", noIcon = false } = defineProps<{
9+
const {
10+
type = "info",
11+
variant,
12+
noIcon = false,
13+
} = defineProps<{
914
/**
10-
* Changes the style of the banner. Available types are `info`, `warning` and `emergency`.
15+
* Changes the style of the banner. Available types are `content` and `header`. `content` is used in the content area. `header` is used directly below the header and has more padding.
16+
*/
17+
variant: bannerVariant;
18+
19+
/**
20+
* Changes the style of the banner. Available types are `info`, `success`, `warning` and `emergency`.
1121
*/
1222
type?: bannerType;
1323
@@ -89,13 +99,26 @@ const typeIcon = computed(() => {
8999
:role="typeRole"
90100
:aria-label="typeAriaLabel"
91101
>
92-
<div>
102+
<template v-if="variant === 'content'">
93103
<muc-icon
94104
v-if="!noIcon"
95105
:icon="typeIcon"
96106
/>
97-
<slot />
98-
</div>
107+
<p>
108+
<slot />
109+
</p>
110+
</template>
111+
<template v-else>
112+
<div class="container-fluid">
113+
<muc-icon
114+
v-if="!noIcon"
115+
:icon="typeIcon"
116+
/>
117+
<p>
118+
<slot />
119+
</p>
120+
</div>
121+
</template>
99122
</div>
100123
</div>
101124
</div>

0 commit comments

Comments
 (0)