Files
cloudron-box/dashboard/src/components/Section.vue
T

106 lines
1.9 KiB
Vue
Raw Normal View History

2025-05-06 19:00:26 +02:00
<script setup>
import { inject } from 'vue';
2025-05-06 19:00:26 +02:00
defineProps({
title: String,
padding: {
type: Boolean,
default: true,
},
titleBadge: {
type: String,
default: '',
},
2025-05-06 19:00:26 +02:00
});
const subscriptionRequiredDialog = inject('subscriptionRequiredDialog');
function onTitleBadge() {
subscriptionRequiredDialog.value.open();
}
</script>
2025-01-17 12:24:48 +01:00
<template>
2025-05-13 12:56:12 +02:00
<div class="section" :class="{ 'section-extra-padding': padding }">
2025-01-17 14:02:05 +01:00
<h2 class="section-header">
<div>
<slot name="header-title">{{ title }}</slot>
2025-09-15 17:26:52 +02:00
<slot name="header-title-extra"></slot>
<div class="section-header-title-badge" v-if="titleBadge" @click="onTitleBadge()">{{ titleBadge }}</div>
</div>
2025-01-28 13:55:05 +01:00
<div><slot name="header-buttons"></slot></div>
2025-01-17 14:02:05 +01:00
</h2>
2025-01-17 12:24:48 +01:00
<hr class="section-divider"/>
<div class="section-body">
2025-01-17 14:02:05 +01:00
<slot></slot>
2025-01-17 12:24:48 +01:00
</div>
</div>
</template>
<style>
2025-01-17 12:24:48 +01:00
2025-02-10 16:11:36 +01:00
.section {
margin-bottom: 20px;
position: relative;
2025-02-10 16:11:36 +01:00
}
2025-01-17 12:24:48 +01:00
.section-header {
2025-01-17 15:12:26 +01:00
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
gap: 5px;
2025-01-17 14:02:05 +01:00
padding-left: 15px;
padding-right: 15px;
padding-top: 5px;
margin-top: 0;
2025-09-08 19:32:45 +02:00
margin-bottom: 0px;
}
.section-header > div {
display: flex;
gap: 6px;
2025-03-26 16:04:58 +01:00
flex-wrap: wrap;
2025-09-22 20:47:40 +02:00
align-items: center;
2025-01-17 12:24:48 +01:00
}
.section-divider {
border-color: #d8dee4;
border-width: 1px;
margin-top: 10px;
margin-bottom: 5px;
2025-01-17 12:24:48 +01:00
}
2025-01-17 14:02:05 +01:00
@media (prefers-color-scheme: dark) {
.section-divider {
border-color: #495057;
}
}
2025-01-17 12:24:48 +01:00
.section-body {
position: relative;
margin-bottom: 15px;
padding: 10px 15px;
padding-bottom: 25px;
2025-01-17 12:24:48 +01:00
}
.section-extra-padding .section-body {
2025-09-08 19:32:45 +02:00
padding-left: 15px;
padding-right: 15px;
}
.section-header-title-badge {
display: inline-block;
font-size: 12px;
font-weight: 700;
color: white;
border-radius: 20px;
background-color: #00c383;
padding: 2px 10px;
margin-left: 10px;
cursor: pointer;
}
2025-01-17 12:24:48 +01:00
</style>