Skip to content
Snippets Groups Projects
Commit 7e7dc63f authored by Orlin Malkja's avatar Orlin Malkja
Browse files

fix: show nested metadata & improve its styling

parent e1a68657
No related branches found
No related tags found
1 merge request!297Show Nested metadata & improve its styling
...@@ -5,16 +5,15 @@ ...@@ -5,16 +5,15 @@
</q-item-label> </q-item-label>
<MetadataLink v-if="isLink()" :url="item.key" :text="item.value"/> <MetadataLink v-if="isLink()" :url="item.key" :text="item.value"/>
<MetadataValue v-else :value="item.value" /> <MetadataValue v-else :value="item.value" />
<MetadataItem v-for="(childItem, idx) in childItems" :key="idx" :item="childItem"/> <MetadataItem v-for="(childItem, idx) in childItems" :key="idx" :item="childItem" class="nested-metadata"/>
</div> </div>
</template> </template>
<script setup> <script setup>
import { computed } from 'vue';
import MetadataLink from '@/components/metadata/MetadataLink.vue'; import MetadataLink from '@/components/metadata/MetadataLink.vue';
import MetadataValue from '@/components/metadata/MetadataValue.vue'; import MetadataValue from '@/components/metadata/MetadataValue.vue';
import { computed } from 'vue';
const props = defineProps({ const props = defineProps({
item: Object, item: Object,
}); });
...@@ -24,12 +23,18 @@ const childItems = computed(() => props.item?.metadata || []); ...@@ -24,12 +23,18 @@ const childItems = computed(() => props.item?.metadata || []);
function isLink() { function isLink() {
const regex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig; const regex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
const matches = props.item?.key?.match(regex) || null; const matches = (typeof props.item?.key === 'string') ? props.item?.key?.match(regex) : null;
return matches !== null; return matches !== null;
} }
</script> </script>
<style scoped> <style scoped>
.nested-metadata {
margin-left: 8px;
margin-top: 2.5px;
}
</style> </style>
...@@ -43,4 +43,8 @@ const props = defineProps({ ...@@ -43,4 +43,8 @@ const props = defineProps({
display: flex; display: flex;
padding-right: 4px; padding-right: 4px;
} }
.metadata-value {
margin-left:10px;
}
</style> </style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment