generated from it-at-m/oss-repository-en-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ 95 build a wrapper component for icons (#97)
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { fn } from "@storybook/test"; | ||
|
||
import MucIcon from "./MucIcon.vue"; | ||
|
||
export default { | ||
component: MucIcon, | ||
title: "MucIcon", | ||
tags: ["autodocs"], | ||
// 👇 Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked | ||
args: { onClick: fn() }, | ||
parameters: { | ||
docs: { | ||
description: { | ||
component: `The \`muc-icon\` component is a wrapper commponent for all icons in the patternlab. | ||
[🔗 Patternlab-Docs](https://patternlab.muenchen.space/?p=viewall-guidelines-icons) | ||
[🖼 Iconography](https://it-at-m.github.io/muc-patternlab-vue/?path=/docs/iconography--docs) | ||
`, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Weather = { | ||
args: { | ||
icon: "weather", | ||
}, | ||
}; | ||
|
||
export const Youtube = { | ||
args: { | ||
icon: "youtube", | ||
color: "red", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<template> | ||
<svg | ||
aria-hidden="true" | ||
class="m-button__icon" | ||
:style="{ color: color }" | ||
> | ||
<use :href="'#icon-' + icon" /> | ||
</svg> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineProps<{ | ||
/** | ||
* String of the icon to be displayed. | ||
*/ | ||
icon: string; | ||
/** | ||
* Optional css-color for the icon. | ||
*/ | ||
color?: string; | ||
}>(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import MucIcon from "./MucIcon.vue"; | ||
|
||
export { MucIcon }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters