Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add react example #32

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 69 additions & 16 deletions pages/docs/examples/react.mdx
Original file line number Diff line number Diff line change
@@ -1,18 +1,71 @@
# React

import { Callout } from 'nextra-theme-docs';

<Callout type="warning" emoji="🚧">
<div className="text-sm">
This page is a work in progress. If you have any questions, please ask in
the{' '}
<a
href="https://discord.gg/9b6yyZKmH4"
target="_blank"
className="underline"
>
Discord
</a>
.
</div>
</Callout>



abdallhsamy marked this conversation as resolved.
Show resolved Hide resolved
```jsx
# /app/page.tsx
abdallhsamy marked this conversation as resolved.
Show resolved Hide resolved

import {title} from "@/components/primitives";

export default function Home() => (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is invalid syntax.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be page.tsx file

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are mixing the function keyword with arrow function => syntax.

<h1 className={title({color: "diamondGradient"})}>
Abdallah Samy
abdallhsamy marked this conversation as resolved.
Show resolved Hide resolved
</h1>
)
```



```ts
# /components/primitives
import { tv } from "tailwind-variants";

export const title = tv({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really the best example IMO. A example for a button or something similar would be better than a gradient like this, as this makes use of a lot of Tailwind arbitrary variants, which isn't something I'd like to encourage in the Tailwind Variants docs.

base: "tracking-tight inline font-semibold",
variants: {
color: {
violet: "from-[#FF1CF7] to-[#b249f8]",
yellow: "from-[#FF705B] to-[#FFB457]",
blue: "from-[#5EA2EF] to-[#0072F5]",
cyan: "from-[#00b7fa] to-[#01cfea]",
green: "from-[#6FEE8D] to-[#17c964]",
pink: "from-[#FF72E1] to-[#F54C7A]",
foreground: "dark:from-[#FFFFFF] dark:to-[#4B4B4B]",
diamondGradient: "bg-gradient-to-br from-[#4F67C9] via-[#020E41] to-[#4F67C9] bg-clip-text text-transparent",
},
size: {
xxs: "text-xl lg:text-2xl",
xs: "text-2xl lg:text-3xl",
sm: "text-3xl lg:text-4xl",
md: "text-[2.3rem] lg:text-5xl leading-9",
lg: "text-4xl lg:text-6xl",
},
fullWidth: {
true: "w-full block",
},
center: {
true: "text-center align-middle",
},
},
defaultVariants: {
size: "md",
},
compoundVariants: [
{
color: [
"violet",
"yellow",
"blue",
"cyan",
"green",
"pink",
"foreground",
],
class: "bg-clip-text text-transparent bg-gradient-to-b",
},
],
});


```