Skip to content

Commit

Permalink
Have quality panel open by default on public view, not on editable to…
Browse files Browse the repository at this point in the history
… be less overwhelming
  • Loading branch information
hfroot committed Apr 30, 2024
1 parent 0434423 commit b210815
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/CanteenPublication/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</v-form>
</v-col>
<h2 class="mt-12 mb-8">Où en-sommes nous de notre transition alimentaire ?</h2>
<DsfrAccordion :items="badgeItems" class="mt-4">
<DsfrAccordion :items="badgeItems" :openPanelIndex="editable ? undefined : 0" class="mt-4">
<template v-slot:title="{ item }">
<span class="d-flex align-center">
<v-img
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/components/DsfrAccordion.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-expansion-panels hover accordion tile flat class="dsfr-accordion">
<v-expansion-panels v-model="openPanel" hover accordion tile flat class="dsfr-accordion">
<v-expansion-panel v-for="item in items" :key="item.title">
<v-expansion-panel-header class="px-3 fr-accordion__btn" v-slot="{ open }">
<component :is="item.titleLevel || 'h3'" class="fr-text" :class="open && 'active-panel'">
Expand All @@ -22,6 +22,15 @@ export default {
// items is an array of objects containing 'title'
// and one of 'content' or provide a template using the slot
items: Array,
openPanelIndex: {
type: Number,
optional: true,
},
},
data() {
return {
openPanel: this.openPanelIndex,
}
},
}
</script>
Expand Down

0 comments on commit b210815

Please sign in to comment.