From 7ab9204e96e21050760cf3280197c139551829f5 Mon Sep 17 00:00:00 2001
From: Corentin THOMASSET <corentin.thomasset74@gmail.com>
Date: Sun, 3 Sep 2023 18:12:22 +0200
Subject: refactor(c-key-value-list): got rid of table for layout (#611)

---
 src/ui/c-key-value-list/c-key-value-list.vue | 30 +++++++---------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

(limited to 'src/ui/c-key-value-list/c-key-value-list.vue')

diff --git a/src/ui/c-key-value-list/c-key-value-list.vue b/src/ui/c-key-value-list/c-key-value-list.vue
index e3b19af..d8a2b00 100644
--- a/src/ui/c-key-value-list/c-key-value-list.vue
+++ b/src/ui/c-key-value-list/c-key-value-list.vue
@@ -9,29 +9,13 @@ const formattedItems = computed(() => items.value.filter(item => !_.isNil(item.v
 </script>
 
 <template>
-  <table border-collapse table-fixed>
-    <tr v-for="item in formattedItems" :key="item.label">
-      <td py-1 pr-2 text-right font-bold>
+  <div my-5>
+    <div v-for="item in formattedItems" :key="item.label" flex gap-2 py-1 class="c-key-value-list__item">
+      <div flex-basis-180px text-right font-bold class="c-key-value-list__key">
         {{ item.label }}
-      </td>
+      </div>
 
-      <td v-if="_.isArray(item.value)">
-        <div v-for="value in item.value" :key="value">
-          <c-text-copyable :value="value" :show-icon="item.showCopyButton ?? true" />
-        </div>
-      </td>
-      <td v-else-if="_.isBoolean(item.value)">
-        <c-text-copyable :value="item.value ? 'true' : 'false'" :displayed-value="item.value ? 'Yes' : 'No'" :show-icon="item.showCopyButton ?? true" />
-      </td>
-      <td v-else-if="_.isNumber(item.value)" font-mono>
-        <c-text-copyable :value="String(item.value)" :show-icon="item.showCopyButton ?? true" />
-      </td>
-      <td v-else-if="_.isNil(item.value) || item.value === ''" op-70>
-        {{ item.placeholder ?? 'N/A' }}
-      </td>
-      <td v-else>
-        <c-text-copyable :value="item.value" :show-icon="item.showCopyButton ?? true" />
-      </td>
-    </tr>
-  </table>
+      <c-key-value-list-item :item="item" class="c-key-value-list__value" />
+    </div>
+  </div>
 </template>
-- 
cgit v1.2.3

