mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 09:00:57 -05:00
Fix: Overlay moving with page.
Fix: Colour picker appearing in wrong position.
This commit is contained in:
parent
123020d77d
commit
64f415acfc
1 changed files with 23 additions and 19 deletions
|
@ -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 }>`
|
||||||
|
@ -85,20 +98,12 @@ const Rows = styled.div`
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
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) {
|
||||||
|
|
||||||
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) {
|
||||||
</Swatch>
|
</Swatch>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</>
|
|
||||||
))}
|
))}
|
||||||
</Rows>
|
</Rows>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue