api-client/components/graphql/type.vue

43 lines
1 KiB
Vue
Raw Normal View History

2019-11-18 20:17:07 +00:00
<template>
2020-09-22 17:06:37 +00:00
<div class="p-2 m-2">
2020-10-04 09:46:16 +00:00
<div class="font-bold type-title" :class="{ 'type-highlighted': isHighlighted }">
{{ gqlType.name }}
</div>
2020-09-22 17:06:37 +00:00
<div class="mt-2 text-fgLightColor type-desc" v-if="gqlType.description">
{{ gqlType.description }}
2019-11-18 20:17:07 +00:00
</div>
<div v-if="gqlType.getFields">
<h5>{{ $t("fields") }}</h5>
2019-11-18 20:17:07 +00:00
<div v-for="field in gqlType.getFields()" :key="field.name">
2020-10-04 09:46:16 +00:00
<field
:gqlField="field"
:isHighlighted="isFieldHighlighted({ field })"
:jumpTypeCallback="jumpTypeCallback"
/>
2019-11-18 20:17:07 +00:00
</div>
</div>
</div>
</template>
2020-10-04 09:46:16 +00:00
<style scoped lang="scss">
.type-highlighted {
2020-10-04 10:31:19 +00:00
@apply text-acColor;
2020-10-04 09:46:16 +00:00
}
</style>
2019-11-18 20:17:07 +00:00
<script>
export default {
props: {
gqlType: {},
2020-02-24 18:44:50 +00:00
jumpTypeCallback: Function,
2020-10-04 09:46:16 +00:00
isHighlighted: { type: Boolean, default: false },
highlightedFields: { type: Array, default: () => [] },
2020-10-04 09:46:16 +00:00
},
methods: {
isFieldHighlighted({ field }) {
2020-10-21 06:50:32 +00:00
return !!this.highlightedFields.find(({ name }) => name === field.name)
2020-10-04 09:46:16 +00:00
},
2020-02-24 18:44:50 +00:00
},
}
2019-11-18 20:17:07 +00:00
</script>