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.
Merge pull request #58 from it-at-m/57-muccard
57 muccard
- Loading branch information
Showing
8 changed files
with
296 additions
and
8 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
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,55 @@ | ||
import { fn } from "@storybook/test"; | ||
|
||
import MucCard from "./MucCard.vue"; | ||
|
||
export default { | ||
component: MucCard, | ||
title: "MucCard", | ||
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: `A Card-Component in Patternlab-Style. | ||
Use inside [MucCardContainer](/docs/muccardcontainer--docs) for a automatically wrapping layout. | ||
🔗 Patternlab-Docs (not yet available) | ||
`, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Default = { | ||
args: { | ||
title: "Lorem Ipsum", | ||
tagline: "Dolor", | ||
content: | ||
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", | ||
}, | ||
}; | ||
|
||
export const WithHeaderPrefix = () => ({ | ||
components: { MucCard }, | ||
template: ` | ||
<MucCard | ||
v-bind="$props" | ||
title="Lorem Ipsum" | ||
tagline="Dolor" | ||
> | ||
<template #headerPrefix> | ||
<div | ||
style="padding-right: 16px; font-size: 32px;" | ||
> | ||
📆 | ||
</div> | ||
</template> | ||
<template #content> | ||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et | ||
dolore magna aliquyam erat, sed diam voluptua. | ||
</template> | ||
</MucCard> | ||
`, | ||
}); |
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,92 @@ | ||
<template> | ||
<div | ||
class="card" | ||
@click="emit('click', $event)" | ||
> | ||
<div class="card-content"> | ||
<div class="card-header"> | ||
<slot name="headerPrefix" /> | ||
<div> | ||
<div | ||
v-if="tagline" | ||
class="card-tagline" | ||
> | ||
{{ tagline }} | ||
</div> | ||
<div> | ||
<h3>{{ title }}</h3> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="muc-divider" /> | ||
|
||
<slot name="content" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const emit = defineEmits<{ | ||
/** | ||
* Triggered when card is clicked. | ||
* @param e Click-Event | ||
*/ | ||
(e: "click", click: Event): void; | ||
}>(); | ||
defineProps<{ | ||
title: string; | ||
tagline: string; | ||
}>(); | ||
defineSlots<{ | ||
/** | ||
* Icon shown above the callout. Defaults to icons matching the type. | ||
*/ | ||
headerPrefix(): any; | ||
/** | ||
* Content beneath the heading shown as text. | ||
*/ | ||
content(): any; | ||
}>(); | ||
</script> | ||
|
||
<style scoped> | ||
.card { | ||
cursor: pointer; | ||
border: solid 1px var(--color-neutrals-blue); | ||
border-bottom: solid 5px var(--color-brand-main-blue); | ||
transition: background-color ease-in 150ms; | ||
} | ||
.card:hover { | ||
background-color: #f1f1f1; | ||
} | ||
.card-content { | ||
padding: 32px 24px; | ||
} | ||
.card-header { | ||
display: flex; | ||
} | ||
.card-tagline { | ||
font-size: 16px; | ||
font-family: | ||
Open Sans, | ||
sans-serif; | ||
color: #005a9f; | ||
font-weight: 700; | ||
line-height: 24px; | ||
word-wrap: break-word; | ||
padding-bottom: 4px; | ||
} | ||
.muc-divider { | ||
margin-top: 16px; | ||
margin-bottom: 16px; | ||
} | ||
</style> |
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,43 @@ | ||
import { fn } from "@storybook/test"; | ||
|
||
import MucCard from "./MucCard.vue"; | ||
import MucCardContainer from "./MucCardContainer.vue"; | ||
|
||
export default { | ||
components: { MucCardContainer }, | ||
component: MucCardContainer, | ||
title: "MucCardContainer", | ||
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: `A wrapping Layout to use with [MucCard](/docs/muccard--docs). | ||
🔗 Patternlab-Docs (not yet available) | ||
`, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Template = () => ({ | ||
components: { MucCardContainer, MucCard }, | ||
template: ` | ||
<MucCardContainer> | ||
<MucCard | ||
v-bind="$props" | ||
title="Lorem Ipsum" | ||
tagline="Dolor" | ||
v-for="index in 5" | ||
:key="index" | ||
> | ||
<template #content> | ||
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et | ||
dolore magna aliquyam erat, sed diam voluptua. | ||
</template> | ||
</MucCard> | ||
</MucCardContainer> | ||
`, | ||
}); |
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,37 @@ | ||
<template> | ||
<div class="container card-container"> | ||
<slot/> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
defineSlots<{ | ||
/** | ||
* MucCards can be put into this slot. | ||
*/ | ||
default(): any; | ||
}>(); | ||
</script> | ||
|
||
<style scoped> | ||
@media all and (min-width: 992px) { | ||
.card-container { | ||
padding-left: 0; | ||
padding-right: 0; | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, 384px); | ||
grid-column-gap: 32px; | ||
grid-row-gap: 32px; | ||
} | ||
} | ||
@media all and (max-width: 992px) { | ||
.card-container { | ||
padding-left: 0; | ||
padding-right: 0; | ||
display: inline-grid; | ||
grid-template-columns: 1fr; | ||
grid-row-gap: 32px; | ||
} | ||
} | ||
</style> |
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,4 @@ | ||
import MucCard from "./MucCard.vue"; | ||
import MucCardContainer from "./MucCardContainer.vue"; | ||
|
||
export { MucCard, MucCardContainer }; |
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
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