Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icon slot to emptycontent #1806

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions src/components/EmptyContent/EmptyContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,35 @@ Providing an additional description is strongly advised.
No comments
<template #desc>No comments in here</template>
</EmptyContent>
```
```
<template>
<EmptyContent>
Network error
<template #icon><Airplane /></template>
<template #desc>Unable to load the list</template>
</EmptyContent>
</template>

<script>
import Airplane from 'vue-material-design-icons/Airplane'

export default {
components: {
Airplane
}
}
</script>

```
</docs>

<template>
<div class="empty-content" role="note">
<div class="empty-content__icon" :class="icon" role="img" />
<div class="empty-content__icon" :class="icon" role="img">
<!-- @slot Optional icon slot -->
<slot name="icon" />
</div>
<h2 class="empty-content__title">
<!-- @slot Mandatory title -->
<slot />
Expand All @@ -58,31 +81,40 @@ export default {
*/
icon: {
type: String,
required: true,
default: '',
},
},
}
</script>

<style lang="scss">
<style lang="scss" scoped>
.empty-content {
margin-top: 20vh;
display: flex;
flex-direction: column;
align-items: center;
flex-direction: column;
margin-top: 20vh;

&__icon {
display: flex;
align-items: center;
justify-content: center;
width: 64px;
height: 64px;
margin: 0 auto 15px;
opacity: .4;
background-size: 64px;
background-repeat: no-repeat;
background-position: center;
background-size: 64px;

svg {
width: 64px;
height: 64px;
}
}

&__title {
margin-bottom: 10px;
}
}

</style>