import * as React from 'react' ; import { Pattern } from '../templates/pattern' ; export const withPattern = < T extends any > ( getPatternId , props ) => ( Target ) => ( targetProps ) => { const { color , ... restProps } = targetProps ; const patternId = getPatternId ( restProps ) ; return ( < React . Fragment > < Target color = { `url(#${ patternId })` } { ... restProps } /> < Pattern id = { patternId } color = { color } { ... props } /> < /React.Fragment>); } ;