refactor(ui): minor stylings

This commit is contained in:
liyasthomas
2021-07-13 12:48:57 +05:30
parent a4032836c3
commit 5e740a6ed6
12 changed files with 115 additions and 115 deletions

View File

@@ -1,6 +1,17 @@
<template> <template>
<AppSection label="headers"> <AppSection label="headers">
<div class="flex flex-1 items-center justify-between pl-4"> <div
class="
sticky
top-110px
z-10
bg-primary
flex flex-1
items-center
justify-between
pl-4
"
>
<label for="headerList" class="font-semibold text-xs"> <label for="headerList" class="font-semibold text-xs">
{{ $t("header_list") }} {{ $t("header_list") }}
</label> </label>

View File

@@ -1,6 +1,17 @@
<template> <template>
<AppSection label="parameters"> <AppSection label="parameters">
<div class="flex flex-1 items-center justify-between pl-4"> <div
class="
sticky
top-110px
z-10
bg-primary
flex flex-1
items-center
justify-between
pl-4
"
>
<label for="paramList" class="font-semibold text-xs"> <label for="paramList" class="font-semibold text-xs">
{{ $t("parameter_list") }} {{ $t("parameter_list") }}
</label> </label>

View File

@@ -12,21 +12,23 @@
space-x-8 space-x-8
" "
> >
<i v-if="response.type === 'loading'" class="animate-spin material-icons" <i v-if="response.type === 'loading'" class="animate-spin material-icons">
>refresh</i refresh
> </i>
<span v-else> <div v-else :class="statusCategory.className">
<span class="text-secondaryDark"> Status: </span> <span v-if="response.statusCode">
{{ response.statusCode || $t("waiting_send_req") }} <span class="text-secondaryDark"> Status: </span>
</span> {{ response.statusCode || $t("waiting_send_req") }}
<span class="text-xs"> </span>
<span class="text-secondaryDark"> Time: </span> <span v-if="response.meta.responseDuration" class="text-xs">
{{ `${response.meta.responseDuration} ms` }} <span class="text-secondaryDark"> Time: </span>
</span> {{ `${response.meta.responseDuration} ms` }}
<span class="text-xs"> </span>
<span class="text-secondaryDark"> Size: </span> <span v-if="response.meta.responseSize" class="text-xs">
{{ `${response.meta.responseSize} B` }} <span class="text-secondaryDark"> Size: </span>
</span> {{ `${response.meta.responseSize} B` }}
</span>
</div>
</div> </div>
</template> </template>

View File

@@ -12,7 +12,8 @@
<SmartTab <SmartTab
v-if="Object.keys(response.headers).length !== 0" v-if="Object.keys(response.headers).length !== 0"
id="headers" id="headers"
:label="`Headers \xA0 • \xA0 ${Object.keys(response.headers).length}`" :label="$t('Headers')"
:info="Object.keys(response.headers).length.toString()"
> >
<LensesHeadersRenderer :headers="response.headers" /> <LensesHeadersRenderer :headers="response.headers" />
</SmartTab> </SmartTab>

View File

@@ -1,7 +1,20 @@
<template> <template>
<div> <div>
<div class="flex flex-1 items-center justify-between"> <div
<label for="body">{{ $t("response_body") }}</label> class="
flex flex-1
sticky
top-23
z-10
bg-primary
items-center
justify-between
border-b border-divider
"
>
<label for="body" class="px-4 font-semibold text-xs">
{{ $t("response_body") }}
</label>
<div> <div>
<ButtonSecondary <ButtonSecondary
v-if="response.body" v-if="response.body"

View File

@@ -9,6 +9,7 @@
bg-primary bg-primary
items-center items-center
justify-between justify-between
border-b border-divider
" "
> >
<label for="body" class="px-4 font-semibold text-xs"> <label for="body" class="px-4 font-semibold text-xs">

View File

@@ -9,6 +9,7 @@
bg-primary bg-primary
items-center items-center
justify-between justify-between
border-b border-divider
" "
> >
<label for="body" class="px-4 font-semibold text-xs"> <label for="body" class="px-4 font-semibold text-xs">

View File

@@ -9,6 +9,7 @@
bg-primary bg-primary
items-center items-center
justify-between justify-between
border-b border-divider
" "
> >
<label for="body" class="px-4 font-semibold text-xs"> <label for="body" class="px-4 font-semibold text-xs">

View File

@@ -9,6 +9,7 @@
bg-primary bg-primary
items-center items-center
justify-between justify-between
border-b border-divider
" "
> >
<label for="body" class="px-4 font-semibold text-xs"> <label for="body" class="px-4 font-semibold text-xs">

View File

