Created
May 11, 2015 15:44
-
-
Save psaia/8287c76140221f247d61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default class Path extends React.Component { | |
constuctor(props) { | |
super(props); | |
this.state = { | |
d: props.d || props.initialD, | |
fill: props.fill || props.initialFill, | |
stroke: props.stroke || props.initialStroke, | |
className: props.className || props.initialClassName, | |
transform: props.transform || props.initialTransform, | |
'stroke-width': props.strokeWidth || props.initialStrokeWidth | |
}; | |
} | |
render() { | |
return <path {...this.state} />; | |
} | |
} | |
Path.defaultProps = { | |
initialD: '', | |
initialFill: '#000000', | |
initialStroke: 'transparent', | |
initialStrokeWidth: 1, | |
initialClassName: 'path', | |
initialTransform: null | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default class SVG extends React.Component { | |
constuctor(props) { | |
super(props); | |
this.state = { | |
width: props.width || props.initialWidth, | |
height: props.height || props.initialHeight | |
}; | |
} | |
render() { | |
return <svg {...this.state}>{this.props.children}</svg>; | |
} | |
} | |
SVG.defaultProps = { | |
initialWidth: 500, | |
initialHeight: 500 | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment