Skip to content

Commit fe679da

Browse files
committed
chore: misc fixes & fix decorators
1 parent 371ece7 commit fe679da

28 files changed

+110
-128
lines changed

apps/docs/src/components/Header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Suspense } from "react";
2+
13
import { ComponentDataParams, getComponentData } from "../utils/component";
24
import { PlaygroundProps } from "./code/Playground";
35
import { Description } from "./usage/Description";
@@ -17,7 +19,9 @@ export async function Header({ params, ...playgroundProps }: HeaderProps) {
1719
return (
1820
<div>
1921
<Description meta={meta} />
20-
<Tabs meta={meta} playgroundProps={{ ...playgroundProps, meta }} />
22+
<Suspense fallback={null}>
23+
<Tabs meta={meta} playgroundProps={{ ...playgroundProps, meta }} />
24+
</Suspense>
2125
</div>
2226
);
2327
}

apps/docs/src/components/code/Playground.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface PlaygroundProps {
1515
meta?: ComponentMeta;
1616
controls: Record<string, Control>;
1717
children?: React.ReactNode;
18-
decorator?: (children: React.ReactNode) => React.ReactNode;
18+
decoratorClassName?: string;
1919
}
2020

2121
const parseChildren = (child: React.ReactNode) =>
@@ -66,7 +66,7 @@ export const Playground = ({
6666
componentProps,
6767
controls = {},
6868
children,
69-
decorator,
69+
decoratorClassName,
7070
}: PlaygroundProps) => {
7171
// Initialize dynamic props with default values from controls
7272
const [dynamicProps, setDynamicProps] = useState<Record<string, unknown>>(
@@ -109,7 +109,11 @@ export const Playground = ({
109109
<div className="grid grid-cols-[2fr_1fr] border rounded-t-round">
110110
{/* Preview Area */}
111111
<DocsProvider className="grid place-items-center p-sm h-full">
112-
{decorator ? decorator(componentElement) : componentElement}
112+
{decoratorClassName ? (
113+
<div className={decoratorClassName}>{componentElement}</div>
114+
) : (
115+
componentElement
116+
)}
113117
</DocsProvider>
114118

115119
{/* Controls Area */}

apps/docs/src/components/home/HeroSection.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useMemo } from "react";
2-
import { ArrowRight } from "@phosphor-icons/react/ArrowRight";
32
import { clsx } from "clsx";
43
import Link from "next/link";
54
import { HvButton } from "@hitachivantara/uikit-react-core";
@@ -81,7 +80,7 @@ export const HeroSection = () => (
8180
variant="subtle"
8281
size="lg"
8382
className="mt-md max-sm:w-full hidden sm:inline-flex"
84-
endIcon={<ArrowRight />}
83+
endIcon={<div className="i-ph-arrow-right" />}
8584
>
8685
Explore components
8786
</HvButton>

apps/docs/src/components/home/Home.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use client";
2-
31
import { CardsSection } from "./CardsSection";
42
import { HeroSection } from "./HeroSection";
53

apps/docs/src/components/home/cards/ApiUsage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { HvLineChart } from "@hitachivantara/uikit-react-viz";
24

35
import { Card } from "./Card";

apps/docs/src/components/home/cards/DataSecurity.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import { HvTag, HvTypography } from "@hitachivantara/uikit-react-core";
2-
import { SystemActivity } from "@hitachivantara/uikit-react-icons";
1+
import {
2+
HvIconContainer,
3+
HvTag,
4+
HvTypography,
5+
} from "@hitachivantara/uikit-react-core";
36

47
import { Card } from "./Card";
58

@@ -14,7 +17,11 @@ export const DataSecurity = () => {
1417
<Card
1518
title="Data Security Overview"
1619
subtitle="Incidents from the last 30 days."
17-
icon={<SystemActivity color="primary" />}
20+
icon={
21+
<HvIconContainer color="primary">
22+
<div className="i-ph-presentation-chart" />
23+
</HvIconContainer>
24+
}
1825
>
1926
<div className="flex gap-xs justify-between">
2027
{securityData.map(({ title, count, color }) => (

apps/docs/src/components/home/cards/FinancialPerformance.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { HvTypography } from "@hitachivantara/uikit-react-core";
2-
import { BottomXS, TopXS } from "@hitachivantara/uikit-react-icons";
32

43
import { Card } from "./Card";
54

@@ -22,10 +21,10 @@ const Item = ({ title, value, percentage, isPositive }: ItemProps) => {
2221

2322
return (
2423
<div>
25-
<div className="flex items-center">
24+
<div className="flex items-center gap-4px">
2625
<HvTypography variant="caption1">{title}</HvTypography>
27-
{isPositive && <TopXS color="positive" />}
28-
{!isPositive && <BottomXS color="negative" />}
26+
{isPositive && <div className="i-ph-arrow-up text-positive" />}
27+
{!isPositive && <div className="i-ph-arrow-down text-negative" />}
2928
<HvTypography className={percentageColor}>{percentage}%</HvTypography>
3029
</div>
3130
<HvTypography variant="title2">{value}</HvTypography>

apps/docs/src/components/home/cards/StorageOverview.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { HvBarChart } from "@hitachivantara/uikit-react-viz";
24

35
import { Card } from "./Card";

apps/docs/src/components/home/cards/TeamOverview.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
HvButton,
44
HvTypography,
55
} from "@hitachivantara/uikit-react-core";
6-
import { Open } from "@hitachivantara/uikit-react-icons";
76

87
import { Card } from "./Card";
98

@@ -50,7 +49,7 @@ export const TeamOverview = () => (
5049
variant="primaryGhost"
5150
aria-label={`View profile of ${name}`}
5251
>
53-
<Open />
52+
<div className="i-ph-arrow-square-out" />
5453
</HvButton>
5554
</div>
5655
))}

apps/docs/src/components/icons.tsx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"use client";
2+
3+
import { HvPanel } from "@hitachivantara/uikit-react-core";
4+
import { Alert, icons } from "@hitachivantara/uikit-react-icons";
5+
6+
import { Playground } from "./code/Playground";
7+
8+
export function IconLibrary() {
9+
return (
10+
<HvPanel className="flex flex-wrap gap-xs justify-around px-xs">
11+
{Object.entries(icons).map(([name, Icon]) => (
12+
<div
13+
key={name}
14+
className="flex flex-col items-center justify-center w-112px"
15+
>
16+
<Icon size="S" />
17+
<code className="text-sm h-2em text-center break-all">{name}</code>
18+
</div>
19+
))}
20+
</HvPanel>
21+
);
22+
}
23+
24+
export function IconPlayground() {
25+
return (
26+
<Playground
27+
Component={Alert}
28+
componentName="Alert"
29+
controls={{
30+
color: { type: "color", defaultValue: "warning" },
31+
size: {
32+
type: "slider",
33+
defaultValue: "md",
34+
values: ["xs", "sm", "md", "lg", "xl"],
35+
},
36+
}}
37+
/>
38+
);
39+
}

apps/docs/src/content/components/blade.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { Header } from "../../components/Header";
2727
},
2828
},
2929
}}
30-
decorator={(component) => <div className="flex w-full">{component}</div>}
30+
decoratorClassName="flex w-full"
3131
>
3232
<div className="p-xs">The answer to all things is 42.</div>
3333
</Header>

apps/docs/src/content/components/blades.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { Header } from "../../components/Header";
1515
atLeastOneExpanded: { defaultValue: false },
1616
fullWidthBlades: { defaultValue: true },
1717
}}
18-
decorator={(component) => <div className="w-full">{component}</div>}
18+
decoratorClassName="w-full"
1919
>
2020
<HvBlade label="1">
2121
<div className="flex items-center p-xs">Content 1</div>

apps/docs/src/content/components/carousel.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Header } from "../../components/Header";
1818
showFullscreen: { defaultValue: true },
1919
controlsPosition: { defaultValue: "top" },
2020
}}
21-
decorator={(children) => <div className="overflow">{children}</div>}
21+
decoratorClassName="overflow"
2222
>
2323
{[...Array(7).keys()].map((i) => (
2424
<HvCarouselSlide

apps/docs/src/content/components/global-actions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { Header } from "../../components/Header";
2626
</HvIconButton>
2727
),
2828
}}
29-
decorator={(component) => <div className="w-full">{component}</div>}
29+
decoratorClassName="w-full"
3030
>
3131
<HvButton variant="primary">Save</HvButton>
3232
<HvButton variant="secondarySubtle">Reset</HvButton>