@@ -1,31 +1,61 @@
<template> <template>
<div class="show-if-initialized" :class="{ initialized }"> <div class="show-if-initialized" :class="{ initialized }">
<div v-if="lang == 'json'" class="outline hide-scrollbar"> <pre ref="editor" :class="styles"></pre>
<div v-for="(p, index) in currPath" :key="index" class="block"> <div
<div class="label" @click="onBlockClick(index)"> v-if="lang == 'json'"
class="
sticky
bottom-0
z-10
flex flex-nowrap flex-1
overflow-auto
font-mono
shadow-lg
px-4
bg-primaryLight
border-t border-divider
hide-scrollbar
"
>
<div
v-for="(p, index) in currPath"
:key="index"
class="
inline-flex
items-center
flex-grow-0 flex-shrink-0
text-secondaryLight
hover:text-secondary
cursor-pointer
font-semibold
text-xs
"
>
<span @click="onBlockClick(index)">
{{ p }} {{ p }}
</div> </span>
<i v-if="index + 1 !== currPath.length" class="material-icons" <i v-if="index + 1 !== currPath.length" class="material-icons mx-2">
>chevron_right</i chevron_right
> </i>
<div <tippy
v-if="sibDropDownIndex == index" v-if="sibDropDownIndex == index"
:ref="`sibling-${index}`" ref="options"
class="siblings" interactive
@mouseleave="clearSibList" tabindex="-1"
trigger="click"
theme="popover"
arrow
> >
<div <SmartItem
v-for="(sib, i) in currSib" v-for="(sib, i) in currSib"
:key="i" :key="i"
class="sib" class="font-mono"
@click="goToSib(sib)" :label="sib.key ? sib.key.value : i"
> @click.native="goToSib(sib)"
{{ sib.key ? sib.key.value : i }} />
</div> </tippy>
</div>
</div> </div>
</div> </div>
<pre ref="editor" :class="styles"></pre>
</div> </div>
</template> </template>
@@ -149,7 +179,6 @@ export default {
this.currPath = path.res this.currPath = path.res
} }
}) })
document.addEventListener("touchstart", this.onTouchStart)
} }
// Disable linting, if lint prop is false // Disable linting, if lint prop is false
@@ -158,7 +187,6 @@ export default {
destroyed() { destroyed() {
this.editor.destroy() this.editor.destroy()
document.removeEventListener("touchstart", this.onTouchStart)
}, },
methods: { methods: {
@@ -195,6 +223,7 @@ export default {
} }
} }
}, 2000), }, 2000),
onBlockClick(index) { onBlockClick(index) {
if (this.sibDropDownIndex === index) { if (this.sibDropDownIndex === index) {
this.clearSibList() this.clearSibList()
@@ -230,23 +259,12 @@ export default {
} }
} }
}), }),
onTouchStart(e) {
if (
this.sibDropDownIndex !== null &&
e.target.parentElement !==
this.$refs[`sibling-${this.sibDropDownIndex}`][0]
) {
this.clearSibList()
}
},
}, },
} }
</script> </script>
<style lang="scss"> <style scoped lang="scss">
.show-if-initialized { .show-if-initialized {
@apply opacity-0;
&.initialized { &.initialized {
@apply opacity-100; @apply opacity-100;
} }
@@ -255,52 +273,4 @@ export default {
@apply transition-none; @apply transition-none;
} }
} }
.outline {
@apply flex flex-nowrap;
@apply flex-1;
@apply overflow-auto;
@apply font-mono;
@apply shadow-lg;
@apply px-4;
.block {
@apply inline-flex;
@apply items-center;
@apply flex-grow-0 flex-shrink-0;
@apply text-secondaryLight text-sm;
&:hover {
@apply text-secondary;
@apply cursor-pointer;
}
.label {
@apply p-2;
}
.siblings {
@apply absolute;
@apply z-50;
@apply top-9;
@apply bg-primary;
@apply max-h-60;
@apply overflow-auto;
@apply shadow-lg;
@apply text-secondaryLight;
@apply overscroll-none;
border-radius: 0 0 8px 8px;
}
.sib {
@apply px-4 py-1;
&:hover {
@apply text-secondary;
@apply bg-primaryLight;
}
}
}
}
</style> </style>

View File

@@ -262,10 +262,8 @@ export default {
} }
</script> </script>
<style lang="scss"> <style scoped lang="scss">
.show-if-initialized { .show-if-initialized {
@apply opacity-0;
&.initialized { &.initialized {
@apply opacity-100; @apply opacity-100;
} }

View File

@@ -16,17 +16,7 @@
<HttpParameters /> <HttpParameters />
</SmartTab> </SmartTab>
<SmartTab <SmartTab :id="'bodyParams'" :label="$t('body')" info="0">
:id="'bodyParams'"
:label="
$t('body') +
`${
bodyParams.length !== 0
? ' \xA0 • \xA0 ' + bodyParams.length
: ''
}`
"
>
<div class="flex flex-1 items-center justify-between py-2"> <div class="flex flex-1 items-center justify-between py-2">
<tippy <tippy
interactive interactive