CoastalCommitsPastes/client/components/shift-by.tsx

21 lines
436 B
TypeScript
Raw Normal View History

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