feat: floating input label

This commit is contained in:
liyasthomas
2021-08-07 14:51:13 +05:30
parent 92abbc4ce6
commit 3d963a7719
24 changed files with 132 additions and 128 deletions

View File

@@ -198,6 +198,29 @@ button {
@apply hidden; @apply hidden;
} }
.floating-input ~ label {
@apply font-semibold;
@apply py-0.5;
@apply px-2;
@apply m-2;
@apply rounded;
@apply transition;
@apply absolute;
}
.floating-input:focus-within ~ label,
.floating-input:not(:placeholder-shown) ~ label {
@apply bg-primary;
@apply transform;
@apply origin-center;
@apply scale-75;
@apply -translate-y-6;
}
.floating-input:focus-within ~ label {
@apply text-accent;
}
pre.ace_editor { pre.ace_editor {
@apply font-mono; @apply font-mono;
@apply resize-none; @apply resize-none;

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelAdd" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelAdd" id="selectLabelAdd"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="$t('collection.name')"
@keyup.enter="addNewCollection" @keyup.enter="addNewCollection"
/> />
<label for="selectLabelAdd">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelAddFolder" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelAddFolder" id="selectLabelAddFolder"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="$t('folder.new')"
@keyup.enter="addFolder" @keyup.enter="addFolder"
/> />
<label for="selectLabelAddFolder">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelEdit" class="font-semibold px-4 pb-4">{{
$t("label")
}}</label>
<input <input
id="selectLabelEdit" id="selectLabelEdit"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="placeholderCollName"
@keyup.enter="saveCollection" @keyup.enter="saveCollection"
/> />
<label for="selectLabelEdit">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,16 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelEditFolder" class="font-semibold px-4 pb-4">{{
$t("label")
}}</label>
<input <input
id="selectLabelEditFolder" id="selectLabelEditFolder"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
@keyup.enter="editFolder" @keyup.enter="editFolder"
/> />
<label for="selectLabelEditFolder">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelEditReq" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelEditReq" id="selectLabelEditReq"
v-model="requestUpdateData.name" v-model="requestUpdateData.name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="placeholderReqName"
@keyup.enter="saveRequest" @keyup.enter="saveRequest"
/> />
<label for="selectLabelEditReq">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,15 +6,18 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelSaveReq" class="font-semibold px-4 pb-4"> <div class="flex relative">
{{ $t("request.name") }} <input
</label> id="selectLabelSaveReq"
<input v-model="requestName"
id="selectLabelSaveReq" class="input floating-input"
v-model="requestName" placeholder=" "
class="input" type="text"
type="text" />
/> <label for="selectLabelSaveReq">
{{ $t("request.name") }}
</label>
</div>
<label class="font-semibold px-4 pt-4 pb-4"> <label class="font-semibold px-4 pt-4 pb-4">
{{ $t("collection.select_location") }} {{ $t("collection.select_location") }}
</label> </label>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelGqlAdd" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelGqlAdd" id="selectLabelGqlAdd"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="$t('collection.name')"
@keyup.enter="addNewCollection" @keyup.enter="addNewCollection"
/> />
<label for="selectLabelGqlAdd">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelGqlAddFolder" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelGqlAddFolder" id="selectLabelGqlAddFolder"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="$t('folder.new')"
@keyup.enter="addFolder" @keyup.enter="addFolder"
/> />
<label for="selectLabelGqlAddFolder">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelGqlEdit" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelGqlEdit" id="selectLabelGqlEdit"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="editingCollection.name"
@keyup.enter="saveCollection" @keyup.enter="saveCollection"
/> />
<label for="selectLabelGqlEdit">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,16 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelGqlEditFolder" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelGqlEditFolder" id="selectLabelGqlEditFolder"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="folder.name"
@keyup.enter="editFolder"
/> />
<label for="selectLabelGqlEditFolder">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelGqlEditReq" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelGqlEditReq" id="selectLabelGqlEditReq"
v-model="requestUpdateData.name" v-model="requestUpdateData.name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="request.name"
@keyup.enter="saveRequest" @keyup.enter="saveRequest"
/> />
<label for="selectLabelGqlEditReq">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -59,7 +59,6 @@
ref="inputChooseFileToReplaceWith" ref="inputChooseFileToReplaceWith"
class="input" class="input"
type="file" type="file"
style="display: none"
accept="application/json" accept="application/json"
@change="replaceWithJSON" @change="replaceWithJSON"
/> />
@@ -74,7 +73,6 @@
ref="inputChooseFileToImportFrom" ref="inputChooseFileToImportFrom"
class="input" class="input"
type="file" type="file"
style="display: none"
accept="application/json" accept="application/json"
@change="importFromJSON" @change="importFromJSON"
/> />

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelEnvAdd" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelEnvAdd" id="selectLabelEnvAdd"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="$t('my_new_environment')"
@keyup.enter="addNewEnvironment" @keyup.enter="addNewEnvironment"
/> />
<label for="selectLabelEnvAdd">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelEnvEdit" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelEnvEdit" id="selectLabelEnvEdit"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="editingEnvironment.name"
@keyup.enter="saveEnvironment" @keyup.enter="saveEnvironment"
/> />
<label for="selectLabelEnvEdit">
{{ $t("label") }}
</label>
<div class="flex flex-1 justify-between items-center"> <div class="flex flex-1 justify-between items-center">
<label for="variableList" class="font-semibold px-4 pt-4 pb-4"> <label for="variableList" class="font-semibold px-4 pt-4 pb-4">
{{ $t("env_variable_list") }} {{ $t("env_variable_list") }}

