Skip to content

Commit

Permalink
Merge pull request #497 from hshoff/chris--typescript-vx-clip-path
Browse files Browse the repository at this point in the history
typescript(vx-clip-path): re-write package in TypeScript
  • Loading branch information
hshoff authored Oct 9, 2019
2 parents b002888 + cc05a8a commit dcbcf08
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 54 deletions.
2 changes: 2 additions & 0 deletions packages/vx-clip-path/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"sideEffects": false,
"main": "lib/index.js",
"module": "esm/index.js",
"types": "lib/index.d.ts",
"files": [
"lib",
"esm"
Expand All @@ -31,6 +32,7 @@
},
"homepage": "https://github.com/hshoff/vx#readme",
"dependencies": {
"@types/react": "*",
"prop-types": "^15.5.10"
},
"peerDependencies": {
Expand Down
18 changes: 0 additions & 18 deletions packages/vx-clip-path/src/clip-paths/CircleClipPath.jsx

This file was deleted.

27 changes: 27 additions & 0 deletions packages/vx-clip-path/src/clip-paths/CircleClipPath.tsx
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>
);
}
17 changes: 0 additions & 17 deletions packages/vx-clip-path/src/clip-paths/ClipPath.jsx

This file was deleted.

22 changes: 22 additions & 0 deletions packages/vx-clip-path/src/clip-paths/ClipPath.tsx
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>
);
}
19 changes: 0 additions & 19 deletions packages/vx-clip-path/src/clip-paths/RectClipPath.jsx

This file was deleted.

30 changes: 30 additions & 0 deletions packages/vx-clip-path/src/clip-paths/RectClipPath.tsx
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.

0 comments on commit dcbcf08

Please sign in to comment.