2019-08-24 23:42:41 +00:00
|
|
|
<template>
|
2020-02-24 18:44:50 +00:00
|
|
|
<fieldset :id="label.toLowerCase()" :class="{ 'no-colored-frames': !frameColorsEnabled }">
|
2019-10-25 08:14:34 +00:00
|
|
|
<legend @click.prevent="collapse">
|
|
|
|
|
<span>{{ label }}</span>
|
2020-09-24 02:52:54 +00:00
|
|
|
<i class="ml-2 align-middle material-icons">
|
2020-02-25 04:34:06 +00:00
|
|
|
{{ isCollapsed(label) ? "expand_more" : "expand_less" }}
|
2019-12-02 15:20:20 +00:00
|
|
|
</i>
|
2019-10-25 08:14:34 +00:00
|
|
|
</legend>
|
2020-02-25 16:10:40 +00:00
|
|
|
<div class="collapsible" :class="{ hidden: isCollapsed(label.toLowerCase()) }">
|
2019-09-16 08:20:28 +00:00
|
|
|
<slot />
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
2019-08-24 23:42:41 +00:00
|
|
|
</template>
|
|
|
|
|
|
2020-02-03 03:08:40 +00:00
|
|
|
<style scoped lang="scss">
|
2020-06-19 17:37:40 +00:00
|
|
|
fieldset {
|
2020-09-22 17:06:37 +00:00
|
|
|
@apply my-2;
|
|
|
|
|
@apply p-2;
|
|
|
|
|
@apply rounded-lg;
|
|
|
|
|
@apply bg-bgDarkColor;
|
|
|
|
|
@apply transition;
|
|
|
|
|
@apply ease-in-out;
|
|
|
|
|
@apply duration-200;
|
2020-06-19 17:37:40 +00:00
|
|
|
|
|
|
|
|
legend {
|
2020-09-22 17:06:37 +00:00
|
|
|
@apply text-fgColor;
|
|
|
|
|
@apply text-sm;
|
|
|
|
|
@apply font-bold;
|
|
|
|
|
@apply cursor-pointer;
|
|
|
|
|
@apply transition;
|
|
|
|
|
@apply ease-in-out;
|
|
|
|
|
@apply duration-200;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.blue legend {
|
2020-09-24 02:52:54 +00:00
|
|
|
@apply text-blue-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.green legend {
|
2020-09-24 02:52:54 +00:00
|
|
|
@apply text-green-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
2020-09-24 02:52:54 +00:00
|
|
|
&.teal legend {
|
|
|
|
|
@apply text-teal-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.purple legend {
|
2020-09-24 02:52:54 +00:00
|
|
|
@apply text-purple-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.orange legend {
|
2020-09-24 02:52:54 +00:00
|
|
|
@apply text-orange-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.pink legend {
|
2020-09-24 02:52:54 +00:00
|
|
|
@apply text-pink-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.red legend {
|
2020-09-24 02:52:54 +00:00
|
|
|
@apply text-red-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.yellow legend {
|
2020-09-24 02:52:54 +00:00
|
|
|
@apply text-yellow-400;
|
2020-06-19 17:37:40 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-02 05:32:21 +00:00
|
|
|
fieldset.no-colored-frames legend {
|
2020-09-22 17:06:37 +00:00
|
|
|
@apply text-fgColor;
|
2019-11-02 05:32:21 +00:00
|
|
|
}
|
2019-08-24 23:42:41 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<script>
|
2019-11-02 05:32:21 +00:00
|
|
|
export default {
|
|
|
|
|
computed: {
|
|
|
|
|
frameColorsEnabled() {
|
2020-02-25 16:10:40 +00:00
|
|
|
return this.$store.state.postwoman.settings.FRAME_COLORS_ENABLED || false
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
2020-02-25 04:34:06 +00:00
|
|
|
sectionString() {
|
2020-02-25 16:33:02 +00:00
|
|
|
return `${this.$route.path.replace(/\/+$/, "")}/${this.label}`
|
2020-02-25 16:10:40 +00:00
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
2019-10-25 08:14:34 +00:00
|
|
|
|
2019-11-02 05:32:21 +00:00
|
|
|
props: {
|
|
|
|
|
label: {
|
|
|
|
|
type: String,
|
2020-02-25 02:06:23 +00:00
|
|
|
default: "Section",
|
2019-10-22 12:02:26 +00:00
|
|
|
},
|
2019-11-02 05:32:21 +00:00
|
|
|
},
|
2019-08-24 23:42:41 +00:00
|
|
|
|
2019-11-02 05:32:21 +00:00
|
|
|
methods: {
|
2020-11-12 01:18:40 +00:00
|
|
|
collapse() {
|
2020-02-25 07:04:10 +00:00
|
|
|
// Save collapsed section into the collapsedSections array
|
2020-02-25 16:10:40 +00:00
|
|
|
this.$store.commit("setCollapsedSection", this.sectionString)
|
2020-02-24 18:44:50 +00:00
|
|
|
},
|
2020-02-25 04:34:06 +00:00
|
|
|
isCollapsed(label) {
|
2020-02-25 16:10:40 +00:00
|
|
|
return this.$store.state.theme.collapsedSections.includes(this.sectionString) || false
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
2019-08-25 08:37:21 +00:00
|
|
|
</script>
|