Skip to content

Commit

Permalink
Merge branch 'omalkja/issue/#424/nested-metadata' into 'develop'
Browse files Browse the repository at this point in the history
Show Nested metadata & improve its styling

See merge request subugoe/emo/tido!297
  • Loading branch information
Orlin Malkja committed Apr 22, 2024
2 parents e1a6865 + 7e7dc63 commit fd90750
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/metadata/MetadataItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
</q-item-label>
<MetadataLink v-if="isLink()" :url="item.key" :text="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>
</template>

<script setup>
import { computed } from 'vue';
import MetadataLink from '@/components/metadata/MetadataLink.vue';
import MetadataValue from '@/components/metadata/MetadataValue.vue';
import { computed } from 'vue';
const props = defineProps({
item: Object,
});
Expand All @@ -24,12 +23,18 @@ const childItems = computed(() => props.item?.metadata || []);
function isLink() {
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;
}
</script>
<style scoped>
.nested-metadata {
margin-left: 8px;
margin-top: 2.5px;
}
</style>
4 changes: 4 additions & 0 deletions src/components/metadata/MetadataValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ const props = defineProps({
display: flex;
padding-right: 4px;
}
.metadata-value {
margin-left:10px;
}
</style>

0 comments on commit fd90750

Please sign in to comment.