refactor(ui): better select popovers

This commit is contained in:
liyasthomas
2021-08-04 11:20:23 +05:30
parent b03565a816
commit a4caeac584
10 changed files with 45 additions and 49 deletions

View File

@@ -46,8 +46,8 @@ body {
@apply select-none; @apply select-none;
@apply overflow-x-hidden; @apply overflow-x-hidden;
font-size: var(--font-size); font-size: var(--body-font-size);
line-height: var(--line-height); line-height: var(--body-line-height);
overflow: overlay; overflow: overlay;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none; -webkit-touch-callout: none;
@@ -189,8 +189,8 @@ input,
select, select,
textarea, textarea,
button { button {
font-size: var(--font-size); font-size: var(--body-font-size);
line-height: var(--line-height); line-height: var(--body-line-height);
} }
.input[type="file"], .input[type="file"],
@@ -259,16 +259,17 @@ input[type="checkbox"] {
@apply cursor-pointer; @apply cursor-pointer;
&::before { &::before {
@apply border border-secondary; @apply border-2 border-divider;
@apply rounded; @apply rounded;
@apply inline-flex; @apply inline-flex;
@apply items-center; @apply items-center;
@apply justify-center; @apply justify-center;
@apply text-transparent; @apply text-transparent;
@apply h-4;
@apply w-4;
@apply font-icon;
content: "\2714"; content: "\e876";
height: 16px;
width: 16px;
margin: 8px 8px 8px 0; margin: 8px 8px 8px 0;
} }
} }

View File

