@js-empire/emperor-ui 1.0.1 → 1.2.0
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/.husky/pre-commit +4 -0
- package/.storybook/main.ts +2 -11
- package/.storybook/preview.ts +1 -1
- package/.storybook/vitest.setup.ts +3 -3
- package/.vscode/extensions.json +1 -0
- package/README.md +47 -1
- package/dist/emperor-ui.js +69 -3169
- package/dist/emperor-ui.umd.cjs +45 -2
- package/dist/features-animation-D_Ss-HYx.js +1938 -0
- package/dist/globals.css +1 -0
- package/dist/icons/emperor-ui-logo.ico +0 -0
- package/dist/images/avatar-female.jpg +0 -0
- package/dist/images/avatar-male.jpg +0 -0
- package/dist/images/emperor-ui-logo.png +0 -0
- package/dist/index-C3mfrNCk.js +1630 -0
- package/dist/index-CZpTSGZs.js +5 -0
- package/dist/index-SRvFgjzo.js +26257 -0
- package/dist/index.d.ts +552 -46
- package/dist/src-UW24ZMRV-Ducut0ty.js +5 -0
- package/eslint.config.js +5 -14
- package/package.json +19 -7
- package/public/icons/emperor-ui-logo.ico +0 -0
- package/public/images/avatar-female.jpg +0 -0
- package/public/images/avatar-male.jpg +0 -0
- package/public/images/emperor-ui-logo.png +0 -0
- package/src/components/atoms/brand/brand.stories.tsx +27 -0
- package/src/components/atoms/brand/brand.tsx +56 -0
- package/src/components/atoms/brand/index.ts +1 -0
- package/src/components/atoms/brand/styles/classes.ts +9 -0
- package/src/components/atoms/brand/styles/index.ts +2 -0
- package/src/components/atoms/brand/styles/styles.ts +0 -0
- package/src/components/atoms/column/column.stories.tsx +37 -0
- package/src/components/atoms/column/column.tsx +21 -0
- package/src/components/atoms/column/index.ts +1 -0
- package/src/components/atoms/container/column.stories.tsx +37 -0
- package/src/components/atoms/container/container.tsx +28 -0
- package/src/components/atoms/container/index.ts +1 -0
- package/src/components/atoms/index.ts +6 -0
- package/src/components/atoms/portal/index.ts +1 -0
- package/src/components/atoms/portal/portal.stories.tsx +43 -0
- package/src/components/atoms/portal/portal.tsx +25 -0
- package/src/components/atoms/row/index.ts +1 -0
- package/src/components/atoms/row/row.stories.tsx +37 -0
- package/src/components/atoms/row/row.tsx +26 -0
- package/src/components/atoms/uploader/avatar-label.tsx +83 -0
- package/src/components/atoms/uploader/index.ts +7 -0
- package/src/components/atoms/uploader/stories/uploader.stories.tsx +160 -0
- package/src/components/atoms/uploader/upload-file-error-box.tsx +29 -0
- package/src/components/atoms/uploader/upload-file-input.tsx +36 -0
- package/src/components/atoms/uploader/upload-file-label.tsx +74 -0
- package/src/components/atoms/uploader/upload-file-listing.tsx +55 -0
- package/src/components/atoms/uploader/uploader.tsx +55 -0
- package/src/components/atoms/uploader/view-image-modal.tsx +40 -0
- package/src/components/index.ts +4 -8
- package/src/components/{filter → molecules/filter}/filter.tsx +2 -2
- package/src/components/molecules/index.ts +5 -0
- package/src/components/molecules/item-card/item-card.tsx +6 -0
- package/src/components/molecules/nav-bar/index.ts +3 -0
- package/src/components/molecules/nav-bar/nav-bar-item.tsx +70 -0
- package/src/components/molecules/nav-bar/nav-bar.tsx +65 -0
- package/src/components/molecules/nav-bar/stories/hover-effect/nav-bar-hover-effect.stories.tsx +52 -0
- package/src/components/molecules/nav-bar/stories/nav-bar.stories.tsx +50 -0
- package/src/components/molecules/nav-bar/styles/classes.ts +68 -0
- package/src/components/molecules/nav-bar/styles/index.ts +2 -0
- package/src/components/molecules/nav-bar/styles/styles.ts +85 -0
- package/src/components/molecules/nav-bar/sub-items-box.tsx +57 -0
- package/src/components/molecules/scaffold/scaffold.stories.tsx +21 -0
- package/src/components/molecules/scaffold/scaffold.tsx +36 -0
- package/src/components/molecules/side-bar/compact-side-bar.tsx +75 -0
- package/src/components/molecules/side-bar/index.ts +1 -0
- package/src/components/molecules/side-bar/side-bar-drawer.tsx +124 -0
- package/src/components/molecules/side-bar/side-bar.stories.tsx +111 -0
- package/src/components/molecules/side-bar/side-bar.tsx +31 -0
- package/src/components/molecules/side-bar/styles/classes.ts +28 -0
- package/src/components/molecules/side-bar/styles/index.ts +2 -0
- package/src/components/molecules/side-bar/styles/styles.ts +13 -0
- package/src/components/organisms/footer/copy-rights-box.tsx +27 -0
- package/src/components/organisms/footer/footer.tsx +75 -0
- package/src/components/organisms/footer/index.ts +5 -0
- package/src/components/organisms/footer/policies-box.tsx +26 -0
- package/src/components/organisms/footer/quick-links-box.tsx +45 -0
- package/src/components/organisms/footer/social-links-box.tsx +32 -0
- package/src/components/organisms/footer/stories/footer.stories.tsx +61 -0
- package/src/components/organisms/footer/styles/classes.ts +71 -0
- package/src/components/organisms/footer/styles/index.ts +2 -0
- package/src/components/organisms/footer/styles/styles.ts +6 -0
- package/src/components/organisms/header/header.tsx +94 -0
- package/src/components/organisms/header/segmented-header-content.tsx +37 -0
- package/src/components/organisms/header/stories/header.stories.tsx +144 -0
- package/src/components/organisms/header/styles/classes.ts +22 -0
- package/src/components/organisms/header/styles/index.ts +2 -0
- package/src/components/organisms/header/styles/styles.ts +39 -0
- package/src/components/organisms/index.ts +4 -0
- package/src/components/{item-details → organisms/item-details}/item-details.tsx +2 -2
- package/src/components/{listings → organisms/listings}/listings.tsx +2 -2
- package/src/components/templates/index.ts +1 -0
- package/src/components/templates/landing-page/index.ts +1 -0
- package/src/components/templates/landing-page/landing-page.stories.tsx +21 -0
- package/src/components/templates/landing-page/landing-page.tsx +57 -0
- package/src/components/templates/landing-page/styles/classes.ts +11 -0
- package/src/components/templates/landing-page/styles/index.ts +1 -0
- package/src/constants/defaults.ts +43 -8
- package/src/constants/fake.ts +5 -0
- package/src/constants/footer.tsx +157 -0
- package/src/constants/index.ts +3 -0
- package/src/constants/uploader.ts +27 -0
- package/src/context/emperor-ui-context.ts +4 -4
- package/src/context/index.ts +2 -0
- package/src/context/navigation-context.ts +6 -0
- package/src/context/uploader-context.ts +6 -0
- package/src/enums/index.ts +2 -0
- package/src/enums/placeholders.ts +4 -0
- package/src/enums/preserved-keys.ts +3 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/use-emperor-ui.ts +1 -1
- package/src/hooks/use-navigation.ts +12 -0
- package/src/hooks/use-uploader-context.ts +14 -0
- package/src/hooks/use-uploader.tsx +151 -0
- package/src/index.ts +9 -5
- package/src/main.tsx +3 -0
- package/src/mocks/header.tsx +118 -0
- package/src/mocks/index.ts +1 -0
- package/src/providers/config-provider.tsx +54 -0
- package/src/providers/emperor-ui-provider.tsx +17 -24
- package/src/providers/index.ts +3 -0
- package/src/providers/navigation-provider.tsx +42 -0
- package/src/providers/uploader-provider.tsx +53 -0
- package/src/styles/globals.css +13 -0
- package/src/styles/hero.ts +2 -0
- package/src/types/components/atoms/brand.ts +13 -0
- package/src/types/components/atoms/column.ts +3 -0
- package/src/types/components/atoms/container.ts +3 -0
- package/src/types/components/atoms/index.ts +6 -0
- package/src/types/components/atoms/portal.ts +6 -0
- package/src/types/components/atoms/row.ts +3 -0
- package/src/types/components/atoms/uploader.ts +97 -0
- package/src/types/components/index.ts +3 -8
- package/src/types/components/{filter → molecules/filter}/filter.ts +1 -1
- package/src/types/components/molecules/footer/footer.ts +68 -0
- package/src/types/components/molecules/header/header.ts +51 -0
- package/src/types/components/molecules/index.ts +9 -0
- package/src/types/components/{item-card → molecules/item-card}/item-card.ts +1 -1
- package/src/types/components/{item-details → molecules/item-details}/item-details.ts +1 -1
- package/src/types/components/{listings → molecules/listings}/listings.ts +1 -1
- package/src/types/components/molecules/nav-bar/nav-bar.ts +66 -0
- package/src/types/components/{scaffold → molecules/scaffold}/scaffold.ts +1 -1
- package/src/types/components/molecules/side-bar/index.ts +1 -0
- package/src/types/components/molecules/side-bar/side-bar.ts +40 -0
- package/src/types/components/templates/index.ts +1 -0
- package/src/types/components/templates/landing-page.ts +10 -0
- package/src/types/context/config.ts +54 -0
- package/src/types/context/index.ts +2 -1
- package/src/types/context/navigation.ts +17 -0
- package/src/types/shared/components.ts +4 -0
- package/src/utils/compress-images.ts +36 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/storybook.tsx +15 -0
- package/src/utils/uploader.ts +148 -0
- package/tsconfig.app.json +1 -9
- package/tsconfig.node.json +0 -1
- package/vite.config.ts +3 -8
- package/vitest.shims.d.ts +1 -1
- package/src/components/footer/footer.tsx +0 -6
- package/src/components/footer/index.ts +0 -1
- package/src/components/header/header.tsx +0 -49
- package/src/components/item-card/item-card.tsx +0 -6
- package/src/components/nav-bar/index.ts +0 -1
- package/src/components/nav-bar/nav-bar.tsx +0 -6
- package/src/components/scaffold/scaffold.tsx +0 -15
- package/src/index.css +0 -1
- package/src/types/components/footer/footer.ts +0 -9
- package/src/types/components/header/header.ts +0 -21
- package/src/types/components/nav-bar/nav-bar.ts +0 -9
- package/src/types/context/emperor-ui.ts +0 -37
- package/tailwind.config.js +0 -6
- /package/src/components/{filter → molecules/filter}/index.ts +0 -0
- /package/src/components/{item-card → molecules/item-card}/index.ts +0 -0
- /package/src/components/{scaffold → molecules/scaffold}/index.ts +0 -0
- /package/src/components/{header → organisms/header}/index.ts +0 -0
- /package/src/components/{item-details → organisms/item-details}/index.ts +0 -0
- /package/src/components/{listings → organisms/listings}/index.ts +0 -0
- /package/src/types/components/{filter → molecules/filter}/index.ts +0 -0
- /package/src/types/components/{footer → molecules/footer}/index.ts +0 -0
- /package/src/types/components/{header → molecules/header}/index.ts +0 -0
- /package/src/types/components/{item-card → molecules/item-card}/index.ts +0 -0
- /package/src/types/components/{item-details → molecules/item-details}/index.ts +0 -0
- /package/src/types/components/{listings → molecules/listings}/index.ts +0 -0
- /package/src/types/components/{nav-bar → molecules/nav-bar}/index.ts +0 -0
- /package/src/types/components/{scaffold → molecules/scaffold}/index.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SideBarItemStylesProps } from "@/types";
|
|
2
|
+
import { CSSProperties } from "react";
|
|
3
|
+
|
|
4
|
+
export const sideBarItemStyles = ({
|
|
5
|
+
foregroundColor,
|
|
6
|
+
primaryColor,
|
|
7
|
+
isHovered,
|
|
8
|
+
}: SideBarItemStylesProps): CSSProperties => {
|
|
9
|
+
return {
|
|
10
|
+
color: isHovered ? foregroundColor : "inherit",
|
|
11
|
+
backgroundColor: isHovered ? primaryColor : "transparent",
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from "@heroui/react";
|
|
2
|
+
import { FooterProps } from "@/types";
|
|
3
|
+
import { copyRightsClasses } from "./styles";
|
|
4
|
+
|
|
5
|
+
export function CopyRightsBox({ copyRights, classNames }: FooterProps) {
|
|
6
|
+
return (
|
|
7
|
+
<section
|
|
8
|
+
data-slot="emperor-footer-policies"
|
|
9
|
+
className={cn(
|
|
10
|
+
copyRightsClasses({
|
|
11
|
+
className: cn(classNames?.copyRightsWrapper),
|
|
12
|
+
}),
|
|
13
|
+
)}
|
|
14
|
+
>
|
|
15
|
+
<p
|
|
16
|
+
className={cn(
|
|
17
|
+
"flex items-center gap-1 text-sm text-gray-400 text-center",
|
|
18
|
+
classNames?.copyRightsText,
|
|
19
|
+
)}
|
|
20
|
+
>
|
|
21
|
+
<span>©</span>
|
|
22
|
+
<span>{copyRights?.year}</span>
|
|
23
|
+
<span>{copyRights?.text}</span>
|
|
24
|
+
</p>
|
|
25
|
+
</section>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { FooterProps } from "@/types";
|
|
2
|
+
import { cn } from "@/utils";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import { ComponentProps, forwardRef } from "react";
|
|
5
|
+
import { contentClasses, footerClasses, footerStyles } from "./styles";
|
|
6
|
+
import {
|
|
7
|
+
PoliciesBox,
|
|
8
|
+
QuickLinksBox,
|
|
9
|
+
SocialLinksBox,
|
|
10
|
+
CopyRightsBox,
|
|
11
|
+
} from "@/components";
|
|
12
|
+
import { Divider } from "@heroui/react";
|
|
13
|
+
|
|
14
|
+
export const Footer = forwardRef<
|
|
15
|
+
HTMLElement,
|
|
16
|
+
ComponentProps<"footer"> & VariantProps<typeof footerClasses> & FooterProps
|
|
17
|
+
>(
|
|
18
|
+
(
|
|
19
|
+
{
|
|
20
|
+
className,
|
|
21
|
+
classNames,
|
|
22
|
+
policies,
|
|
23
|
+
copyRights,
|
|
24
|
+
socialLinks,
|
|
25
|
+
contacts,
|
|
26
|
+
quickLinks,
|
|
27
|
+
variant = "default",
|
|
28
|
+
children,
|
|
29
|
+
...props
|
|
30
|
+
},
|
|
31
|
+
ref,
|
|
32
|
+
) => {
|
|
33
|
+
return (
|
|
34
|
+
<footer
|
|
35
|
+
ref={ref}
|
|
36
|
+
data-slot="emperor-footer"
|
|
37
|
+
className={cn(
|
|
38
|
+
footerClasses({
|
|
39
|
+
variant,
|
|
40
|
+
className: cn(className, classNames?.base),
|
|
41
|
+
}),
|
|
42
|
+
)}
|
|
43
|
+
style={footerStyles({})}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
data-slot="emperor-footer-content"
|
|
48
|
+
className={cn(
|
|
49
|
+
contentClasses({
|
|
50
|
+
className: cn(className, classNames?.content),
|
|
51
|
+
}),
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<QuickLinksBox quickLinks={quickLinks} classNames={classNames} />
|
|
58
|
+
|
|
59
|
+
<Divider className="col-span-full bg-background/30" />
|
|
60
|
+
|
|
61
|
+
<div
|
|
62
|
+
className={cn(
|
|
63
|
+
"col-span-full flex flex-col gap-4 justify-between items-center w-full",
|
|
64
|
+
"md:flex-row",
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
<SocialLinksBox socialLinks={socialLinks} classNames={classNames} />
|
|
68
|
+
<PoliciesBox policies={policies} classNames={classNames} />
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<CopyRightsBox copyRights={copyRights} classNames={classNames} />
|
|
72
|
+
</footer>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn, Link } from "@heroui/react";
|
|
2
|
+
import { FooterProps } from "@/types";
|
|
3
|
+
import { policiesClasses } from "./styles";
|
|
4
|
+
|
|
5
|
+
export function PoliciesBox({ policies, classNames }: FooterProps) {
|
|
6
|
+
return (
|
|
7
|
+
<section
|
|
8
|
+
data-slot="emperor-footer-policies"
|
|
9
|
+
className={cn(
|
|
10
|
+
policiesClasses({
|
|
11
|
+
className: cn(classNames?.policiesWrapper),
|
|
12
|
+
}),
|
|
13
|
+
)}
|
|
14
|
+
>
|
|
15
|
+
{policies?.map((policy) => (
|
|
16
|
+
<Link
|
|
17
|
+
key={policy.href}
|
|
18
|
+
href={policy.href}
|
|
19
|
+
className={cn(classNames?.policy)}
|
|
20
|
+
>
|
|
21
|
+
{policy.label}
|
|
22
|
+
</Link>
|
|
23
|
+
))}
|
|
24
|
+
</section>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cn, Link } from "@heroui/react";
|
|
2
|
+
import { FooterProps } from "@/types";
|
|
3
|
+
import { quickLinksClasses } from "./styles";
|
|
4
|
+
|
|
5
|
+
export function QuickLinksBox({ quickLinks, classNames }: FooterProps) {
|
|
6
|
+
return (
|
|
7
|
+
<section
|
|
8
|
+
data-slot="emperor-footer-quick-links"
|
|
9
|
+
className={cn(
|
|
10
|
+
quickLinksClasses({
|
|
11
|
+
className: cn(classNames?.quickLinksWrapper),
|
|
12
|
+
}),
|
|
13
|
+
)}
|
|
14
|
+
>
|
|
15
|
+
{quickLinks?.map(({ links, title }) => (
|
|
16
|
+
<div
|
|
17
|
+
key={title}
|
|
18
|
+
className={cn("flex flex-col gap-4", classNames?.quickLinksItem)}
|
|
19
|
+
>
|
|
20
|
+
<h3
|
|
21
|
+
className={cn("text-lg font-semibold", classNames?.quickLinksTitle)}
|
|
22
|
+
>
|
|
23
|
+
{title}
|
|
24
|
+
</h3>
|
|
25
|
+
|
|
26
|
+
<ul className={cn("flex flex-col gap-2", classNames?.quickLinksList)}>
|
|
27
|
+
{links?.map(({ href, label, isExternal }) => (
|
|
28
|
+
<Link
|
|
29
|
+
key={href}
|
|
30
|
+
href={href}
|
|
31
|
+
target={isExternal ? "_blank" : "_self"}
|
|
32
|
+
className={cn(
|
|
33
|
+
" text-gray-400 hover:text-white transition-all duration-300 ease-in-out",
|
|
34
|
+
classNames?.quickLinksLink,
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
{label}
|
|
38
|
+
</Link>
|
|
39
|
+
))}
|
|
40
|
+
</ul>
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</section>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cn, Link } from "@heroui/react";
|
|
2
|
+
import { FooterProps } from "@/types";
|
|
3
|
+
import { socialLinksClasses } from "./styles";
|
|
4
|
+
|
|
5
|
+
export function SocialLinksBox({ socialLinks, classNames }: FooterProps) {
|
|
6
|
+
return (
|
|
7
|
+
<section
|
|
8
|
+
data-slot="emperor-footer-social-links"
|
|
9
|
+
className={cn(
|
|
10
|
+
socialLinksClasses({
|
|
11
|
+
className: cn(classNames?.socialLinksWrapper),
|
|
12
|
+
}),
|
|
13
|
+
)}
|
|
14
|
+
>
|
|
15
|
+
{socialLinks?.map(({ href, icon, label }) => (
|
|
16
|
+
<Link
|
|
17
|
+
key={href}
|
|
18
|
+
href={href}
|
|
19
|
+
className={cn(
|
|
20
|
+
"flex items-center gap-2 text-sm text-gray-400 hover:text-white transition-all duration-300 ease-in-out",
|
|
21
|
+
classNames?.socialLink,
|
|
22
|
+
)}
|
|
23
|
+
target="_blank"
|
|
24
|
+
rel="noopener noreferrer"
|
|
25
|
+
>
|
|
26
|
+
{icon}
|
|
27
|
+
{label}
|
|
28
|
+
</Link>
|
|
29
|
+
))}
|
|
30
|
+
</section>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Brand, Footer } from "@/components";
|
|
3
|
+
import { getStorybookDecorators } from "@/utils";
|
|
4
|
+
import { FooterProps } from "@/types";
|
|
5
|
+
import {
|
|
6
|
+
FAKE_PARAGRAPH,
|
|
7
|
+
FAKE_SENTENCE,
|
|
8
|
+
quickLinks,
|
|
9
|
+
policies,
|
|
10
|
+
copyRights,
|
|
11
|
+
contacts,
|
|
12
|
+
socialLinks,
|
|
13
|
+
} from "@/constants";
|
|
14
|
+
import { Button } from "@heroui/react";
|
|
15
|
+
|
|
16
|
+
const meta: Meta<typeof Footer> = {
|
|
17
|
+
title: "Organisms/Footer",
|
|
18
|
+
component: Footer,
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: "fullscreen",
|
|
21
|
+
},
|
|
22
|
+
tags: ["autodocs"],
|
|
23
|
+
decorators: getStorybookDecorators({}),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
quickLinks,
|
|
33
|
+
policies,
|
|
34
|
+
copyRights,
|
|
35
|
+
contacts,
|
|
36
|
+
socialLinks,
|
|
37
|
+
},
|
|
38
|
+
render: (args: FooterProps) => {
|
|
39
|
+
return (
|
|
40
|
+
<div className="flex flex-col gap-6">
|
|
41
|
+
<main className="w-full container mx-auto p-5 flex flex-col gap-6">
|
|
42
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
43
|
+
</main>
|
|
44
|
+
|
|
45
|
+
<Footer
|
|
46
|
+
classNames={{
|
|
47
|
+
content: "p-5 gap-8 items-center md:items-start",
|
|
48
|
+
}}
|
|
49
|
+
{...args}
|
|
50
|
+
>
|
|
51
|
+
<Brand />
|
|
52
|
+
<p className="text-center md:text-left">{FAKE_SENTENCE}</p>
|
|
53
|
+
|
|
54
|
+
<Button color="primary" className="w-fit">
|
|
55
|
+
Join now
|
|
56
|
+
</Button>
|
|
57
|
+
</Footer>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
export const footerClasses = cva(
|
|
4
|
+
[
|
|
5
|
+
"w-full grid md:grid-cols-[1fr_2fr] gap-4 p-5 min-h-80",
|
|
6
|
+
"bg-foreground text-background",
|
|
7
|
+
],
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: [],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {},
|
|
15
|
+
compoundVariants: [],
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const contentClasses = cva(["flex flex-col gap-4"], {
|
|
20
|
+
variants: {},
|
|
21
|
+
defaultVariants: {},
|
|
22
|
+
compoundVariants: [],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const policiesClasses = cva(
|
|
26
|
+
[
|
|
27
|
+
"col-span-full w-fit flex flex-col items-center gap-4 p-5 text-center",
|
|
28
|
+
"md:flex-row",
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
variants: {},
|
|
32
|
+
defaultVariants: {},
|
|
33
|
+
compoundVariants: [],
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const socialLinksClasses = cva(
|
|
38
|
+
["w-fit flex p-5 gap-4 items-center flex-wrap"],
|
|
39
|
+
{
|
|
40
|
+
variants: {},
|
|
41
|
+
defaultVariants: {},
|
|
42
|
+
compoundVariants: [],
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export const copyRightsClasses = cva(
|
|
47
|
+
["col-span-full w-fit flex p-2 mx-auto text-center"],
|
|
48
|
+
{
|
|
49
|
+
variants: {},
|
|
50
|
+
defaultVariants: {},
|
|
51
|
+
compoundVariants: [],
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const contactsClasses = cva([""], {
|
|
56
|
+
variants: {},
|
|
57
|
+
defaultVariants: {},
|
|
58
|
+
compoundVariants: [],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const quickLinksClasses = cva(
|
|
62
|
+
[
|
|
63
|
+
"grid gap-4 p-5 w-fit mx-auto",
|
|
64
|
+
"sm:w-full sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
|
|
65
|
+
],
|
|
66
|
+
{
|
|
67
|
+
variants: {},
|
|
68
|
+
defaultVariants: {},
|
|
69
|
+
compoundVariants: [],
|
|
70
|
+
},
|
|
71
|
+
);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useEmperorUI } from "@/hooks";
|
|
2
|
+
import type { HeaderProps, NavBarHoverEffect, NavBarVariant } from "@/types";
|
|
3
|
+
import { cn } from "@/utils";
|
|
4
|
+
import { VariantProps } from "class-variance-authority";
|
|
5
|
+
import { ComponentProps, forwardRef } from "react";
|
|
6
|
+
import { Brand, NavBar, SideBar } from "@/components";
|
|
7
|
+
import { headerClasses, headerStyles } from "./styles";
|
|
8
|
+
import { useDisclosure } from "@heroui/react";
|
|
9
|
+
import { MOCK_HEADER_ITEMS, MOCK_HEADER_ACTIONS } from "@/mocks";
|
|
10
|
+
import { SegmentedHeaderContent } from "./segmented-header-content";
|
|
11
|
+
|
|
12
|
+
export const Header = forwardRef<
|
|
13
|
+
HTMLElement,
|
|
14
|
+
ComponentProps<"header"> & VariantProps<typeof headerClasses> & HeaderProps
|
|
15
|
+
>(
|
|
16
|
+
(
|
|
17
|
+
{ className, variant = "default", glassEffect, children, ...props },
|
|
18
|
+
ref,
|
|
19
|
+
) => {
|
|
20
|
+
const { config } = useEmperorUI();
|
|
21
|
+
const { isOpen, onOpenChange } = useDisclosure();
|
|
22
|
+
|
|
23
|
+
const primaryColor = config?.theme?.colors?.primary;
|
|
24
|
+
const foregroundColor = config?.theme?.colors?.foreground;
|
|
25
|
+
|
|
26
|
+
const content = children || (
|
|
27
|
+
<>
|
|
28
|
+
<SideBar
|
|
29
|
+
items={MOCK_HEADER_ITEMS}
|
|
30
|
+
actions={MOCK_HEADER_ACTIONS}
|
|
31
|
+
isOpen={isOpen}
|
|
32
|
+
onOpenChange={onOpenChange}
|
|
33
|
+
header={<Brand className="text-white" />}
|
|
34
|
+
triggerProps={{
|
|
35
|
+
startContent: (
|
|
36
|
+
<Brand
|
|
37
|
+
className="text-white"
|
|
38
|
+
classNames={{
|
|
39
|
+
logo: "size-6",
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
isIconOnly: false,
|
|
44
|
+
variant: "light",
|
|
45
|
+
}}
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<NavBar
|
|
49
|
+
className="hidden md:flex mx-auto"
|
|
50
|
+
items={MOCK_HEADER_ITEMS}
|
|
51
|
+
hoverEffect={
|
|
52
|
+
{
|
|
53
|
+
default: "default",
|
|
54
|
+
floating: "underline",
|
|
55
|
+
light: "underline",
|
|
56
|
+
"segmented-floating": "default",
|
|
57
|
+
}[variant] as NavBarHoverEffect
|
|
58
|
+
}
|
|
59
|
+
variant={
|
|
60
|
+
{
|
|
61
|
+
default: "default",
|
|
62
|
+
floating: "default",
|
|
63
|
+
light: "default",
|
|
64
|
+
"segmented-floating": "default",
|
|
65
|
+
}[variant] as NavBarVariant
|
|
66
|
+
}
|
|
67
|
+
/>
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<header
|
|
73
|
+
ref={ref}
|
|
74
|
+
data-slot="emperor-header"
|
|
75
|
+
className={cn(headerClasses({ variant, className }))}
|
|
76
|
+
style={headerStyles({
|
|
77
|
+
primaryColor,
|
|
78
|
+
foregroundColor,
|
|
79
|
+
variant,
|
|
80
|
+
glassEffect,
|
|
81
|
+
})}
|
|
82
|
+
{...props}
|
|
83
|
+
>
|
|
84
|
+
{variant === "segmented-floating" ? (
|
|
85
|
+
<SegmentedHeaderContent glassEffect={glassEffect}>
|
|
86
|
+
{content}
|
|
87
|
+
</SegmentedHeaderContent>
|
|
88
|
+
) : (
|
|
89
|
+
content
|
|
90
|
+
)}
|
|
91
|
+
</header>
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SegmentedHeaderContentProps } from "@/types";
|
|
2
|
+
import { Children } from "react";
|
|
3
|
+
import { Row } from "@/components";
|
|
4
|
+
import { useEmperorUI } from "@/hooks";
|
|
5
|
+
import { getGlassEffectStyles } from "./styles/styles";
|
|
6
|
+
|
|
7
|
+
export const SegmentedHeaderContent = ({
|
|
8
|
+
children,
|
|
9
|
+
glassEffect,
|
|
10
|
+
}: SegmentedHeaderContentProps) => {
|
|
11
|
+
const { config } = useEmperorUI();
|
|
12
|
+
|
|
13
|
+
const primaryColor = config?.theme?.colors?.primary;
|
|
14
|
+
const foregroundColor = config?.theme?.colors?.foreground;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Row className="w-full min-h-12 justify-between">
|
|
18
|
+
{Children.toArray(children).map((child, index) => (
|
|
19
|
+
<Row
|
|
20
|
+
className="rounded-full min-h-12 px-5"
|
|
21
|
+
key={index}
|
|
22
|
+
style={{
|
|
23
|
+
backgroundColor: primaryColor,
|
|
24
|
+
color: foregroundColor,
|
|
25
|
+
...(glassEffect
|
|
26
|
+
? getGlassEffectStyles({
|
|
27
|
+
glassEffect,
|
|
28
|
+
})
|
|
29
|
+
: {}),
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
{child}
|
|
33
|
+
</Row>
|
|
34
|
+
))}
|
|
35
|
+
</Row>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { Brand, Header, NavBar } from "@/components";
|
|
3
|
+
import { getStorybookDecorators } from "@/utils";
|
|
4
|
+
import { FAKE_PARAGRAPH } from "@/constants";
|
|
5
|
+
import { MOCK_HEADER_ITEMS } from "@/mocks";
|
|
6
|
+
import { HeaderProps } from "@/types";
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Header> = {
|
|
9
|
+
title: "Organisms/Header",
|
|
10
|
+
component: Header,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: "fullscreen",
|
|
13
|
+
},
|
|
14
|
+
tags: ["autodocs"],
|
|
15
|
+
decorators: getStorybookDecorators({}),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
|
|
22
|
+
const GLASS_EFFECT_CONFIG = {
|
|
23
|
+
enabled: true,
|
|
24
|
+
blur: 10,
|
|
25
|
+
backgroundColor: "#006fed",
|
|
26
|
+
foregroundColor: "#fff",
|
|
27
|
+
opacity: 40,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
args: {},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Floating: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
variant: "floating",
|
|
37
|
+
},
|
|
38
|
+
render: (args: HeaderProps) => {
|
|
39
|
+
return (
|
|
40
|
+
<div>
|
|
41
|
+
<Header {...args} />
|
|
42
|
+
|
|
43
|
+
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
44
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
45
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
46
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
47
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
48
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
49
|
+
</main>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Light: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
variant: "light",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const WithGlassEffect: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
variant: "floating",
|
|
64
|
+
glassEffect: GLASS_EFFECT_CONFIG,
|
|
65
|
+
},
|
|
66
|
+
render: (args) => {
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<Header {...args} />
|
|
70
|
+
|
|
71
|
+
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
72
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
73
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
74
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
75
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
76
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
77
|
+
</main>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const SegmentedFloating: Story = {
|
|
84
|
+
args: {
|
|
85
|
+
variant: "segmented-floating",
|
|
86
|
+
},
|
|
87
|
+
render: (args) => {
|
|
88
|
+
return (
|
|
89
|
+
<div>
|
|
90
|
+
<Header {...args}>
|
|
91
|
+
<Brand />
|
|
92
|
+
|
|
93
|
+
<NavBar
|
|
94
|
+
items={MOCK_HEADER_ITEMS}
|
|
95
|
+
hoverEffect="none"
|
|
96
|
+
variant="default"
|
|
97
|
+
className="hidden md:flex"
|
|
98
|
+
subItemsColumns={4}
|
|
99
|
+
/>
|
|
100
|
+
</Header>
|
|
101
|
+
|
|
102
|
+
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
103
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
104
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
105
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
106
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
107
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
108
|
+
</main>
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const SegmentedFloatingWithGlassEffect: Story = {
|
|
115
|
+
args: {
|
|
116
|
+
variant: "segmented-floating",
|
|
117
|
+
glassEffect: GLASS_EFFECT_CONFIG,
|
|
118
|
+
},
|
|
119
|
+
render: (args) => {
|
|
120
|
+
return (
|
|
121
|
+
<div>
|
|
122
|
+
<Header {...args}>
|
|
123
|
+
<Brand />
|
|
124
|
+
|
|
125
|
+
<NavBar
|
|
126
|
+
items={MOCK_HEADER_ITEMS}
|
|
127
|
+
hoverEffect="none"
|
|
128
|
+
variant="default"
|
|
129
|
+
className="hidden md:flex"
|
|
130
|
+
subItemsColumns={4}
|
|
131
|
+
/>
|
|
132
|
+
</Header>
|
|
133
|
+
|
|
134
|
+
<main className="w-full container mx-auto p-5 pt-24 flex flex-col gap-6">
|
|
135
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
136
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
137
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
138
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
139
|
+
<p>{FAKE_PARAGRAPH}</p>
|
|
140
|
+
</main>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
},
|
|
144
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
export const headerClasses = cva(
|
|
4
|
+
["flex min-h-16 items-center justify-between gap-4 px-6 w-full"],
|
|
5
|
+
{
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: ["flex-nowrap w-full"],
|
|
9
|
+
floating: [
|
|
10
|
+
"fixed min-h-14 w-[90vw] rounded-full shadow-lg",
|
|
11
|
+
"top-3 left-1/2 -translate-x-1/2 z-10",
|
|
12
|
+
],
|
|
13
|
+
light: [],
|
|
14
|
+
"segmented-floating": [
|
|
15
|
+
"fixed min-h-12 w-[90vw] top-3 left-1/2 -translate-x-1/2 z-10",
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {},
|
|
20
|
+
compoundVariants: [],
|
|
21
|
+
},
|
|
22
|
+
);
|