Skip to content

Commit 7402570

Browse files
authored
🐛 Merge pull request #197 from it-at-m/beta
2 parents 2815c2d + 3460043 commit 7402570

File tree

9 files changed

+165
-7
lines changed

9 files changed

+165
-7
lines changed

package-lock.json

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"./dist/style.css": "./dist/style.css",
2525
"./dist/assets/temporary/custom-style.css": "./dist/assets/temporary/custom-style.css",
2626
"./dist/assets/temporary/muenchende-style.css": "./dist/assets/temporary/muenchende-style.css",
27-
"./dist/assets/temporary/muenchende-fontface.css": "./dist/assets/temporary/muenchende-fontface.css",
27+
"./dist/assets/temporary/muenchende-fontfaces.css": "./dist/assets/temporary/muenchende-fontfaces.css",
2828
"./dist/assets/temporary/muc-icons.svg": "./dist/assets/temporary/muc-icons.svg",
2929
"./dist/assets/temporary/custom-icons.svg": "./dist/assets/temporary/custom-icons.svg"
3030
},
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import MucDivider from "./MucDivider.vue";
2+
3+
export default {
4+
component: MucDivider,
5+
title: "MucDivider",
6+
tags: ["autodocs"],
7+
parameters: {
8+
docs: {
9+
description: {
10+
component: `The \`muc-divider\` is a trivial divider.
11+
12+
[🔗 Patternlab-Docs](https://patternlab.muenchen.space/?p=viewall-components-all)
13+
`,
14+
},
15+
},
16+
},
17+
};
18+
19+
export const Default = {};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<hr class="divider-border" />
3+
</template>
4+
5+
<style scoped>
6+
.divider-border {
7+
border-bottom: 1px solid var(--color-neutrals-blue);
8+
}
9+
</style>

src/components/Divider/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import MucDivider from "./MucDivider.vue";
2+
3+
export { MucDivider };
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { fn } from "@storybook/test";
2+
3+
import MucLink from "./MucLink.vue";
4+
5+
export default {
6+
component: MucLink,
7+
title: "MucLink",
8+
tags: ["autodocs"],
9+
// 👇 Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked
10+
args: { onClick: fn() },
11+
parameters: {
12+
docs: {
13+
description: {
14+
component: `The \`muc-link\` component is a wrapper commponent for a standard html-a tag.
15+
16+
[🔗 Patternlab-Docs](https://patternlab.muenchen.space/?p=viewall-elements-links)
17+
`,
18+
},
19+
},
20+
},
21+
};
22+
23+
export const Weather = {
24+
args: {
25+
label: "Generic link label",
26+
},
27+
};
28+
29+
export const LinkWithIcon = {
30+
args: {
31+
icon: "youtube",
32+
label: "youtube",
33+
href: "https://www.youtube.com",
34+
noUnderline: true,
35+
},
36+
};

src/components/Link/MucLink.vue

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<template>
2+
<a
3+
:href="href"
4+
:target="target"
5+
class="m-link"
6+
:class="reversedUnderlineClass"
7+
>
8+
{{ label }}
9+
<slot name="icon">
10+
<muc-icon
11+
v-if="icon"
12+
:icon="icon"
13+
class="icon icon--after"
14+
/>
15+
</slot>
16+
</a>
17+
</template>
18+
19+
<script setup lang="ts">
20+
import { computed } from "vue";
21+
22+
import { MucIcon } from "../Icon";
23+
24+
const props = withDefaults(
25+
defineProps<{
26+
/**
27+
* Text shown as the link
28+
*/
29+
label: string;
30+
31+
/**
32+
* href to link to
33+
*/
34+
href?: string;
35+
36+
/**
37+
* Optional icon displayed behind the text
38+
*/
39+
icon?: string;
40+
41+
/**
42+
* Target on the link
43+
*/
44+
target?: string;
45+
46+
/**
47+
* Removes the underline from the label text
48+
*/
49+
noUnderline?: boolean;
50+
}>(),
51+
{
52+
noUnderline: false,
53+
href: "#",
54+
target: "_blank",
55+
}
56+
);
57+
58+
defineSlots<{
59+
/**
60+
* Icon slots overrides chosen prop icon.
61+
* The icon can be displayed infront or behind the label with these classes: icon--after | icon--before
62+
*/
63+
icon(): void;
64+
}>();
65+
66+
/**
67+
* Computed class to remove the underline if chosen.
68+
*/
69+
const reversedUnderlineClass = computed(() =>
70+
props.noUnderline ? "m-link--reversed-underline" : ""
71+
);
72+
</script>
73+
74+
<style scoped></style>

src/components/Link/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import MucLink from "./MucLink.vue";
2+
3+
export { MucLink };

src/components/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { MucButton } from "./Button";
33
import { MucCallout } from "./Callout";
44
import { MucCard, MucCardContainer } from "./Card";
55
import { MucComment, MucCommentText } from "./Comment/";
6+
import { MucDivider } from "./Divider";
67
import {
78
MucCheckbox,
89
MucCheckboxGroup,
@@ -15,6 +16,7 @@ import {
1516
} from "./Form";
1617
import { MucIcon } from "./Icon";
1718
import { MucIntro } from "./Intro";
19+
import { MucLink } from "./Link";
1820

1921
export {
2022
MucButton,
@@ -34,4 +36,6 @@ export {
3436
MucSelect,
3537
MucErrorList,
3638
MucIcon,
39+
MucDivider,
40+
MucLink,
3741
};

0 commit comments

Comments
 (0)