-
-
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
@radix-ui/react-slot
to react package and more examples to th…
…e website
- Loading branch information
1 parent
6f1b4e5
commit 5ed151e
Showing
11 changed files
with
174 additions
and
80 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
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,58 @@ | ||
import { Card, CardContent } from "@/components/ui/card"; | ||
import { Code } from "@/components/ui/code"; | ||
import { Squircle } from "@squircle-js/react"; | ||
|
||
import Prism from "prismjs"; | ||
import "prismjs/components/prism-jsx"; | ||
import type { PropsWithChildren } from "react"; | ||
|
||
const usage = `<Squircle | ||
asChild | ||
cornerRadius={10} | ||
cornerSmoothing={1} | ||
className="bg-black text-white px-2 py-1" | ||
> | ||
<span>Inline Squircle</span> | ||
</Squircle>`; | ||
|
||
const highlightedUsage = Prism.highlight( | ||
["...", usage, "..."].join("\n"), | ||
Prism.languages.jsx, | ||
"jsx" | ||
); | ||
|
||
export const ExamplesSectionAsChildExample = () => { | ||
return ( | ||
<Card className="w-full max-w-[480px] sm:max-w-[508px]"> | ||
<CardContent className="py-6 w-full space-y-4"> | ||
<h3 className="font-semibold text-lg">Code:</h3> | ||
<p> | ||
You can use <Kode>asChild</Kode> prop to squircle any element. This is | ||
useful when you want to squircle some element that might change size. | ||
By default <Kode>Squircle</Kode> is a <Kode>div</Kode> element, but | ||
you can change it to any other element by nesting that element inside | ||
of <Kode>Squircle</Kode> component and adding <Kode>asChild</Kode>{" "} | ||
prop. | ||
</p> | ||
|
||
<Code dangerousHTML={highlightedUsage} raw={usage} /> | ||
<h3 className="font-semibold text-lg">Result:</h3> | ||
|
||
<Squircle | ||
cornerRadius={10} | ||
cornerSmoothing={1} | ||
asChild | ||
className="bg-black text-white px-2 py-1" | ||
> | ||
<span>Inline Squircle</span> | ||
</Squircle> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
const Kode = ({ children }: PropsWithChildren) => ( | ||
<code className="bg-slate-200/50 px-1.5 text-sm py-0.5 rounded-md"> | ||
{children} | ||
</code> | ||
); |
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
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
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
Oops, something went wrong.