Browse Source

implement checkbox help

tripeur 4 years ago
parent
commit
160624ef6d
3 changed files with 70 additions and 4 deletions
  1. 2 0
      src/components/EditeurCreneau.vue
  2. 49 0
      src/components/checkBox.vue
  3. 19 4
      src/views/CompetenceManager.vue

+ 2 - 0
src/components/EditeurCreneau.vue

@@ -110,11 +110,13 @@
         <checkbox
           label="Créneau repas"
           :modelValue="creneau.isMeal"
+          help="Indique au solveur que ce créneau est un créneau repas"
           @input="checkboxListener($event, 'isMeal')"
         />
         <checkbox
           label="Bénévole fixe"
           :modelValue="creneau.fixedAttendee"
+          help="Indique au solveur de ne pas changer l'affectation de ce créneau"
           @input="checkboxListener($event, 'fixedAttendee')"
         />
       </div>

+ 49 - 0
src/components/checkBox.vue

@@ -2,6 +2,7 @@
   <label :class="{ filled }" :for="id">
     <input :id="id" type="checkbox" v-model="checked" />
     <span>{{ label }}</span>
+    <span v-if="help" class="help" :aria-label="help"><i class="material-icons">info</i></span>
   </label>
 </template>
 
@@ -17,6 +18,7 @@ export default defineComponent({
     label: String,
     id: String,
     filled: Boolean,
+    help: String,
   },
   watch: {
     modelValue(value: boolean) {
@@ -96,4 +98,51 @@ input[type="checkbox"]:checked {
   width: 8px;
   height: 14px;
 }
+.help .material-icons {
+  vertical-align: text-top;
+  font-size: 1em;
+}
+.help {
+  font-size: 1em;
+  color: var(--color-accent-400);
+  position: relative;
+  margin-left: 4px;
+}
+.help::after,
+.help::before {
+  pointer-events: none;
+  transition: all 0.18s ease-out 0.18s;
+  position: absolute;
+  z-index: 10;
+  bottom: 100%;
+  left: 50%;
+  transform-origin: top;
+  transform: translate(-50%, 4px);
+  opacity: 0;
+}
+.help::after {
+  content: attr(aria-label);
+  background: var(--color-neutral-200);
+  padding: 0.5em 1em;
+  border-radius: 4px;
+  color: #fff;
+  line-height: 1em;
+  font-weight: normal;
+  white-space: normal;
+  width: 160px;
+  text-align: center;
+  margin-bottom: 10px;
+}
+.help::before {
+  content: "";
+  width: 0;
+  height: 0;
+  border: 5px solid transparent;
+  border-top-color: var(--color-neutral-200);
+}
+.help:hover::before,
+.help:hover::after {
+  transform: translate(-50%, 0);
+  opacity: 1;
+}
 </style>

+ 19 - 4
src/views/CompetenceManager.vue

@@ -113,12 +113,27 @@ export default defineComponent({
 <style scoped>
 .page {
   display: flex;
-  margin: 0px 10%;
-  justify-content: center;
+  flex-direction: column;
+  width: 100%;
+  max-width: 1100px;
+  gap: 16px;
 }
 .data-table {
-  margin: 8px 16px;
-  width: calc(100% - 432px);
+  width: 100%;
   height: min-content;
 }
+@media (min-width: 600px) {
+  .page {
+    flex-direction: row;
+    margin-top: 32px;
+  }
+  .data-table {
+    width: calc(100% - 432px);
+  }
+}
+@media (min-width: 1200px) {
+  .page {
+    margin-top: 32px;
+  }
+}
 </style>