forked from airbnb/visx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request airbnb#497 from hshoff/chris--typescript-vx-clip-path
typescript(vx-clip-path): re-write package in TypeScript
- Loading branch information
Showing
9 changed files
with
81 additions
and
54 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import ClipPath from './ClipPath'; | ||
|
||
export type CircleClipPathProps = { | ||
/** Unique id for the clipPath. */ | ||
id: string; | ||
/** x position of the center of the ClipPath circle. */ | ||
cx?: string | number; | ||
/** y position of the center of the ClipPath circle. */ | ||
cy?: string | number; | ||
/** radius of the ClipPath circle. */ | ||
r?: string | number; | ||
}; | ||
|
||
export default function CircleClipPath({ | ||
id, | ||
cx, | ||
cy, | ||
r, | ||
...restProps | ||
}: CircleClipPathProps & Omit<React.SVGProps<SVGCircleElement>, keyof CircleClipPathProps>) { | ||
return ( | ||
<ClipPath id={id}> | ||
<circle cx={cx} cy={cy} r={r} {...restProps} /> | ||
</ClipPath> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
|
||
export type ClipPathProps = { | ||
/** Unique id for the clipPath. */ | ||
id: string; | ||
/** clipPath children. */ | ||
children?: React.ReactNode; | ||
}; | ||
|
||
export default function ClipPath({ | ||
id, | ||
children, | ||
...restProps | ||
}: ClipPathProps & Omit<React.SVGProps<SVGClipPathElement>, keyof ClipPathProps>) { | ||
return ( | ||
<defs> | ||
<clipPath id={id} {...restProps}> | ||
{children} | ||
</clipPath> | ||
</defs> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
import ClipPath from './ClipPath'; | ||
|
||
export type RectClipPathProps = { | ||
/** Unique id for the clipPath. */ | ||
id: string; | ||
/** x position of the ClipPath rect. */ | ||
x?: string | number; | ||
/** y position of the ClipPath rect. */ | ||
y?: string | number; | ||
/** width of the ClipPath rect. */ | ||
width?: string | number; | ||
/** height of the ClipPath rect. */ | ||
height?: string | number; | ||
}; | ||
|
||
export default function RectClipPath({ | ||
id, | ||
x = 0, | ||
y = 0, | ||
width = 1, | ||
height = 1, | ||
...restProps | ||
}: RectClipPathProps & Omit<React.SVGProps<SVGRectElement>, keyof RectClipPathProps>) { | ||
return ( | ||
<ClipPath id={id}> | ||
<rect x={x} y={y} width={width} height={height} {...restProps} /> | ||
</ClipPath> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.