added preserveAspectRatio To props (#36)

* added preserveAspectRatio To props

* updated README.md
This commit is contained in:
Mojtaba Izadmehr
2017-12-14 01:57:00 +03:30
committed by Danilo Woznica
parent 7fe2a993ee
commit 9d53a90400
3 changed files with 8 additions and 3 deletions

View File

@@ -61,6 +61,7 @@ const MyLoader = () => {
| height | _Number_ | `130` | Height component |
| primaryColor | _String_ | `#f3f3f3` | Background the SVG |
| secondaryColor | _String_ | `#ecebeb` | Animation color |
| preserveAspectRatio | _String_ | `xMidYMid meet` | Aspect ratio option of SVG|
**Custom element options:**

View File

@@ -19,7 +19,7 @@ const Wrap = (props: WrapProps): React.Element<*> => {
height={props.height}
version="1.1"
style={props.style}
preserveAspectRatio="xMidYMid meet"
preserveAspectRatio={props.preserveAspectRatio}
>
<rect
style={{ fill: `url(#${idGradient})` }}
@@ -64,4 +64,4 @@ const Wrap = (props: WrapProps): React.Element<*> => {
)
}
export default Wrap
export default Wrap

View File

@@ -20,6 +20,7 @@ export type Props = {
height: number,
primaryColor: string,
secondaryColor: string,
preserveAspectRatio:string,
}
type State = {
@@ -30,6 +31,7 @@ type State = {
height: number,
primaryColor: string,
secondaryColor: string,
preserveAspectRatio: string,
}
class ContentLoader extends React.Component<Props, State> {
@@ -40,6 +42,7 @@ class ContentLoader extends React.Component<Props, State> {
height: 130,
primaryColor: '#f0f0f0',
secondaryColor: '#e0e0e0',
preserveAspectRatio: 'xMidYMid meet',
}
constructor(props: Props) {
@@ -53,6 +56,7 @@ class ContentLoader extends React.Component<Props, State> {
height: props.height,
primaryColor: props.primaryColor,
secondaryColor: props.secondaryColor,
preserveAspectRatio: props.preserveAspectRatio,
}
}
@@ -84,4 +88,4 @@ class ContentLoader extends React.Component<Props, State> {
}
export default ContentLoader
export { Rect, Circle }
export { Rect, Circle }