mirror of
https://github.com/myfatemi04/wheelshare-frontend.git
synced 2025-04-21 19:29:51 -04:00
29 lines
503 B
TypeScript
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>
|
|
);
|
|
}
|