Skip to content

Commit

Permalink
feat(kite component): introduces Kite component as translated from pa…
Browse files Browse the repository at this point in the history
…th lib
  • Loading branch information
Joe Maddalone committed Apr 12, 2023
1 parent b37a84c commit bbedcc2
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 20 deletions.
36 changes: 36 additions & 0 deletions README.md
Expand Up @@ -15,6 +15,7 @@ There are more docs and interactive demos at https://joemaddalone.github.io/reac
- [Circle](#circle)
- [Cross](#cross)
- [Ellipse](#ellipse)
- [Kite](#kite)
- [Lens](#lens)
- [Line](#line)
- [Omino](#omino)
Expand Down Expand Up @@ -209,6 +210,41 @@ centerEnd|boolean|Determines whether cursor should return to cx & cy as a last s
</details>


-----

### Kite

![](examples/kite.svg)

[→ Interactive demo of Kite](https://joemaddalone.github.io/react-svg-path-docs/#/kite)

```js
<Kite
centerEnd={boolean|default = true}
cx={number}
cy={number}
dh={number}
height={number}
width={number}
/>
```

<details>

<summary>Props overview</summary>

Prop|Type|Description|Required|Default
:-|:-|:-|:-|:-
width|number|Width of the Kite.|true|
height|number|Height of the Kite.|true|
dh|number|Vertical position of the left and right points from the top.|true|
cx|number|Center x coordinate of the Kite.|true|
cy|number|Center x coordinate of the Kite.|true|
centerEnd|boolean|Determines whether cursor should return to cx & cy as a last step.|false|true

</details>


-----

### Lens
Expand Down
1 change: 1 addition & 0 deletions examples/kite.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/roundedRect.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/roundedSquare.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 23 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -70,7 +70,7 @@
"dist"
],
"dependencies": {
"@joemaddalone/path": "^1.2.3"
"@joemaddalone/path": "^1.3.1"
},
"config": {
"commitizen": {
Expand Down
1 change: 1 addition & 0 deletions src/components/BasicShapes.js
Expand Up @@ -14,6 +14,7 @@ const shapes = Object.keys(docs).reduce((accum, cur) => {
}, {});

export const Circle = shapes.Circle;
export const Kite = shapes.Kite;
export const Ellipse = shapes.Ellipse;
export const Lens = shapes.Lens;
export const Polygon = shapes.Polygon;
Expand Down
1 change: 1 addition & 0 deletions src/components/BasicShapes.test.js
Expand Up @@ -24,6 +24,7 @@ const BSP = {
ey: 100,
width: 100,
height: 300,
dh: 100,
innerSize: 50,
outerSize: 100,
radius: 10,
Expand Down
10 changes: 10 additions & 0 deletions src/docs/demos.mjs
Expand Up @@ -25,6 +25,16 @@ const demos = {
cy: basicSvgDimensions.h / 2
}
],
kite: [
{
svgDimensions: { ...basicSvgDimensions },
width: 60,
height: 75,
dh: 25,
cx: basicSvgDimensions.w / 2,
cy: basicSvgDimensions.h / 2
}
],
lens: [
{
svgDimensions: { ...basicSvgDimensions },
Expand Down
28 changes: 28 additions & 0 deletions src/docs/docs.mjs
Expand Up @@ -144,6 +144,34 @@ const docs = {
nestingProps: centeredShapeNestingProps,
shorthands: [shorthands.cxy]
},
kite: {
category: 'basicShapes',
Component: 'Kite',
command: 'kite',
args: ['width', 'height', 'dh', 'cx', 'cy', 'centerEnd'],
description:
'.kite is drawn from center point (cx & cy). dh = position of the left & right points from the top of the shape. The cursor is then moved to the center point.',
props: {
width: {
...commonNumber,
description: 'Width of the Kite.'
},
height: {
...commonNumber,
description: 'Height of the Kite.'
},
dh: {
...commonNumber,
description:
'Vertical position of the left and right points from the top.'
},
cx,
cy,
centerEnd
},
nestingProps: centeredShapeNestingProps,
shorthands: [shorthands.cxy]
},
lens: {
category: 'basicShapes',
Component: 'Lens',
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -4,6 +4,7 @@ import * as shapes from './components/BasicShapes';
/** path basicShapes */
export const Circle = shapes.Circle;
export const Ellipse = shapes.Ellipse;
export const Kite = shapes.Kite;
export const Lens = shapes.Lens;
export const Polygon = shapes.Polygon;
export const Polygram = shapes.Polygram;
Expand Down

0 comments on commit bbedcc2

Please sign in to comment.