-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added StaticSquircle test component * Added missing `style` prop. * Added changeset for test component * Added test component version * Exited pre mode * commit: true * docs(changeset): Static squircle test
- Loading branch information
1 parent
7e8608f
commit 84a5477
Showing
8 changed files
with
71 additions
and
2 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 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,5 @@ | ||
--- | ||
"@squircle-js/react": patch | ||
--- | ||
|
||
Static squircle test |
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,5 @@ | ||
--- | ||
"@squircle-js/react": minor | ||
--- | ||
|
||
Test StaticSquircle component |
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,13 @@ | ||
{ | ||
"mode": "exit", | ||
"tag": "dev", | ||
"initialVersions": { | ||
"web": "1.0.0", | ||
"eslint-config-custom": "0.0.0", | ||
"@squircle-js/react": "1.1.0", | ||
"tsconfig": "1.0.0" | ||
}, | ||
"changesets": [ | ||
"little-carpets-watch" | ||
] | ||
} |
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 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 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,39 @@ | ||
import { Slot } from "@radix-ui/react-slot"; | ||
import { getSvgPath } from "figma-squircle"; | ||
import { ComponentPropsWithoutRef, PropsWithChildren, useMemo } from "react"; | ||
|
||
type StaticSquircleProps = { | ||
asChild?: boolean; | ||
|
||
width: number; | ||
height: number; | ||
cornerRadius: number; | ||
cornerSmoothing: number; | ||
}; | ||
|
||
export const StaticSquircle = ({ | ||
asChild, | ||
width, | ||
height, | ||
cornerRadius, | ||
cornerSmoothing, | ||
style, | ||
...props | ||
}: PropsWithChildren< | ||
StaticSquircleProps & ComponentPropsWithoutRef<"div"> | ||
>) => { | ||
const Component = asChild ? Slot : "div"; | ||
|
||
const path = useMemo(() => { | ||
return getSvgPath({ | ||
width, | ||
height, | ||
cornerRadius, | ||
cornerSmoothing, | ||
}); | ||
}, [width, height, cornerRadius, cornerSmoothing]); | ||
|
||
return ( | ||
<Component style={{ clipPath: `path('${path}')`, ...style }} {...props} /> | ||
); | ||
}; |
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
84a5477
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
squircle-element – ./
squircle-element.vercel.app
squircle-element-git-main-bring-shrubbery.vercel.app
squircle-element-bring-shrubbery.vercel.app
squircle.js.org