Skip to content
Snippets Groups Projects
Commit 64f415ac authored by insert's avatar insert
Browse files

Fix: Overlay moving with page.

Fix: Colour picker appearing in wrong position.
parent 123020d7
Branches
No related merge requests found
...@@ -38,11 +38,24 @@ const SwatchesBase = styled.div` ...@@ -38,11 +38,24 @@ const SwatchesBase = styled.div`
display: flex; display: flex;
input { input {
width: 0;
height: 0;
top: 72px;
opacity: 0; opacity: 0;
margin-top: 44px; position: relative;
position: absolute;
pointer-events: none; pointer-events: none;
} }
.overlay {
position: relative;
width: 0;
div {
width: 8px;
height: 68px;
background: linear-gradient(to right, var(--primary-background), transparent);
}
}
`; `;
const Swatch = styled.div<{ type: "small" | "large"; colour: string }>` const Swatch = styled.div<{ type: "small" | "large"; colour: string }>`
...@@ -84,7 +97,6 @@ const Rows = styled.div` ...@@ -84,7 +97,6 @@ const Rows = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: auto; overflow: auto;
> div { > div {
gap: 8px; gap: 8px;
...@@ -92,13 +104,6 @@ const Rows = styled.div` ...@@ -92,13 +104,6 @@ const Rows = styled.div`
flex-direction: row; flex-direction: row;
padding-inline-start: 8px; padding-inline-start: 8px;
} }
.overlay {
position: absolute;
height: 68px;
width: 8px;
background: linear-gradient(to right, var(--primary-background), transparent);
}
`; `;
export default function ColourSwatches({ value, onChange }: Props) { export default function ColourSwatches({ value, onChange }: Props) {
...@@ -106,23 +111,23 @@ export default function ColourSwatches({ value, onChange }: Props) { ...@@ -106,23 +111,23 @@ export default function ColourSwatches({ value, onChange }: Props) {
return ( return (
<SwatchesBase> <SwatchesBase>
<Swatch
colour={value}
type="large"
onClick={() => ref.current?.click()}>
<Palette size={32} />
</Swatch>
<input <input
type="color" type="color"
value={value} value={value}
ref={ref} ref={ref}
onChange={(ev) => onChange(ev.currentTarget.value)} onChange={(ev) => onChange(ev.currentTarget.value)}
/> />
<Swatch
colour={value}
type="large"
onClick={() => ref.current?.click()}>
<Palette size={32} />
</Swatch>
<div class="overlay"><div /></div>
<Rows> <Rows>
{presets.map((row, i) => ( {presets.map((row, i) => (
<>
<div class="overlay" />
<div key={i}> <div key={i}>
{row.map((swatch, i) => ( {row.map((swatch, i) => (
<Swatch <Swatch
...@@ -134,7 +139,6 @@ export default function ColourSwatches({ value, onChange }: Props) { ...@@ -134,7 +139,6 @@ export default function ColourSwatches({ value, onChange }: Props) {
</Swatch> </Swatch>
))} ))}
</div> </div>
</>
))} ))}
</Rows> </Rows>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment