wheelshare-frontend/src/components/UI/UIPressable.tsx
Michael Fatemi 98a8e51b7b Organize
2021-07-08 13:51:24 -04:00

29 lines
503 B
TypeScript

import { CSSProperties, ReactNode, useMemo } from 'react';
const baseStyle: CSSProperties = {
textDecoration: 'none',
cursor: 'pointer',
userSelect: 'none',
};
export default function UIPressable({
onClick,
style,
children,
}: {
onClick: () => void;
style?: CSSProperties;
children: ReactNode;
}) {
const computedStyle = useMemo(
() => (!style ? baseStyle : { ...baseStyle, ...style }),
[style]
);
return (
<div onClick={onClick} style={computedStyle}>
{children}
</div>
);
}