Skip to content

Commit

Permalink
app: Hide the color picker popover arrow when it's below
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Dec 30, 2020
1 parent 5cc18fb commit 75e393e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/overlay/overlays/nowPlaying/ColorConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Color = ({color, defaultColor, name, trimPrefix, onChange}: ColorProps) =>
const containerRef = React.useRef<HTMLDivElement>(null);
const [indicatorEl, setIndicatorEl] = React.useState<HTMLDivElement | null>(null);
const [pickerEl, setPickerEl] = React.useState<HTMLDivElement | null>(null);
const {styles} = usePopper(indicatorEl, pickerEl, {
const {styles, state} = usePopper(indicatorEl, pickerEl, {
placement: 'top',
modifiers: [{name: 'arrow'}, {name: 'offset', options: {offset: [0, 15]}}],
});
Expand Down Expand Up @@ -83,7 +83,11 @@ const Color = ({color, defaultColor, name, trimPrefix, onChange}: ColorProps) =>
color={color}
onChange={newColor => onChange(rgba(newColor))}
/>
<Arrow data-popper-arrow style={styles.arrow} />
<Arrow
data-placement={state?.placement}
data-popper-arrow
style={styles.arrow}
/>
</motion.div>
</Picker>
)}
Expand Down Expand Up @@ -112,7 +116,10 @@ const Arrow = styled('div')`
height: 0;
width: 0;
border: 10px solid transparent;
border-top-color: #fff;
&[data-placement='top'] {
border-top-color: #fff;
}
`;

const ColorPill = styled('div')`
Expand Down

0 comments on commit 75e393e

Please sign in to comment.