View File

@@ -61,7 +61,6 @@
ref="inputChooseFileToReplaceWith" ref="inputChooseFileToReplaceWith"
class="input" class="input"
type="file" type="file"
style="display: none"
accept="application/json" accept="application/json"
@change="replaceWithJSON" @change="replaceWithJSON"
/> />
@@ -76,7 +75,6 @@
ref="inputChooseFileToImportFrom" ref="inputChooseFileToImportFrom"
class="input" class="input"
type="file" type="file"
style="display: none"
accept="application/json" accept="application/json"
@change="importFromJSON" @change="importFromJSON"
/> />

View File

@@ -25,23 +25,23 @@
/> />
</div> </div>
<div v-if="mode === 'email'" class="flex flex-col space-y-2"> <div v-if="mode === 'email'" class="flex flex-col space-y-2">
<div class="flex relative items-center"> <div class="flex items-center relative">
<label for="email" class="flex px-4 absolute items-center">
<i class="opacity-75 material-icons">mail</i>
</label>
<input <input
id="email" id="email"
v-model="form.email" v-model="form.email"
class="input !pl-12" class="input floating-input"
placeholder=" "
type="email" type="email"
name="email" name="email"
:placeholder="$t('email')"
autocomplete="email" autocomplete="email"
required required
spellcheck="false" spellcheck="false"
autofocus autofocus
@keyup.enter="signInWithEmail" @keyup.enter="signInWithEmail"
/> />
<label for="email">
{{ $t("auth.email") }}
</label>
</div> </div>
<ButtonPrimary <ButtonPrimary
:loading="signingInWithEmail" :loading="signingInWithEmail"

View File

@@ -50,7 +50,7 @@
<div class="flex pl-2 items-center justify-between"> <div class="flex pl-2 items-center justify-between">
<slot name="header"></slot> <slot name="header"></slot>
</div> </div>
<div class="flex flex-col my-4 overflow-auto"> <div class="flex flex-col my-4">
<slot name="body"></slot> <slot name="body"></slot>
</div> </div>
<div <div

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelTeamAdd" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelTeamAdd" id="selectLabelTeamAdd"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="$t('team.new_name')"
@keyup.enter="addNewTeam" @keyup.enter="addNewTeam"
/> />
<label for="selectLabelTeamAdd">
{{ $t("label") }}
</label>
</div> </div>
</template> </template>
<template #footer> <template #footer>

View File

