import * as styles from './layerStyles' ; import { styleReducer , getSVG } from '../utils' ; const groupStyles = ( layer , svgs ) => { const baseStyles = styles . createBaseLayerStyles ( layer ) ; const isMask = layer . name === 'next.mask' ; const maskLayer = layer . layers [ 0 ] ; const isMaskShapePath = maskLayer . type === 'ShapePath' ; const isMaskShape = maskLayer . type === 'Shape' ; const maskNotRectangle = isMaskShapePath && ( < next . ShapePath > maskLayer ) . shapeType !== 'Rectangle' ; const maskNotOval = isMaskShapePath && ( < next . ShapePath > maskLayer ) . shapeType !== 'Oval' ; const isMaskOddShape = maskNotRectangle && maskNotOval || isMaskShape ; const oddShapeMaskSvg = isMaskOddShape ? getSVG ( svgs , maskLayer . id ) : null ; const borderRadius = isMask && isMaskShapePath ? styles . createBorderRadius ( ( maskLayer as next . ShapePath ) . shapeType , ( maskLayer as next . ShapePath ) . points ) : null ; const overflow = isMask ? styles . createOverflow ( 'hidden' ) : null ; const mask = isMask && isMaskOddShape && oddShapeMaskSvg ? styles . createMask ( oddShapeMaskSvg . src ) : null ; const combined = [ baseStyles , borderRadius , overflow , mask ] ; return styleReducer ( combined ) ; } ; export default groupStyles ;