@rizom/ui 0.2.0-alpha.36
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/README.md +26 -0
- package/package.json +50 -0
- package/src/Badge.tsx +14 -0
- package/src/Button.tsx +56 -0
- package/src/Divider.tsx +12 -0
- package/src/Footer.tsx +70 -0
- package/src/Header.tsx +38 -0
- package/src/ProductCard.tsx +170 -0
- package/src/ProductIllustration.tsx +689 -0
- package/src/Section.tsx +22 -0
- package/src/SideNav.tsx +22 -0
- package/src/cn.ts +35 -0
- package/src/frame.tsx +26 -0
- package/src/highlighted-text.tsx +45 -0
- package/src/index.ts +33 -0
- package/src/types.ts +29 -0
package/src/Section.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX, ComponentChildren } from "preact";
|
|
2
|
+
import { cn } from "./cn";
|
|
3
|
+
|
|
4
|
+
export interface SectionProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: ComponentChildren;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const GUTTER = "px-6 md:px-10 xl:px-20";
|
|
11
|
+
|
|
12
|
+
const BASE = `${GUTTER} relative z-[1]`;
|
|
13
|
+
|
|
14
|
+
export const Section = ({
|
|
15
|
+
id,
|
|
16
|
+
className,
|
|
17
|
+
children,
|
|
18
|
+
}: SectionProps): JSX.Element => (
|
|
19
|
+
<section id={id} className={cn(BASE, className)}>
|
|
20
|
+
{children}
|
|
21
|
+
</section>
|
|
22
|
+
);
|
package/src/SideNav.tsx
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JSX } from "preact";
|
|
2
|
+
import type { RizomSideNavItem } from "./types";
|
|
3
|
+
|
|
4
|
+
interface SideNavProps {
|
|
5
|
+
items: RizomSideNavItem[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const SideNav = ({ items }: SideNavProps): JSX.Element => (
|
|
9
|
+
<aside
|
|
10
|
+
aria-hidden="true"
|
|
11
|
+
className="fixed right-8 top-1/2 z-[90] hidden -translate-y-1/2 flex-col gap-[18px] px-2 py-4 xl:flex"
|
|
12
|
+
>
|
|
13
|
+
{items.map((dot) => (
|
|
14
|
+
<a
|
|
15
|
+
key={dot.href}
|
|
16
|
+
href={dot.href}
|
|
17
|
+
className="side-nav-dot"
|
|
18
|
+
data-label={dot.label}
|
|
19
|
+
/>
|
|
20
|
+
))}
|
|
21
|
+
</aside>
|
|
22
|
+
);
|
package/src/cn.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { clsx, type ClassValue } from "clsx";
|
|
2
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
const twMerge = extendTailwindMerge({
|
|
5
|
+
extend: {
|
|
6
|
+
classGroups: {
|
|
7
|
+
"font-size": [
|
|
8
|
+
{
|
|
9
|
+
text: [
|
|
10
|
+
"display-2xl",
|
|
11
|
+
"display-xl",
|
|
12
|
+
"display-lg",
|
|
13
|
+
"display-md",
|
|
14
|
+
"display-sm",
|
|
15
|
+
"heading-lg",
|
|
16
|
+
"heading-md",
|
|
17
|
+
"heading-sm",
|
|
18
|
+
"body-xl",
|
|
19
|
+
"body-lg",
|
|
20
|
+
"body-md",
|
|
21
|
+
"body-sm",
|
|
22
|
+
"body-xs",
|
|
23
|
+
"label-md",
|
|
24
|
+
"label-sm",
|
|
25
|
+
"label-xs",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export function cn(...inputs: ClassValue[]): string {
|
|
34
|
+
return twMerge(clsx(inputs));
|
|
35
|
+
}
|
package/src/frame.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { JSX, ComponentChildren } from "preact";
|
|
2
|
+
|
|
3
|
+
export interface RizomFrameProps {
|
|
4
|
+
children?: ComponentChildren;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Shared Rizom page frame.
|
|
9
|
+
*
|
|
10
|
+
* Owns only the full-page canvas background and the centered page
|
|
11
|
+
* container. Wrapper sites own their actual chrome/layout composition.
|
|
12
|
+
*/
|
|
13
|
+
export const RizomFrame = ({ children }: RizomFrameProps): JSX.Element => (
|
|
14
|
+
<>
|
|
15
|
+
<div
|
|
16
|
+
id="bgCanvasWrap"
|
|
17
|
+
className="rizom-frame-canvas-wrap fixed top-0 left-0 w-full h-full pointer-events-none"
|
|
18
|
+
>
|
|
19
|
+
<canvas id="heroCanvas" className="w-full h-full block" />
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div className="max-w-[1440px] mx-auto relative overflow-x-clip">
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Fragment, type JSX } from "preact";
|
|
2
|
+
|
|
3
|
+
const EMPHASIS_PATTERN = /(\*[^*]+\*)/;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Render a content string with two lightweight markup conventions:
|
|
7
|
+
*
|
|
8
|
+
* - `\n` in the string produces a `<br />` (for multi-line headlines)
|
|
9
|
+
* - Any `*...*` run is wrapped in a `<span>` carrying `highlightClass`
|
|
10
|
+
*
|
|
11
|
+
* Authors write the phrase as one natural string in markdown content;
|
|
12
|
+
* the renderer does the structural split. Highlight styling is passed
|
|
13
|
+
* per-brand (rizom.ai uses accent+midline, rizom.work uses
|
|
14
|
+
* italic+accent) so each brand owns its own emphasis treatment while
|
|
15
|
+
* the parsing/structure is shared.
|
|
16
|
+
*/
|
|
17
|
+
export function renderHighlightedText(
|
|
18
|
+
text: string,
|
|
19
|
+
highlightClass: string,
|
|
20
|
+
): JSX.Element {
|
|
21
|
+
const lines = text.split("\n");
|
|
22
|
+
return (
|
|
23
|
+
<Fragment>
|
|
24
|
+
{lines.map((line, lineIdx) => (
|
|
25
|
+
<Fragment key={lineIdx}>
|
|
26
|
+
{lineIdx > 0 && <br />}
|
|
27
|
+
{line.split(EMPHASIS_PATTERN).map((part, partIdx) => {
|
|
28
|
+
if (
|
|
29
|
+
part.length >= 3 &&
|
|
30
|
+
part.startsWith("*") &&
|
|
31
|
+
part.endsWith("*")
|
|
32
|
+
) {
|
|
33
|
+
return (
|
|
34
|
+
<span key={partIdx} className={highlightClass}>
|
|
35
|
+
{part.slice(1, -1)}
|
|
36
|
+
</span>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return <Fragment key={partIdx}>{part}</Fragment>;
|
|
40
|
+
})}
|
|
41
|
+
</Fragment>
|
|
42
|
+
))}
|
|
43
|
+
</Fragment>
|
|
44
|
+
);
|
|
45
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { Badge } from "./Badge";
|
|
2
|
+
export type { BadgeProps } from "./Badge";
|
|
3
|
+
|
|
4
|
+
export { Button } from "./Button";
|
|
5
|
+
export type { ButtonProps, ButtonSize, ButtonVariant } from "./Button";
|
|
6
|
+
|
|
7
|
+
export { Divider } from "./Divider";
|
|
8
|
+
export type { DividerProps } from "./Divider";
|
|
9
|
+
|
|
10
|
+
export { Footer } from "./Footer";
|
|
11
|
+
|
|
12
|
+
export { Header } from "./Header";
|
|
13
|
+
|
|
14
|
+
export { ProductCard } from "./ProductCard";
|
|
15
|
+
|
|
16
|
+
export { RizomFrame } from "./frame";
|
|
17
|
+
export type { RizomFrameProps } from "./frame";
|
|
18
|
+
|
|
19
|
+
export { Section, GUTTER } from "./Section";
|
|
20
|
+
export type { SectionProps } from "./Section";
|
|
21
|
+
|
|
22
|
+
export { SideNav } from "./SideNav";
|
|
23
|
+
|
|
24
|
+
export { renderHighlightedText } from "./highlighted-text";
|
|
25
|
+
|
|
26
|
+
export type {
|
|
27
|
+
ProductCardContent,
|
|
28
|
+
ProductVariant,
|
|
29
|
+
RizomBrandSuffix,
|
|
30
|
+
RizomFooterTagline,
|
|
31
|
+
RizomLink,
|
|
32
|
+
RizomSideNavItem,
|
|
33
|
+
} from "./types";
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type RizomBrandSuffix = "ai" | "foundation" | "work";
|
|
2
|
+
|
|
3
|
+
export interface RizomLink {
|
|
4
|
+
href: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface RizomSideNavItem {
|
|
9
|
+
href: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface RizomFooterTagline {
|
|
14
|
+
prefix?: string;
|
|
15
|
+
link: RizomLink;
|
|
16
|
+
suffix?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ProductVariant = "rover" | "relay" | "ranger";
|
|
20
|
+
|
|
21
|
+
export interface ProductCardContent {
|
|
22
|
+
variant: ProductVariant;
|
|
23
|
+
label: string;
|
|
24
|
+
badge: string;
|
|
25
|
+
headline: string;
|
|
26
|
+
description: string;
|
|
27
|
+
tagline?: string[];
|
|
28
|
+
tags: string[];
|
|
29
|
+
}
|