@@ -6,17 +6,17 @@
</template> </template>
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<label for="selectLabelTeamEdit" class="font-semibold px-4 pb-4">
{{ $t("label") }}
</label>
<input <input
id="selectLabelTeamEdit" id="selectLabelTeamEdit"
v-model="name" v-model="name"
class="input" class="input floating-input"
placeholder=" "
type="text" type="text"
:placeholder="editingTeam.name"
@keyup.enter="saveTeam" @keyup.enter="saveTeam"
/> />
<label for="selectLabelTeamEdit">
{{ $t("label") }}
</label>
<div class="flex flex-1 justify-between items-center"> <div class="flex flex-1 justify-between items-center">
<label for="memberList" class="font-semibold px-4 pt-4 pb-4"> <label for="memberList" class="font-semibold px-4 pt-4 pb-4">
{{ $t("team.members") }} {{ $t("team.members") }}

View File

@@ -154,9 +154,12 @@ const tokenRequest = async ({
}) => { }) => {
// Check oauth configuration // Check oauth configuration
if (oidcDiscoveryUrl !== "") { if (oidcDiscoveryUrl !== "") {
// eslint-disable-next-line camelcase
const { authorization_endpoint, token_endpoint } = const { authorization_endpoint, token_endpoint } =
await getTokenConfiguration(oidcDiscoveryUrl) await getTokenConfiguration(oidcDiscoveryUrl)
// eslint-disable-next-line camelcase
authUrl = authorization_endpoint authUrl = authorization_endpoint
// eslint-disable-next-line camelcase
accessTokenUrl = token_endpoint accessTokenUrl = token_endpoint
} }

View File

@@ -135,6 +135,7 @@
"gist_created": "Gist created" "gist_created": "Gist created"
}, },
"auth": { "auth": {
"email": "Email",
"account_exists": "Account exists with different credential - Login to link both accounts", "account_exists": "Account exists with different credential - Login to link both accounts",
"send_magic_link": "Send a magic link", "send_magic_link": "Send a magic link",
"we_sent_magic_link": "We sent you a magic link!", "we_sent_magic_link": "We sent you a magic link!",

View File

@@ -83,7 +83,7 @@ export const defaultSettings: SettingsType = {
httpPassword: true, httpPassword: true,
bearerToken: true, bearerToken: true,
}, },
THEME_COLOR: "green", THEME_COLOR: "blue",
BG_COLOR: "system", BG_COLOR: "system",
TELEMETRY_ENABLED: true, TELEMETRY_ENABLED: true,
SHORTCUT_INDICATOR: false, SHORTCUT_INDICATOR: false,

View File

@@ -282,46 +282,24 @@
>. >.
</div> </div>
<div class="space-y-4 mt-4"> <div class="space-y-4 mt-4">
<div class="flex items-center"> <div class="flex space-x-2 items-center">
<SmartToggle <SmartToggle
:on="PROXY_ENABLED" :on="PROXY_ENABLED"
@change="toggleSetting('PROXY_ENABLED')" @change="toggleSetting('PROXY_ENABLED')"
/> />
<label <div class="flex flex-1 items-center relative">
for="url" <input
class=" id="url"
bg-primaryLight v-model="PROXY_URL"
border border-divider class="input floating-input"
rounded-l placeholder=" "
ml-2 type="url"
py-2 :disabled="!PROXY_ENABLED"
px-4 />
truncate <label for="url">
" {{ `${$t("proxy")} ${$t("url")}` }}
> </label>
{{ `${$t("proxy")} ${$t("url")}` }} </div>
</label>
<input
id="url"
v-model="PROXY_URL"
class="
bg-primaryLight
border border-divider
rounded-r
flex
font-semibold font-mono
flex-1
mr-2
py-2
px-4
block
focus:(border-accent
outline-none)
"
type="url"
:disabled="!PROXY_ENABLED"
:placeholder="$t('url')"
/>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="$t('reset_default')" :title="$t('reset_default')"
@@ -406,7 +384,7 @@ export default defineComponent({
showLogin: false, showLogin: false,
active: getLocalConfig("THEME_COLOR") || "green", active: getLocalConfig("THEME_COLOR") || "blue",
confirmRemove: false, confirmRemove: false,
} }
}, },