You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
578 B

import * as React from 'react';
import { IconProps } from './index';
type TransformInformation = Pick<IconProps, 'rotate' | 'flip'>;
export function getComputedSvgStyle(
{ rotate, flip }: TransformInformation,
svgStyle: React.CSSProperties,
): React.CSSProperties {
if (!(rotate || flip)) {
return { ...svgStyle };
}
return {
transform: `${rotate ? `rotate(${rotate}deg)` : ''} `
+ `${(flip === 'horizontal' || flip === 'both') ? `scaleX(-1)` : ''} `
+ `${(flip === 'vertical' || flip === 'both') ? `scaleY(-1)` : ''}`,
...svgStyle,
};
}