@@ -300,9 +300,9 @@
@mixin fontSmall { @mixin fontSmall {
// Font size // Font size
--font-size: 0.75rem; --body-font-size: 0.75rem;
// Line height // Line height
--line-height: 1rem; --body-line-height: 1rem;
// Upper primary sticky fold // Upper primary sticky fold
--upper-primary-sticky-fold: 4.125rem; --upper-primary-sticky-fold: 4.125rem;
// Upper secondary sticky fold // Upper secondary sticky fold
@@ -321,9 +321,9 @@
@mixin fontMedium { @mixin fontMedium {
// Font size // Font size
--font-size: 0.875rem; --body-font-size: 0.875rem;
// Line height // Line height
--line-height: 1.25rem; --body-line-height: 1.25rem;
// Upper primary sticky fold // Upper primary sticky fold
--upper-primary-sticky-fold: 4.375rem; --upper-primary-sticky-fold: 4.375rem;
// Upper secondary sticky fold // Upper secondary sticky fold
@@ -342,9 +342,9 @@
@mixin fontLarge { @mixin fontLarge {
// Font size // Font size
--font-size: 1rem; --body-font-size: 1rem;
// Line height // Line height
--line-height: 1.5rem; --body-line-height: 1.5rem;
// Upper primary sticky fold // Upper primary sticky fold
--upper-primary-sticky-fold: 4.625rem; --upper-primary-sticky-fold: 4.625rem;
// Upper secondary sticky fold // Upper secondary sticky fold

View File

@@ -1,7 +1,7 @@
<template> <template>
<header class="flex flex-1 py-2 px-4 items-center justify-between"> <header class="flex flex-1 py-2 px-4 items-center justify-between">
<div <div
class="font-bold space-x-2 flex-shrink-0 text-sm inline-flex items-center" class="font-bold space-x-4 flex-shrink-0 text-sm inline-flex items-center"
> >
<AppLogo /> <AppLogo />
<span>Hoppscotch</span> <span>Hoppscotch</span>

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<div class="flex flex-1 py-2 items-center justify-between"> <div class="flex flex-1 p-2 items-center justify-between">
<tippy <tippy
ref="contentTypeOptions" ref="contentTypeOptions"
interactive interactive
@@ -12,23 +12,7 @@
<template #trigger> <template #trigger>
<div class="flex"> <div class="flex">
<span class="select-wrapper"> <span class="select-wrapper">
<input <ButtonSecondary class="pr-8" :label="contentType" outline />
id="contentType"
v-model="contentType"
class="
bg-primary
rounded
flex
font-semibold font-mono
w-full
py-2
px-4
transition
truncate
focus:outline-none
"
readonly
/>
</span> </span>
</div> </div>
</template> </template>
@@ -36,13 +20,14 @@
v-for="(contentTypeItem, index) in validContentTypes" v-for="(contentTypeItem, index) in validContentTypes"
:key="`contentTypeItem-${index}`" :key="`contentTypeItem-${index}`"
:label="contentTypeItem" :label="contentTypeItem"
:info-icon="contentTypeItem === contentType ? 'done' : ''"
@click.native=" @click.native="
contentType = contentTypeItem contentType = contentTypeItem
$refs.contentTypeOptions.tippy().hide() $refs.contentTypeOptions.tippy().hide()
" "
/> />
</tippy> </tippy>
<SmartToggle :on="rawInput" class="px-4" @change="rawInput = !rawInput"> <SmartToggle :on="rawInput" class="px-2" @change="rawInput = !rawInput">
{{ $t("raw_input") }} {{ $t("raw_input") }}
</SmartToggle> </SmartToggle>
</div> </div>

View File

@@ -1,13 +1,13 @@
<template> <template>
<SmartModal v-if="show" @close="hideModal"> <SmartModal v-if="show" @close="hideModal">
<template #header> <template #header>
<h3 class="heading">{{ $t("generate_code") }}</h3> <h3 class="heading">{{ $t("request.generate_code") }}</h3>
<ButtonSecondary icon="close" @click.native="hideModal" /> <ButtonSecondary icon="close" @click.native="hideModal" />
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="requestType" class="font-semibold px-4 pb-4"> <label for="requestType" class="font-semibold px-4 pb-4">
{{ $t("choose_language") }} {{ $t("request.choose_language") }}
</label> </label>
<div class="flex flex-1"> <div class="flex flex-1">
<span class="select-wrapper"> <span class="select-wrapper">
@@ -41,6 +41,7 @@
v-for="(gen, index) in codegens" v-for="(gen, index) in codegens"
:key="`gen-${index}`" :key="`gen-${index}`"
:label="gen.name" :label="gen.name"
:info-icon="gen.id === codegenType ? 'done' : ''"
@click.native=" @click.native="
codegenType = gen.id codegenType = gen.id
$refs.options.tippy().hide() $refs.options.tippy().hide()
@@ -51,7 +52,7 @@
</div> </div>
<div class="flex flex-1 justify-between"> <div class="flex flex-1 justify-between">
<label for="generatedCode" class="font-semibold px-4 pt-4 pb-4"> <label for="generatedCode" class="font-semibold px-4 pt-4 pb-4">
{{ $t("generated_code") }} {{ $t("request.generated_code") }}
</label> </label>
</div> </div>
<SmartAceEditor <SmartAceEditor

View File

@@ -15,6 +15,7 @@
:title="$t('settings.choose_language')" :title="$t('settings.choose_language')"
class="pr-8" class="pr-8"
outline outline
icon="language"
:label="`${ :label="`${
$i18n.locales.find(({ code }) => code == $i18n.locale).name $i18n.locales.find(({ code }) => code == $i18n.locale).name
}`" }`"

View File

@@ -14,6 +14,7 @@
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="$t('settings.change_font_size')" :title="$t('settings.change_font_size')"
class="pr-8" class="pr-8"
icon="format_size"
outline outline
:label="`${fontSizes.find(({ code }) => code == active.code).name}`" :label="`${fontSizes.find(({ code }) => code == active.code).name}`"
/> />
@@ -22,6 +23,7 @@
v-for="(size, index) in fontSizes" v-for="(size, index) in fontSizes"
:key="`size-${index}`" :key="`size-${index}`"
:label="size.name" :label="size.name"
:info-icon="size.code === active.code ? 'done' : ''"
@click.native=" @click.native="
setActiveFont(size) setActiveFont(size)
$refs.fontSize.tippy().hide() $refs.fontSize.tippy().hide()

View File

@@ -39,7 +39,10 @@
/> />
</span> </span>
<SmartSpinner v-else class="mr-4" /> <SmartSpinner v-else class="mr-4" />
<div class="inline-flex items-start" :class="{ 'flex-col': description }"> <div
class="flex-1 inline-flex items-start"
:class="{ 'flex-col': description }"
>
<div class="font-semibold"> <div class="font-semibold">
{{ label }} {{ label }}
</div> </div>
@@ -47,7 +50,7 @@
{{ description }} {{ description }}
</p> </p>
</div> </div>
<i v-if="infoIcon" class="text-accent ml-4 material-icons"> <i v-if="infoIcon" class="text-accent ml-6 self-end material-icons">
{{ infoIcon }} {{ infoIcon }}
</i> </i>
</SmartLink> </SmartLink>

View File

@@ -19,7 +19,7 @@
:key="`member-${index}`" :key="`member-${index}`"
:src="member.user.photoURL" :src="member.user.photoURL"
:alt="member.user.displayName" :alt="member.user.displayName"
class="rounded-full h-4 ring-primary ring-2 w-4 inline-block" class="rounded-full h-5 ring-primary ring-2 w-5 inline-block"
/> />
</div> </div>
</div> </div>
@@ -55,7 +55,7 @@
color="red" color="red"
:label="$t('delete')" :label="$t('delete')"
@click.native=" @click.native="
deleteTeam deleteTeam()
$refs.options.tippy().hide() $refs.options.tippy().hide()
" "
/> />
@@ -70,7 +70,7 @@
icon="remove" icon="remove"
:label="$t('team.exit')" :label="$t('team.exit')"
@click.native=" @click.native="
exitTeam exitTeam()
$refs.options.tippy().hide() $refs.options.tippy().hide()
" "
/> />
@@ -89,13 +89,13 @@ export default {
}, },
methods: { methods: {
deleteTeam() { deleteTeam() {
if (!confirm("Are you sure you want to remove this team?")) return if (!confirm(this.$t("confirm.remove_team"))) return
// Call to the graphql mutation // Call to the graphql mutation
teamUtils teamUtils
.deleteTeam(this.$apollo, this.teamID) .deleteTeam(this.$apollo, this.teamID)
.then(() => { .then(() => {
// Result // Result
this.$toast.success(this.$t("team.new_created"), { this.$toast.success(this.$t("team.deleted"), {
icon: "done", icon: "done",
}) })
}) })

View File

@@ -22,7 +22,8 @@
"remove_folder": "Are you sure you want to permanently delete this folder?", "remove_folder": "Are you sure you want to permanently delete this folder?",
"remove_request": "Are you sure you want to permanently delete this request?", "remove_request": "Are you sure you want to permanently delete this request?",
"remove_environment": "Are you sure you want to permanently delete this environment?", "remove_environment": "Are you sure you want to permanently delete this environment?",
"remove_telemetry": "Are you sure you want to opt-out of Telemetry?" "remove_telemetry": "Are you sure you want to opt-out of Telemetry?",
"remove_team": "Are you sure you want to delete this team?"
}, },
"empty": { "empty": {
"protocols": "Protocols are empty", "protocols": "Protocols are empty",
@@ -53,7 +54,7 @@
"star": "Remove star" "star": "Remove star"
}, },
"show": { "show": {
"code": "Show Code", "code": "Show code",
"more": "Show more", "more": "Show more",
"sidebar": "Show sidebar" "sidebar": "Show sidebar"
}, },
@@ -87,6 +88,7 @@
"new": "New Team", "new": "New Team",
"new_name": "My New Team", "new_name": "My New Team",
"edit": "Edit Team", "edit": "Edit Team",
"deleted": "Team deleted",
"members": "Members", "members": "Members",
"permissions": "Permissions", "permissions": "Permissions",
"invalid_member_permission": "Please provide a valid permission to the team member", "invalid_member_permission": "Please provide a valid permission to the team member",
@@ -146,6 +148,9 @@
"save": "Save", "save": "Save",
"save_as": "Save as", "save_as": "Save as",
"name": "Request name", "name": "Request name",
"choose_language": "Choose language",
"generate_code": "Generate code",
"generated_code": "Generated code",
"share": "Share" "share": "Share"
}, },
"settings": { "settings": {
@@ -198,9 +203,7 @@
"edit_environment": "Edit Environment", "edit_environment": "Edit Environment",
"env_variable_list": "Variable List", "env_variable_list": "Variable List",
"invalid_environment_name": "Please provide a valid name for the environment", "invalid_environment_name": "Please provide a valid name for the environment",
"generate_code": "Generate code",
"request_type": "Request type", "request_type": "Request type",
"generated_code": "Generated code",
"status": "Status", "status": "Status",
"headers": "Headers", "headers": "Headers",
"waiting_for_connection": "waiting for connection", "waiting_for_connection": "waiting for connection",
@@ -260,7 +263,7 @@
"search": "Search", "search": "Search",
"history_deleted": "History deleted", "history_deleted": "History deleted",
"clear": "Clear", "clear": "Clear",
"clear_all": "Clear All", "clear_all": "Clear all",
"cleared": "Cleared", "cleared": "Cleared",
"time": "Time", "time": "Time",
"duration": "Duration", "duration": "Duration",