@skalfa/skalfa-app 1.0.2 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +8 -16
- package/app/auth/edit/page.tsx +1 -1
- package/app/auth/login/page.tsx +1 -1
- package/app/auth/me/page.tsx +1 -1
- package/app/auth/register/page.tsx +1 -1
- package/app/auth/verify/page.tsx +1 -1
- package/app/dashboard/layout.tsx +2 -2
- package/app/dashboard/page.tsx +1 -1
- package/app/index.ts +1 -0
- package/app/layout.tsx +2 -4
- package/app/page.tsx +2 -2
- package/bun.lock +39 -24
- package/components/index.ts +1 -3
- package/package.json +8 -7
- package/styles/components.css +1392 -0
- package/styles/globals.css +40 -175
- package/styles/utilities.css +37 -0
- package/tsconfig.json +4 -2
- package/utils/commands/skalfa.ts +3 -0
- package/blueprints/starter.blueprint.json +0 -103
- package/components/base.components/accordion/Accordion.component.tsx +0 -82
- package/components/base.components/breadcrumb/Breadcrumb.component.tsx +0 -80
- package/components/base.components/button/Button.component.tsx +0 -91
- package/components/base.components/button/IconButton.component.tsx +0 -88
- package/components/base.components/button/button.decorate.ts +0 -82
- package/components/base.components/card/AlertCard.component.tsx +0 -69
- package/components/base.components/card/Card.component.tsx +0 -25
- package/components/base.components/card/DashboardCard.component.tsx +0 -44
- package/components/base.components/card/GalleryCard.component.tsx +0 -50
- package/components/base.components/card/ProductCard.component.tsx +0 -65
- package/components/base.components/card/ProfileCard.component.tsx +0 -71
- package/components/base.components/carousel/Carousel.component.tsx +0 -113
- package/components/base.components/chip/Chip.component.tsx +0 -39
- package/components/base.components/document/DocumentViewer.component.tsx +0 -164
- package/components/base.components/document/ExportExcel.component.tsx +0 -340
- package/components/base.components/document/ImportExcel.component.tsx +0 -315
- package/components/base.components/document/PrintTable.component.tsx +0 -204
- package/components/base.components/document/RenderPDF.component.tsx +0 -416
- package/components/base.components/index.ts +0 -85
- package/components/base.components/input/Checkbox.component.tsx +0 -109
- package/components/base.components/input/Input.component.tsx +0 -332
- package/components/base.components/input/InputCheckbox.component.tsx +0 -174
- package/components/base.components/input/InputCurrency.component.tsx +0 -163
- package/components/base.components/input/InputDate.component.tsx +0 -352
- package/components/base.components/input/InputDatetime.component.tsx +0 -260
- package/components/base.components/input/InputDocument.component.tsx +0 -352
- package/components/base.components/input/InputImage.component.tsx +0 -533
- package/components/base.components/input/InputMap.component.tsx +0 -318
- package/components/base.components/input/InputNumber.component.tsx +0 -192
- package/components/base.components/input/InputOtp.component.tsx +0 -169
- package/components/base.components/input/InputPassword.component.tsx +0 -236
- package/components/base.components/input/InputRadio.component.tsx +0 -175
- package/components/base.components/input/InputTime.component.tsx +0 -276
- package/components/base.components/input/InputValues.component.tsx +0 -68
- package/components/base.components/input/Radio.component.tsx +0 -102
- package/components/base.components/input/Select.component.tsx +0 -541
- package/components/base.components/modal/BottomSheet.component.tsx +0 -246
- package/components/base.components/modal/FloatingPage.component.tsx +0 -104
- package/components/base.components/modal/Modal.component.tsx +0 -96
- package/components/base.components/modal/ModalConfirm.component.tsx +0 -218
- package/components/base.components/modal/Toast.component.tsx +0 -126
- package/components/base.components/nav/Bottombar.component.tsx +0 -116
- package/components/base.components/nav/Footer.component.tsx +0 -144
- package/components/base.components/nav/Headbar.component.tsx +0 -104
- package/components/base.components/nav/Navbar.component.tsx +0 -100
- package/components/base.components/nav/Sidebar.component.tsx +0 -301
- package/components/base.components/nav/Tabbar.component.tsx +0 -60
- package/components/base.components/nav/Wizard.component.tsx +0 -73
- package/components/base.components/supervision/FormSupervision.component.tsx +0 -434
- package/components/base.components/supervision/TableSupervision.component.tsx +0 -697
- package/components/base.components/table/ControlBar.component.tsx +0 -497
- package/components/base.components/table/FilterComponent.tsx +0 -518
- package/components/base.components/table/Pagination.component.tsx +0 -159
- package/components/base.components/table/Table.component.tsx +0 -469
- package/components/base.components/typography/TypographyArticle.component.tsx +0 -26
- package/components/base.components/typography/TypographyColumn.component.tsx +0 -20
- package/components/base.components/typography/TypographyContent.component.tsx +0 -20
- package/components/base.components/typography/TypographyTips.component.tsx +0 -20
- package/components/base.components/wrap/Draggable.component.tsx +0 -303
- package/components/base.components/wrap/IDBProvider.tsx +0 -12
- package/components/base.components/wrap/Image.component.tsx +0 -10
- package/components/base.components/wrap/OutsideClick.component.tsx +0 -48
- package/components/base.components/wrap/ScrollContainer.component.tsx +0 -104
- package/components/base.components/wrap/ShortcutProvider.tsx +0 -57
- package/components/base.components/wrap/Swipe.component.tsx +0 -93
- package/components/construct.components/example.tsx +0 -1
- package/components/construct.components/index.ts +0 -5
- package/components/structure.components/example.tsx +0 -1
- package/components/structure.components/index.ts +0 -5
- package/langs/index.ts +0 -1
- package/langs/validation.langs.ts +0 -17
- package/schema/idb/app.schema.ts +0 -9
- package/schema/index.ts +0 -5
- package/utils/commands/barrels.ts +0 -28
- package/utils/commands/blueprint.ts +0 -421
- package/utils/commands/light.ts +0 -21
- package/utils/commands/logger.ts +0 -42
- package/utils/commands/stubs/table-blueprint.stub +0 -13
- package/utils/commands/use-pdf.ts +0 -29
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
4
|
-
import { cn, pcn } from "@utils";
|
|
5
|
-
import { buttonVariant, buttonRadius, iconButtonContainer } from "./button.decorate";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type CT = "icon" | "loading" | "base";
|
|
10
|
-
|
|
11
|
-
export interface IconButtonProps {
|
|
12
|
-
icon ?: any;
|
|
13
|
-
type ?: "submit" | "button";
|
|
14
|
-
variant ?: "solid" | "outline" | "light" | "simple";
|
|
15
|
-
rounded ?: boolean | string;
|
|
16
|
-
disabled ?: boolean;
|
|
17
|
-
size ?: "xs" | "sm" | "md" | "lg";
|
|
18
|
-
onClick ?: any;
|
|
19
|
-
loading ?: boolean;
|
|
20
|
-
hover ?: boolean;
|
|
21
|
-
tips ?: string | undefined;
|
|
22
|
-
paint ?: "primary" | "secondary" | "success" | "danger" | "warning";
|
|
23
|
-
customPaint ?: {
|
|
24
|
-
bg ?: string;
|
|
25
|
-
color ?: string;
|
|
26
|
-
border ?: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** Use custom class with: "icon::", "loading::". */
|
|
30
|
-
className?: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export function IconButtonComponent({
|
|
36
|
-
type = "button",
|
|
37
|
-
variant = "solid",
|
|
38
|
-
paint = "primary",
|
|
39
|
-
size = "md",
|
|
40
|
-
rounded,
|
|
41
|
-
disabled,
|
|
42
|
-
onClick,
|
|
43
|
-
icon,
|
|
44
|
-
loading,
|
|
45
|
-
tips,
|
|
46
|
-
className = "",
|
|
47
|
-
}: IconButtonProps) {
|
|
48
|
-
const buttonClasses = cn(
|
|
49
|
-
"button",
|
|
50
|
-
buttonVariant[variant][paint],
|
|
51
|
-
iconButtonContainer[size],
|
|
52
|
-
rounded ? "rounded-full" : buttonRadius[size],
|
|
53
|
-
pcn<CT>(className, "base")
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const loadingClasses = cn(
|
|
57
|
-
"button-loading",
|
|
58
|
-
size === "sm" ? "w-3 h-3" : size === "lg" ? "w-5 h-5" : "w-4 h-4",
|
|
59
|
-
pcn<CT>(className, "loading")
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
const iconClasses = cn(
|
|
63
|
-
size === "xs"
|
|
64
|
-
? "text-xs"
|
|
65
|
-
: size === "sm"
|
|
66
|
-
? "text-sm mb-0.5"
|
|
67
|
-
: size === "lg"
|
|
68
|
-
? "text-xl mb-0.5"
|
|
69
|
-
: "text-base mb-0.5",
|
|
70
|
-
pcn<CT>(className, "icon")
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<button
|
|
75
|
-
type={type}
|
|
76
|
-
className={buttonClasses}
|
|
77
|
-
disabled={disabled || loading}
|
|
78
|
-
onClick={onClick}
|
|
79
|
-
title={tips}
|
|
80
|
-
>
|
|
81
|
-
{loading ? (
|
|
82
|
-
<div className={loadingClasses}></div>
|
|
83
|
-
) : (
|
|
84
|
-
<FontAwesomeIcon icon={icon} className={iconClasses} />
|
|
85
|
-
)}
|
|
86
|
-
</button>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export const buttonContainer = {
|
|
2
|
-
lg: "px-14 py-3 flex items-center gap-3",
|
|
3
|
-
md: "px-8 py-2 flex items-center gap-2",
|
|
4
|
-
sm: "px-6 py-2 text-xs flex items-center gap-2",
|
|
5
|
-
xs: "px-3 py-1 text-xs flex items-center gap-1.5",
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const iconButtonContainer = {
|
|
9
|
-
lg: "w-10 h-10 flex items-center justify-center",
|
|
10
|
-
md: "w-8 h-8 flex items-center justify-center",
|
|
11
|
-
sm: "w-7 h-7 text-xs flex items-center justify-center",
|
|
12
|
-
xs: "w-6 h-6 text-xs flex items-center justify-center",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const buttonVariant = {
|
|
16
|
-
solid: {
|
|
17
|
-
primary: "bg-primary text-white",
|
|
18
|
-
secondary: "bg-secondary text-white",
|
|
19
|
-
warning: "bg-warning text-white",
|
|
20
|
-
danger: "bg-danger text-white",
|
|
21
|
-
success: "bg-success text-white",
|
|
22
|
-
},
|
|
23
|
-
outline: {
|
|
24
|
-
primary: "border text-primary",
|
|
25
|
-
secondary: "border text-secondary",
|
|
26
|
-
warning: "border text-warning",
|
|
27
|
-
danger: "border text-danger",
|
|
28
|
-
success: "border text-success",
|
|
29
|
-
},
|
|
30
|
-
light: {
|
|
31
|
-
primary: "bg-light-primary text-primary",
|
|
32
|
-
secondary: "bg-light-secondary text-secondary",
|
|
33
|
-
warning: "bg-light-warning text-warning",
|
|
34
|
-
danger: "bg-light-danger text-danger",
|
|
35
|
-
success: "bg-light-success text-success",
|
|
36
|
-
},
|
|
37
|
-
simple: {
|
|
38
|
-
primary: "text-primary",
|
|
39
|
-
secondary: "text-secondary",
|
|
40
|
-
warning: "text-warning",
|
|
41
|
-
danger: "text-danger",
|
|
42
|
-
success: "text-success",
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const buttonIcon = {
|
|
47
|
-
solid: {
|
|
48
|
-
primary: "text-white",
|
|
49
|
-
secondary: "text-white",
|
|
50
|
-
warning: "text-white",
|
|
51
|
-
danger: "text-white",
|
|
52
|
-
success: "text-white",
|
|
53
|
-
},
|
|
54
|
-
outline: {
|
|
55
|
-
primary: "text-primary",
|
|
56
|
-
secondary: "text-secondary",
|
|
57
|
-
warning: "text-warning",
|
|
58
|
-
danger: "text-danger",
|
|
59
|
-
success: "text-success",
|
|
60
|
-
},
|
|
61
|
-
light: {
|
|
62
|
-
primary: "text-primary",
|
|
63
|
-
secondary: "text-secondary",
|
|
64
|
-
warning: "text-warning",
|
|
65
|
-
danger: "text-danger",
|
|
66
|
-
success: "text-success",
|
|
67
|
-
},
|
|
68
|
-
simple: {
|
|
69
|
-
primary: "text-primary",
|
|
70
|
-
secondary: "text-secondary",
|
|
71
|
-
warning: "text-warning",
|
|
72
|
-
danger: "text-danger",
|
|
73
|
-
success: "text-success",
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const buttonRadius = {
|
|
78
|
-
lg: "rounded-sm",
|
|
79
|
-
md: "rounded-sm",
|
|
80
|
-
sm: "rounded-sm",
|
|
81
|
-
xs: "rounded-xs",
|
|
82
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
|
-
import { cn, pcn } from "@utils";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type CT = "badge" | "title" | "base";
|
|
9
|
-
|
|
10
|
-
export interface AlertCardProps {
|
|
11
|
-
title ?: string | ReactNode;
|
|
12
|
-
leftContent ?: string | ReactNode;
|
|
13
|
-
badge ?: string | ReactNode;
|
|
14
|
-
content ?: string | ReactNode;
|
|
15
|
-
footer ?: string | ReactNode;
|
|
16
|
-
|
|
17
|
-
/** Use custom class with: "badge::", "title::". */
|
|
18
|
-
className ?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export function AlertCardComponent({
|
|
24
|
-
title,
|
|
25
|
-
leftContent,
|
|
26
|
-
badge,
|
|
27
|
-
content,
|
|
28
|
-
footer,
|
|
29
|
-
className = "",
|
|
30
|
-
}: AlertCardProps) {
|
|
31
|
-
return (
|
|
32
|
-
<>
|
|
33
|
-
<section
|
|
34
|
-
className={cn(
|
|
35
|
-
"rounded-[6px] bg-white p-4 border sm:p-6",
|
|
36
|
-
pcn<CT>(className, "base"),
|
|
37
|
-
)}
|
|
38
|
-
>
|
|
39
|
-
<div className="flex items-start sm:gap-8">
|
|
40
|
-
{leftContent}
|
|
41
|
-
|
|
42
|
-
<div>
|
|
43
|
-
<strong
|
|
44
|
-
className={cn(
|
|
45
|
-
"rounded-[4px] border text-primary bg-primary/20 px-3 py-1.5 text-xs font-bold",
|
|
46
|
-
pcn<CT>(className, "badge"),
|
|
47
|
-
)}
|
|
48
|
-
>
|
|
49
|
-
{badge}
|
|
50
|
-
</strong>
|
|
51
|
-
|
|
52
|
-
<h3
|
|
53
|
-
className={cn(
|
|
54
|
-
"mt-4 text-lg font-medium sm:text-xl",
|
|
55
|
-
pcn<CT>(className, "title"),
|
|
56
|
-
)}
|
|
57
|
-
>
|
|
58
|
-
{title}
|
|
59
|
-
</h3>
|
|
60
|
-
|
|
61
|
-
{content}
|
|
62
|
-
|
|
63
|
-
{footer && <div className="pt-4">{footer}</div>}
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</section>
|
|
67
|
-
</>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { cn } from "@utils";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface CardProps {
|
|
8
|
-
children : React.ReactNode;
|
|
9
|
-
className ?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export function CardComponent({
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
}: CardProps) {
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<div className={cn("px-4 py-2.5 rounded-[6px] border bg-white", className)}>
|
|
21
|
-
{children}
|
|
22
|
-
</div>
|
|
23
|
-
</>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import Link from "next/link";
|
|
4
|
-
import { ReactNode } from "react";
|
|
5
|
-
import { cn } from "@utils";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export interface DashboardCardProps {
|
|
10
|
-
content ?: string | ReactNode;
|
|
11
|
-
title ?: string | ReactNode;
|
|
12
|
-
rightContent ?: string | ReactNode;
|
|
13
|
-
path ?: string;
|
|
14
|
-
className ?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export function DashboardCardComponent({
|
|
20
|
-
content,
|
|
21
|
-
title,
|
|
22
|
-
rightContent,
|
|
23
|
-
path,
|
|
24
|
-
className,
|
|
25
|
-
} : DashboardCardProps) {
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<Link href={path || ""}>
|
|
29
|
-
<div
|
|
30
|
-
className={cn(
|
|
31
|
-
`bg-white border py-4 px-6 rounded-[6px] flex justify-between gap-4 items-center`,
|
|
32
|
-
className,
|
|
33
|
-
)}
|
|
34
|
-
>
|
|
35
|
-
<div>
|
|
36
|
-
<div className="flex gap-4 items-center">{content}</div>
|
|
37
|
-
{title}
|
|
38
|
-
</div>
|
|
39
|
-
<div>{rightContent}</div>
|
|
40
|
-
</div>
|
|
41
|
-
</Link>
|
|
42
|
-
</>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import { cn, pcn } from "@utils";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type CT = "label" | "image" | "base";
|
|
9
|
-
|
|
10
|
-
export interface GalleryCardProps {
|
|
11
|
-
src : string;
|
|
12
|
-
alt ?: string;
|
|
13
|
-
|
|
14
|
-
/** Use custom class with: "label::", "image::". */
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export function GalleryCardComponent({
|
|
21
|
-
src,
|
|
22
|
-
alt = "",
|
|
23
|
-
className = "",
|
|
24
|
-
} : GalleryCardProps) {
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<div className={pcn<CT>(className, "base")}>
|
|
28
|
-
<Image
|
|
29
|
-
src={src}
|
|
30
|
-
alt={src}
|
|
31
|
-
width={400}
|
|
32
|
-
height={300}
|
|
33
|
-
className={cn(
|
|
34
|
-
"w-full rounded-bl-4xl rounded-tr-3xl object-cover aspect-[4/3]",
|
|
35
|
-
pcn<CT>(className, "image"),
|
|
36
|
-
)}
|
|
37
|
-
/>
|
|
38
|
-
|
|
39
|
-
<div
|
|
40
|
-
className={cn(
|
|
41
|
-
"mt-1 text-center text-sm text-light-foreground",
|
|
42
|
-
pcn<CT>(className, "label"),
|
|
43
|
-
)}
|
|
44
|
-
>
|
|
45
|
-
{alt}
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import { cn, pcn } from "@utils";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type CT = "image" | "base" | "content";
|
|
9
|
-
|
|
10
|
-
export interface ProductCardProps {
|
|
11
|
-
name : string;
|
|
12
|
-
price ?: string;
|
|
13
|
-
image ?: string;
|
|
14
|
-
description ?: string | React.ReactNode;
|
|
15
|
-
|
|
16
|
-
/** Use custom class with: "image::", "content::". */
|
|
17
|
-
className ?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export function ProductCardComponent({
|
|
23
|
-
image = "",
|
|
24
|
-
name,
|
|
25
|
-
price,
|
|
26
|
-
description,
|
|
27
|
-
className = "",
|
|
28
|
-
} : ProductCardProps) {
|
|
29
|
-
return (
|
|
30
|
-
<>
|
|
31
|
-
<div
|
|
32
|
-
className={cn(
|
|
33
|
-
"rounded-[6px] border p-2 bg-white",
|
|
34
|
-
pcn<CT>(className, "base"),
|
|
35
|
-
)}
|
|
36
|
-
>
|
|
37
|
-
<Image
|
|
38
|
-
src={image}
|
|
39
|
-
alt={image}
|
|
40
|
-
width={400}
|
|
41
|
-
height={300}
|
|
42
|
-
className={cn(
|
|
43
|
-
"h-56 w-full rounded-[4px] object-cover",
|
|
44
|
-
pcn<CT>(className, "image"),
|
|
45
|
-
)}
|
|
46
|
-
/>
|
|
47
|
-
|
|
48
|
-
<div className={cn("p-2", pcn<CT>(className, "content"))}>
|
|
49
|
-
<dl>
|
|
50
|
-
<div>
|
|
51
|
-
<dt className="sr-only">Name</dt>
|
|
52
|
-
<dd className="text-sm">{name}</dd>
|
|
53
|
-
</div>
|
|
54
|
-
<div>
|
|
55
|
-
<dt className="sr-only">Price</dt>
|
|
56
|
-
<dd className="font-semibold">{price}</dd>
|
|
57
|
-
</div>
|
|
58
|
-
</dl>
|
|
59
|
-
|
|
60
|
-
{description && <div>{description}</div>}
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import Image from "next/image";
|
|
4
|
-
import { cn, pcn } from "@utils";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type CT = "image" | "base" | "content";
|
|
9
|
-
|
|
10
|
-
export interface ProfileCardProps {
|
|
11
|
-
name : string;
|
|
12
|
-
short ?: string;
|
|
13
|
-
image ?: string;
|
|
14
|
-
description ?: string | React.ReactNode;
|
|
15
|
-
footer ?: string | React.ReactNode;
|
|
16
|
-
|
|
17
|
-
/** Use custom class with: "image::", "content::". */
|
|
18
|
-
className ?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export function ProfileCardComponent({
|
|
24
|
-
image = "",
|
|
25
|
-
name,
|
|
26
|
-
short,
|
|
27
|
-
description,
|
|
28
|
-
footer,
|
|
29
|
-
className = "",
|
|
30
|
-
} : ProfileCardProps) {
|
|
31
|
-
return (
|
|
32
|
-
<>
|
|
33
|
-
<div
|
|
34
|
-
className={cn(
|
|
35
|
-
"relative block overflow-hidden rounded-[6px] border bg-white p-4 sm:p-6",
|
|
36
|
-
pcn<CT>(className, "base"),
|
|
37
|
-
)}
|
|
38
|
-
>
|
|
39
|
-
<span className="absolute inset-x-0 bottom-0 h-1 bg-primary"></span>
|
|
40
|
-
|
|
41
|
-
<div className="sm:flex sm:gap-4 sm:items-center">
|
|
42
|
-
{image && (
|
|
43
|
-
<div className="hidden sm:block sm:shrink-0">
|
|
44
|
-
<Image
|
|
45
|
-
src={image}
|
|
46
|
-
alt={image}
|
|
47
|
-
width={400}
|
|
48
|
-
height={400}
|
|
49
|
-
className={cn(
|
|
50
|
-
"size-16 rounded-full object-cover shadow-sm",
|
|
51
|
-
pcn<CT>(className, "image"),
|
|
52
|
-
)}
|
|
53
|
-
/>
|
|
54
|
-
</div>
|
|
55
|
-
)}
|
|
56
|
-
<div className={pcn<CT>(className, "content")}>
|
|
57
|
-
<h3 className="text-lg font-bold sm:text-xl">{name}</h3>
|
|
58
|
-
|
|
59
|
-
<p className="mt-1 text-xs font-medium text-light-foreground">
|
|
60
|
-
{short}
|
|
61
|
-
</p>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
{description}
|
|
66
|
-
|
|
67
|
-
{footer && <dl className="mt-4">{footer}</dl>}
|
|
68
|
-
</div>
|
|
69
|
-
</>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { useState, useRef, useEffect } from "react";
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
6
|
-
import { cn, pcn } from "@utils";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type CT = "item" | "prev-button" | "next-button" | "navigation" | "base";
|
|
11
|
-
|
|
12
|
-
interface CarouselItem {
|
|
13
|
-
background : string;
|
|
14
|
-
content ?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface CarouselProps {
|
|
18
|
-
items : CarouselItem[];
|
|
19
|
-
noButton ?: boolean;
|
|
20
|
-
noNavigation ?: boolean;
|
|
21
|
-
|
|
22
|
-
/** Use custom class with: "item::", "prev-button::", "next-button::", "navigation::". */
|
|
23
|
-
className ?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export function CarouselComponent({
|
|
29
|
-
items,
|
|
30
|
-
className = "",
|
|
31
|
-
noButton,
|
|
32
|
-
noNavigation,
|
|
33
|
-
}: CarouselProps) {
|
|
34
|
-
const [currentIndex, setCurrentIndex] = useState<number>(0);
|
|
35
|
-
const touchStartX = useRef<number | null>(null);
|
|
36
|
-
const touchEndX = useRef<number | null>(null);
|
|
37
|
-
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
|
38
|
-
|
|
39
|
-
const handlePrev = (): void => setCurrentIndex((prevIndex) => (prevIndex - 1 + items.length) % items.length);
|
|
40
|
-
|
|
41
|
-
const handleNext = (): void => setCurrentIndex((prevIndex) => (prevIndex + 1) % items.length);
|
|
42
|
-
|
|
43
|
-
const handleTouchStart = (e: React.TouchEvent<HTMLDivElement>): void => {
|
|
44
|
-
touchStartX.current = e.touches[0].clientX;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const handleTouchEnd = (e: React.TouchEvent<HTMLDivElement>): void => {
|
|
48
|
-
touchEndX.current = e.changedTouches[0].clientX;
|
|
49
|
-
if (touchStartX.current !== null && touchEndX.current !== null) {
|
|
50
|
-
if (touchStartX.current - touchEndX.current > 50) handleNext();
|
|
51
|
-
if (touchEndX.current - touchStartX.current > 50) handlePrev();
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
intervalRef.current = setInterval(handleNext, 10000);
|
|
57
|
-
return () => {
|
|
58
|
-
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
59
|
-
};
|
|
60
|
-
}, []);
|
|
61
|
-
|
|
62
|
-
const styles = {
|
|
63
|
-
base : cn("relative w-full overflow-hidden rounded-[6px]", pcn<CT>(className, "base")),
|
|
64
|
-
item : cn("flex-shrink-0 w-full aspect-[16/6] flex items-center justify-center bg-cover bg-center", pcn<CT>(className, "item")),
|
|
65
|
-
prevButton : cn("absolute top-1/2 left-4 transform -translate-y-1/2 bg-light-foreground/40 text-white p-2 rounded-[6px] cursor-pointer",pcn<CT>(className, "prev-button")),
|
|
66
|
-
nextButton : cn("absolute top-1/2 right-4 transform -translate-y-1/2 bg-light-foreground/40 text-white p-2 rounded-[6px] cursor-pointer",pcn<CT>(className, "next-button")),
|
|
67
|
-
navigation : cn("absolute bottom-4 left-1/2 transform -translate-x-1/2 flex space-x-2",pcn<CT>(className, "navigation")),
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<div className={styles.base}>
|
|
72
|
-
<div
|
|
73
|
-
className="flex transition-transform duration-500"
|
|
74
|
-
style={{ transform: `translateX(-${currentIndex * 100}%)` }}
|
|
75
|
-
onTouchStart={handleTouchStart}
|
|
76
|
-
onTouchEnd={handleTouchEnd}
|
|
77
|
-
>
|
|
78
|
-
{items.map((item, index) => (
|
|
79
|
-
<div
|
|
80
|
-
key={index}
|
|
81
|
-
className={styles.item}
|
|
82
|
-
style={{ backgroundImage: `url(${item.background})` }}
|
|
83
|
-
>
|
|
84
|
-
{item.content}
|
|
85
|
-
</div>
|
|
86
|
-
))}
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
{!noNavigation && (
|
|
90
|
-
<div className={styles.navigation}>
|
|
91
|
-
{items.map((_, index) => (
|
|
92
|
-
<button
|
|
93
|
-
key={index}
|
|
94
|
-
className={`w-8 h-1 rounded-full ${currentIndex === index ? "bg-primary" : "bg-light-foreground/40"}`}
|
|
95
|
-
onClick={() => setCurrentIndex(index)}
|
|
96
|
-
></button>
|
|
97
|
-
))}
|
|
98
|
-
</div>
|
|
99
|
-
)}
|
|
100
|
-
|
|
101
|
-
{!noButton && (
|
|
102
|
-
<>
|
|
103
|
-
<button className={styles.prevButton} onClick={handlePrev}>
|
|
104
|
-
<FontAwesomeIcon icon={faChevronLeft} />
|
|
105
|
-
</button>
|
|
106
|
-
<button className={styles.nextButton} onClick={handleNext}>
|
|
107
|
-
<FontAwesomeIcon icon={faChevronRight} />
|
|
108
|
-
</button>
|
|
109
|
-
</>
|
|
110
|
-
)}
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { faTimes } from "@fortawesome/free-solid-svg-icons";
|
|
2
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
3
|
-
import { cn } from "@utils";
|
|
4
|
-
|
|
5
|
-
export function ChipComponent({
|
|
6
|
-
items,
|
|
7
|
-
onClick,
|
|
8
|
-
onDelete,
|
|
9
|
-
className,
|
|
10
|
-
} : {
|
|
11
|
-
items : Record<string, any>,
|
|
12
|
-
onClick ?: (item: any, index: number) => void,
|
|
13
|
-
onDelete ?: (item: any, index: number) => void,
|
|
14
|
-
className ?: string,
|
|
15
|
-
}) {
|
|
16
|
-
return (
|
|
17
|
-
<div className={cn(`overflow-hidden flex gap-2 flex-wrap`, className)}>
|
|
18
|
-
{items?.map((item: any, key: number) => {
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
key={key}
|
|
22
|
-
className={`flex text-xs py-0.5 px-2 justify-between text-foreground border items-center rounded-md cursor-pointer`}
|
|
23
|
-
onClick={() => onClick?.(item, key)}
|
|
24
|
-
>
|
|
25
|
-
<span>{item}</span>
|
|
26
|
-
|
|
27
|
-
{onDelete && (
|
|
28
|
-
<FontAwesomeIcon
|
|
29
|
-
icon={faTimes}
|
|
30
|
-
className={`text-xs cursor-pointer text-light-foreground pl-2 py-1 hover:text-danger`}
|
|
31
|
-
onClick={() => onDelete?.(item, key)}
|
|
32
|
-
/>
|
|
33
|
-
)}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
})}
|
|
37
|
-
</div>
|
|
38
|
-
)
|
|
39
|
-
}
|