create-next-app-template
Version:
This is a template set up to create Next.js App with fast speed and high performance<br/> The current template is provided in a **page routing** structure.<br/>
23 lines (19 loc) • 605 B
text/typescript
type TransformType = {
axis?: { x?: string | number; y?: string | number };
scale?: number;
rotate?: string | number;
};
const transformStylesProps = (props?: TransformType) => {
const { axis, scale, rotate } = props ?? {};
if (!props) return {};
return {
transform: axis
? `translate(${typeof axis.x === 'number' ? `${axis.x}px` : (axis.x ?? '0')}, ${
typeof axis.y === 'number' ? `${axis.y}px` : (axis.y ?? '0')
})`
: undefined,
scale: scale,
rotate: typeof rotate === 'number' ? rotate + 'deg' : rotate,
};
};
export { transformStylesProps };