Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let verticalPosition: VerticalPosition | undefined;
switch (position) {
case "left":
horizontalPosition = "inner left";
break;
case "right":
horizontalPosition = "inner right";
break;
case "top":
verticalPosition = "above";
break;
case "bottom":
verticalPosition = "below";
break;
}
const styleProps = useRelativePositioningStyle({
fixedTo: ref.current,
horizontalPosition,
verticalPosition,
});
const show = (position: SheetPosition, first: boolean = true) => (
event:
| React.KeyboardEvent
| React.MouseEvent
) => {
ref.current = event.currentTarget;
setPosition(position);
setVisible(true);
setFocusfirst(first);
};