Add wrapper to color picker and fix helper import

This commit is contained in:
Andrew Kingston 2021-06-23 11:47:07 +01:00
parent 4b9a863c68
commit 997efa62b3
2 changed files with 57 additions and 45 deletions

View File

@ -5,7 +5,7 @@
import { fly } from "svelte/transition"
import Icon from "../Icon/Icon.svelte"
import Input from "../Form/Input.svelte"
import { capitalise } from "helpers"
import { capitalise } from "../utils/helpers"
export let value
@ -108,6 +108,7 @@
}
</script>
<div class="container">
<div
class="preview"
style="background: {color};"
@ -150,13 +151,22 @@
value={customValue}
on:change
/>
<Icon size="S" name="Close" hoverable on:click={() => onChange(null)} />
<Icon
size="S"
name="Close"
hoverable
on:click={() => onChange(null)}
/>
</div>
</div>
</div>
{/if}
</div>
<style>
.container {
position: relative;
}
.preview {
width: 32px;
height: 32px;
@ -169,7 +179,7 @@
box-shadow: 0 0 2px 2px var(--spectrum-global-color-gray-300);
}
.spectrum-Popover {
width: 100%;
width: 210px;
z-index: 999;
top: 100%;
padding: var(--spacing-l) var(--spacing-xl);

View File

@ -4,3 +4,5 @@ export const generateID = () => {
// Starts with a letter so that its a valid DOM ID
return `A${rand}`
}
export const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1)