mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-24 12:35:31 +00:00
feat: add tooltips
This commit is contained in:
parent
5b347ccec4
commit
62810b0395
8 changed files with 60 additions and 6 deletions
|
|
@ -2,7 +2,9 @@
|
|||
import Email from '../icons/Email.svelte';
|
||||
import TextField from './TextField.svelte';
|
||||
|
||||
let helperText: string = 'Zadejte platný email. Například radko.sablik@ssps.cz';
|
||||
export let placeholder: string = '';
|
||||
|
||||
export let value: string = '';
|
||||
export let error: string = '';
|
||||
</script>
|
||||
|
|
@ -16,6 +18,7 @@
|
|||
on:change
|
||||
type="email"
|
||||
{placeholder}
|
||||
{helperText}
|
||||
icon
|
||||
>
|
||||
<div slot="icon" class="flex items-center justify-center">
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
import Person from '../icons/Person.svelte';
|
||||
import TextField from './TextField.svelte';
|
||||
|
||||
export let helperText: string = '';
|
||||
export let placeholder: string = '';
|
||||
|
||||
export let value: string = '';
|
||||
export let error: string = '';
|
||||
|
||||
|
|
@ -13,7 +15,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<TextField bind:error bind:value on:keydown on:keyup on:change type="text" {placeholder} icon>
|
||||
<TextField bind:error bind:value on:keydown on:keyup on:change type="text" {placeholder} {helperText} icon>
|
||||
<div slot="icon" class="flex items-center justify-center">
|
||||
<Person />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
import { onMount } from 'svelte';
|
||||
import TextField from './TextField.svelte';
|
||||
|
||||
let helperText: string = 'Zadejte jméno a příjmení. Například Radko Sáblík';
|
||||
export let placeholder: string = '';
|
||||
|
||||
export let valueName: string = '';
|
||||
export let valueSurname: string = '';
|
||||
|
||||
let value: string = "";
|
||||
let value: string = '';
|
||||
|
||||
$: {
|
||||
const parsed = value.trim().split(' ');
|
||||
|
|
@ -26,7 +27,17 @@
|
|||
export let error: string = '';
|
||||
</script>
|
||||
|
||||
<TextField bind:error bind:value on:click on:keydown on:keyup on:change type="text" {placeholder} />
|
||||
<TextField
|
||||
bind:error
|
||||
bind:value
|
||||
on:click
|
||||
on:keydown
|
||||
on:keyup
|
||||
on:change
|
||||
type="text"
|
||||
{placeholder}
|
||||
{helperText}
|
||||
/>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
<script lang="ts">
|
||||
import TextField from './TextField.svelte';
|
||||
|
||||
export let helperText: string = '';
|
||||
export let placeholder: string = '';
|
||||
|
||||
export let value: string = '';
|
||||
export let error: string = '';
|
||||
|
||||
|
|
@ -11,4 +13,4 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<TextField bind:error bind:value on:keydown on:keyup on:change type="number" {placeholder} />
|
||||
<TextField bind:error bind:value on:keydown on:keyup on:change type="number" {placeholder} {helperText} />
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
import Lock from '../icons/Lock.svelte';
|
||||
import TextField from './TextField.svelte';
|
||||
|
||||
export let helperText: string = '';
|
||||
export let placeholder: string = '';
|
||||
|
||||
export let value: string = '';
|
||||
export let error: string = '';
|
||||
</script>
|
||||
|
|
@ -14,6 +16,7 @@
|
|||
on:keydown
|
||||
on:keyup
|
||||
{placeholder}
|
||||
{helperText}
|
||||
on:change
|
||||
type="password"
|
||||
icon
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
import Telephone from '../icons/Telephone.svelte';
|
||||
import TextField from './TextField.svelte';
|
||||
|
||||
let helperText: string = 'Zadejte platný telefon s předvolbou. Například +420 123 456 789';
|
||||
export let placeholder: string = '';
|
||||
|
||||
export let value: string = '';
|
||||
export let error: string = '';
|
||||
|
||||
|
|
@ -17,7 +19,17 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<TextField bind:error bind:value on:keydown on:keyup on:change type="tel" {placeholder} icon>
|
||||
<TextField
|
||||
bind:error
|
||||
bind:value
|
||||
on:keydown
|
||||
on:keyup
|
||||
on:change
|
||||
type="tel"
|
||||
{placeholder}
|
||||
{helperText}
|
||||
icon
|
||||
>
|
||||
<div slot="icon" class="flex items-center justify-center">
|
||||
<Telephone />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,14 +3,30 @@
|
|||
const typeAction = (node: HTMLInputElement) => {
|
||||
node.type = type;
|
||||
};
|
||||
|
||||
export let helperText: string = '';
|
||||
export let placeholder: string = '';
|
||||
|
||||
export let value: string = '';
|
||||
|
||||
export let icon: boolean = false;
|
||||
export let error: string = '';
|
||||
|
||||
import { tippy } from 'svelte-tippy';
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
|
||||
const isTooltip = helperText ? tippy : () => {};
|
||||
const tooltipDelay = error != "" ? 0 : 1000;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<div
|
||||
use:isTooltip={{
|
||||
content: helperText,
|
||||
placement: 'top',
|
||||
showOnCreate: false,
|
||||
delay: tooltipDelay
|
||||
}}
|
||||
>
|
||||
<input
|
||||
class:error
|
||||
bind:value
|
||||
|
|
|
|||
|
|
@ -288,6 +288,7 @@
|
|||
bind:value={$form.candidate.address}
|
||||
type="text"
|
||||
placeholder="Adresa trvalého bydliště"
|
||||
helperText="Uveďte ulici, č.p., město, PSČ"
|
||||
/>
|
||||
</span>
|
||||
<span class="mt-8 ml-2 w-full md:ml-0">
|
||||
|
|
@ -297,6 +298,7 @@
|
|||
bind:value={$form.candidate.birthplace}
|
||||
type="text"
|
||||
placeholder="Místo narození"
|
||||
helperText="Uveďte město"
|
||||
icon
|
||||
>
|
||||
<div slot="icon" class="text-sspsBlue flex items-center justify-center">
|
||||
|
|
@ -313,6 +315,8 @@
|
|||
bind:value={$form.candidate.birthdate}
|
||||
type="text"
|
||||
placeholder="Datum narození"
|
||||
|
||||
helperText="TODO: (Uveďte ve formátu DD.MM.RRRR)"
|
||||
/>
|
||||
<div class="ml-2">
|
||||
<SelectField
|
||||
|
|
@ -417,6 +421,7 @@
|
|||
on:change={handleChange}
|
||||
bind:value={$form.candidate.personalIdNumber}
|
||||
placeholder="Rodné číslo"
|
||||
helperText="Rodné číslo musí být ve formátu 123456/7890"
|
||||
/>
|
||||
<span class="ml-2">
|
||||
<SelectField
|
||||
|
|
|
|||
Loading…
Reference in a new issue