2020-10-23 18:36:12 +01:00
|
|
|
<script>
|
|
|
|
import Icon from './Icon.svelte';
|
|
|
|
|
2020-10-29 23:44:51 +00:00
|
|
|
export let icon = null;
|
2020-10-23 18:36:12 +01:00
|
|
|
export let placeholder;
|
2020-10-29 23:44:51 +00:00
|
|
|
export let type = 'text';
|
|
|
|
export let min;
|
|
|
|
export let max;
|
2020-10-23 18:36:12 +01:00
|
|
|
|
|
|
|
export let value = '';
|
2020-10-29 23:44:51 +00:00
|
|
|
|
|
|
|
const handleInput = (event) => {
|
|
|
|
if (type === 'number') {
|
|
|
|
value = Number(event.target.value);
|
|
|
|
} else {
|
|
|
|
value = event.target.value;
|
|
|
|
}
|
|
|
|
};
|
2020-10-23 18:36:12 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div
|
2020-10-29 23:44:51 +00:00
|
|
|
class="flex flex-1 relative items-center bg-background rounded-2xl h-14 focus-within:border-primary border-2 border-transparent ease-in duration-100">
|
2020-10-23 18:36:12 +01:00
|
|
|
{#if icon}
|
|
|
|
<Icon path={icon} color="white" className="absolute ml-4 w-6 h-6" />
|
|
|
|
{/if}
|
|
|
|
<input
|
|
|
|
{placeholder}
|
2020-10-29 23:44:51 +00:00
|
|
|
{type}
|
|
|
|
{value}
|
|
|
|
{min}
|
|
|
|
{max}
|
|
|
|
on:change
|
|
|
|
on:input={handleInput}
|
|
|
|
class={`w-full ${icon ? 'pl-12' : 'pl-4'} pr-4 text-white placeholder-gray-500 leading-none bg-transparent border-none focus:outline-none`} />
|
2020-10-23 18:36:12 +01:00
|
|
|
</div>
|