apps/docs/src/content/components/icon-container.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { User } from "@phosphor-icons/react/User";
21
import {
32
iconContainerClasses as classes,
43
HvIconContainer,
@@ -20,5 +19,5 @@ import { Header } from "../../components/Header";
2019
rotate: { defaultValue: false },
2120
}}
2221
>
23-
<User />
22+
<div className="i-ph-user" />
2423
</Header>

apps/docs/src/content/components/number-input.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ import { Header } from "../../components/Header";
1818
readOnly: { defaultValue: false },
1919
disabled: { defaultValue: false },
2020
}}
21-
decorator={(c) => <div className="w-full">{c}</div>}
21+
decoratorClassName="w-full"
2222
/>
2323

24-
<br />
25-
2624
<Callout type="info">
2725
The `HvNumberInput` component shares the same API as `HvInput`. For full
2826
documentation, see the [HvInput component page](/components/input).

apps/docs/src/content/components/overflow-tooltip.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ import { Header } from "../../components/Header";
2424
"This is a very long text that should be cut because it so long that it doesn't fit",
2525
},
2626
}}
27-
decorator={(children) => <div className="max-w-160px">{children}</div>}
27+
decoratorClassName="max-w-160px"
2828
/>

apps/docs/src/content/components/query-builder.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { Header } from "../../components/Header";
3030
},
3131
},
3232
}}
33-
decorator={(component) => <div className="w-full">{component}</div>}
33+
decoratorClassName="w-full"
3434
/>
3535

