Skip to content

Commit e52a1c8

Browse files
authored
Merge pull request #26 from allandiegoasilva/dialog
[feat]: Dialog
2 parents 63562c9 + adf9abb commit e52a1c8

File tree

15 files changed

+4627
-3104
lines changed

15 files changed

+4627
-3104
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ yarn-error.log*
3636
next-env.d.ts
3737

3838
# contentlayer
39-
.contentlayer
39+
.contentlayer
40+
41+
package-lock.json

config/components.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export const componentConfig = {
2626
name: "text",
2727
filePath: "packages/ui/Text/Text.tsx",
2828
},
29+
dialog: {
30+
name: "dialog",
31+
filePath: "packages/ui/Dialog/Dialog.tsx",
32+
},
2933
},
3034
examples: {
3135
"accordion-style-default": {
@@ -148,5 +152,31 @@ export const componentConfig = {
148152
filePath: "preview/components/tab-style-default.tsx",
149153
preview: lazy(() => import("@/preview/components/tab-style-default")),
150154
},
155+
"dialog-style-default": {
156+
name: "dialog-style-default",
157+
filePath: "preview/components/dialog-style-default.tsx",
158+
preview: lazy(() => import("@/preview/components/dialog-style-default")),
159+
},
160+
"dialog-style-with-footer": {
161+
name: "dialog-style-with-footer",
162+
filePath: "preview/components/dialog-style-with-footer.tsx",
163+
preview: lazy(
164+
() => import("@/preview/components/dialog-style-with-footer")
165+
),
166+
},
167+
"dialog-style-width-variant": {
168+
name: "dialog-style-width-variant",
169+
filePath: "preview/components/dialog-style-width-variant.tsx",
170+
preview: lazy(
171+
() => import("@/preview/components/dialog-style-width-variant")
172+
),
173+
},
174+
"dialog-style-with-form": {
175+
name: "dialog-style-with-form",
176+
filePath: "preview/components/dialog-style-with-form.tsx",
177+
preview: lazy(
178+
() => import("@/preview/components/dialog-style-with-form")
179+
),
180+
},
151181
},
152182
};

config/navigation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const navConfig: INavigationConfig = {
2626
{ title: "Tab", href: `${componentsRoute}/tab` },
2727
{ title: "Textarea", href: `${componentsRoute}/textarea` },
2828
{ title: "Text", href: `${componentsRoute}/text` },
29+
{ title: "Dialog", href: `${componentsRoute}/dialog` },
2930
],
3031
},
3132
{

content/docs/components/dialog.mdx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Dialog
3+
description: An impactful dialog that ensures your important messages and actions get the attention they deserve! 💬✨
4+
lastUpdated: 26 Oct, 2024
5+
---
6+
7+
<ComponentShowcase name="dialog-style-default" />
8+
<br />
9+
<br />
10+
11+
## Instalation
12+
13+
#### 1. Install dependencies:
14+
15+
```sh
16+
npm install @radix-ui/react-dialog @radix-ui/react-visually-hidden tailwindcss-animate
17+
```
18+
19+
<br />
20+
21+
#### 2. Configure your `tailwind.config.ts` add:
22+
23+
```sh
24+
{
25+
content: [...],
26+
theme: [...],
27+
28+
// add plugin
29+
plugins: [require("tailwindcss-animate")],
30+
}
31+
```
32+
33+
<br />
34+
<br />
35+
36+
#### 3. Copy the code 👇 into your project:
37+
38+
<ComponentSource name="dialog" />
39+
40+
<br />
41+
<br />
42+
43+
## Example
44+
45+
#### Confirm dialog message
46+
47+
<ComponentShowcase name="dialog-style-default" />
48+
<br />
49+
<br />
50+
51+
#### Confirm dialog with footer
52+
53+
<ComponentShowcase name="dialog-style-with-footer" />
54+
55+
<br />
56+
<br />
57+
58+
#### Dialog `size` variants
59+
60+
<ComponentShowcase name="dialog-style-width-variant" />
61+
62+
<br />
63+
<br />
64+
65+
#### Dialog with form
66+
67+
<ComponentShowcase name="dialog-style-with-form" />
68+
69+
<br />
70+
<br />
71+
72+
## Notes
73+
74+
For customize anything on dialog you can change `className` for the component and doas you want.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"@headlessui/react": "^2.1.9",
1313
"@radix-ui/react-accordion": "^1.2.1",
1414
"@radix-ui/react-avatar": "^1.1.1",
15+
"@radix-ui/react-dialog": "^1.1.2",
16+
"@radix-ui/react-visually-hidden": "^1.1.0",
1517
"class-variance-authority": "^0.7.0",
1618
"clsx": "^2.1.1",
1719
"contentlayer": "^0.3.4",
@@ -35,6 +37,7 @@
3537
"eslint-config-next": "14.2.7",
3638
"postcss": "^8",
3739
"tailwindcss": "^3.4.1",
40+
"tailwindcss-animate": "^1.0.7",
3841
"typescript": "^5"
3942
}
4043
}

packages/ui/Buttons/Button.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,24 @@ export interface IButtonProps
2727
extends ButtonHTMLAttributes<HTMLButtonElement>,
2828
VariantProps<typeof buttonVariants> {}
2929

30-
export function Button({
31-
children,
32-
size = "md",
33-
className = "",
34-
variant = "default",
35-
...props
36-
}: IButtonProps) {
37-
return (
30+
export const Button = React.forwardRef<HTMLButtonElement, IButtonProps>(
31+
(
32+
{
33+
children,
34+
size = "md",
35+
className = "",
36+
variant = "default",
37+
...props
38+
}: IButtonProps,
39+
forwardedRef
40+
) => (
3841
<button
3942
className={cn(buttonVariants({ variant, size }), className)}
4043
{...props}
4144
>
4245
{children}
4346
</button>
44-
);
45-
}
47+
)
48+
);
4649

4750
Button.displayName = "Button";

0 commit comments

Comments
 (0)