Skip to content

Commit 9d53a90

Browse files
M-Izadmehrdanilowoz
authored andcommitted
added preserveAspectRatio To props (#36)
* added preserveAspectRatio To props * updated README.md
1 parent 7fe2a99 commit 9d53a90

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const MyLoader = () => {
6161
| height | _Number_ | `130` | Height component |
6262
| primaryColor | _String_ | `#f3f3f3` | Background the SVG |
6363
| secondaryColor | _String_ | `#ecebeb` | Animation color |
64+
| preserveAspectRatio | _String_ | `xMidYMid meet` | Aspect ratio option of SVG|
6465

6566

6667
**Custom element options:**

src/Wrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Wrap = (props: WrapProps): React.Element<*> => {
1919
height={props.height}
2020
version="1.1"
2121
style={props.style}
22-
preserveAspectRatio="xMidYMid meet"
22+
preserveAspectRatio={props.preserveAspectRatio}
2323
>
2424
<rect
2525
style={{ fill: `url(#${idGradient})` }}
@@ -64,4 +64,4 @@ const Wrap = (props: WrapProps): React.Element<*> => {
6464
)
6565
}
6666

67-
export default Wrap
67+
export default Wrap

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type Props = {
2020
height: number,
2121
primaryColor: string,
2222
secondaryColor: string,
23+
preserveAspectRatio:string,
2324
}
2425

2526
type State = {
@@ -30,6 +31,7 @@ type State = {
3031
height: number,
3132
primaryColor: string,
3233
secondaryColor: string,
34+
preserveAspectRatio: string,
3335
}
3436

3537
class ContentLoader extends React.Component<Props, State> {
@@ -40,6 +42,7 @@ class ContentLoader extends React.Component<Props, State> {
4042
height: 130,
4143
primaryColor: '#f0f0f0',
4244
secondaryColor: '#e0e0e0',
45+
preserveAspectRatio: 'xMidYMid meet',
4346
}
4447

4548
constructor(props: Props) {
@@ -53,6 +56,7 @@ class ContentLoader extends React.Component<Props, State> {
5356
height: props.height,
5457
primaryColor: props.primaryColor,
5558
secondaryColor: props.secondaryColor,
59+
preserveAspectRatio: props.preserveAspectRatio,
5660
}
5761
}
5862

@@ -84,4 +88,4 @@ class ContentLoader extends React.Component<Props, State> {
8488
}
8589

8690
export default ContentLoader
87-
export { Rect, Circle }
91+
export { Rect, Circle }

0 commit comments

Comments
 (0)