3636
### How to use

apps/docs/src/content/components/search-input.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ import {
66

77
import { Header } from "../../components/Header";
88

9-
<Callout type="info">
10-
The `HvSearchInput` component shares the same API as the `HvInput` component.
11-
Please check the [HvInput component page](/components/input) for
12-
documentation.
13-
</Callout>
14-
159
<Header
1610
params={{ name: "SearchInput", classes }}
1711
Component={HvSearchInput}
@@ -24,5 +18,11 @@ import { Header } from "../../components/Header";
2418
readOnly: { defaultValue: false },
2519
disabled: { defaultValue: false },
2620
}}
27-
decorator={(c) => <div className="w-full">{c}</div>}
21+
decoratorClassName="w-full"
2822
/>
23+
24+
<Callout type="info">
25+
The `HvSearchInput` component shares the same API as the `HvInput` component.
26+
Please check the [HvInput component page](/components/input) for
27+
documentation.
28+
</Callout>

apps/docs/src/content/components/skeleton.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Header } from "../../components/Header";
2020
defaultValue: false,
2121
},
2222
}}
23-
decorator={(children) => <div className="w-190px">{children}</div>}
23+
decoratorClassName="w-190px"
2424
children={<div>My skeleton example content</div>}
2525
/>
2626

apps/docs/src/content/components/step-navigation.mdx

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,9 @@ import { Header } from "../../components/Header";
1616
}}
1717
componentProps={{
1818
steps: [
19-
{
20-
title: "Completed",
21-
state: "Completed",
22-
onClick: () => {
23-
alert("You clicked on 'Completed' step");
24-
},
25-
},
26-
{
27-
title: "Failed",
28-
state: "Failed",
29-
onClick: () => {
30-
alert("You clicked on 'Failed' step");
31-
},
32-
},
33-
{
34-
title: "Pending",
35-
state: "Pending",
36-
onClick: () => {
37-
alert("You clicked on 'Pending' step");
38-
},
39-
},
19+
{ title: "Completed", state: "Completed" },
20+
{ title: "Failed", state: "Failed" },
21+
{ title: "Pending", state: "Pending" },
4022
],
4123
}}
4224
/>
@@ -51,53 +33,29 @@ You can use the `width` prop to pass an array of custom breakpoints for the step
5133
{
5234
title: "Completed",
5335
state: "Completed",
54-
onClick: () => {
55-
alert("You clicked on 'Completed' step");
56-
},
5736
},
5837
{
5938
title: "Failed",
6039
state: "Failed",
61-
onClick: () => {
62-
alert("You clicked on 'Failed' step");
63-
},
6440
},
6541
{
6642
title: "Pending",
6743
state: "Pending",
68-
onClick: () => {
69-
alert("You clicked on 'Pending' step");
70-
},
7144
},
7245
{
7346
title: "Current",
7447
state: "Current",
75-
onClick: () => {
76-
alert("You clicked on 'Current' step");
77-
},
7848
},
7949
{
8050
title: "Enabled",
8151
state: "Enabled",
82-
onClick: () => {
83-
alert("You clicked on 'Enabled' step");
84-
},
8552
},
8653
{
8754
title: "Disabled",
8855
state: "Disabled",
89-
onClick: () => {
90-
alert("You clicked on 'Disabled' step");
91-
},
9256
},
9357
]}
94-
width={{
95-
xs: 200,
96-
sm: 400,
97-
md: 600,
98-
lg: 800,
99-
xl: 1000,
100-
}}
58+
width={{ xs: 200, sm: 400, md: 600, lg: 800, xl: 1000 }}
10159
/>
10260
```
10361

apps/docs/src/content/components/tree-view.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Header } from "../../components/Header";
1616
multiSelect: { defaultValue: false },
1717
disableSelection: { defaultValue: false },
1818
}}
19-
decorator={(children) => <HvPanel className="w-300px">{children}</HvPanel>}
19+
decoratorClassName="w-300px"
2020
>
2121
<HvTreeItem nodeId="1" label="Applications">
2222
<HvTreeItem nodeId="10" label="Calendar.app" />

0 commit comments

Comments
 (0)