2022-03-06 19:46:59 -05:00
|
|
|
// https://www.joshwcomeau.com/snippets/react-components/shift-by/
|
|
|
|
type Props = {
|
2022-04-09 20:48:19 -04:00
|
|
|
x?: number
|
|
|
|
y?: number
|
|
|
|
children: React.ReactNode
|
2022-03-06 19:46:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function ShiftBy({ x = 0, y = 0, children }: Props) {
|
2022-04-09 20:48:19 -04:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
transform: `translate(${x}px, ${y}px)`,
|
|
|
|
display: "inline-block"
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
)
|
2022-03-06 19:46:59 -05:00
|
|
|
}
|
|
|
|
export default ShiftBy
|