Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
eadf6e7
feat: add toolbar actions
bishalshrestha013 Jun 20, 2025
8a60c39
feat: render toolbar with toolbar action menu
bishalshrestha013 Jun 20, 2025
b35b75e
feat: display cog icon on mobile view
bishalshrestha013 Jun 20, 2025
0b61598
feat: add button for cog icon in toolbar
bishalshrestha013 Jun 23, 2025
e692ea5
Merge branch 'main' of github.com:prefabs-tech/react into refactor/pa…
bishalshrestha013 Jul 31, 2025
153c0a8
refactor: uncomment the toolbar action menu
bishalshrestha013 Jul 31, 2025
579ff0a
feat: hide toolbar in mobile view
bishalshrestha013 Jul 31, 2025
267a6a5
feat: update alignment
bishalshrestha013 Jul 31, 2025
abe6e50
feat: display icon if there is only one actions menu
bishalshrestha013 Jul 31, 2025
e8dc984
feat: display label if icon is not provided
bishalshrestha013 Jul 31, 2025
d366ab0
feat: update demo page
bishalshrestha013 Aug 1, 2025
445827d
feat: decrease the line height of the title
bishalshrestha013 Aug 1, 2025
6d150ec
style: fix coding standard
bishalshrestha013 Aug 7, 2025
850aa64
refactor: remove redundant code
bishalshrestha013 Aug 12, 2025
50ac817
feat: update page documentation
bishalshrestha013 Aug 12, 2025
02d85e5
feat: update menu title
bishalshrestha013 Aug 13, 2025
f0006de
feat: support display icon only in the button
bishalshrestha013 Aug 13, 2025
d1edc83
feat: update page document
bishalshrestha013 Aug 13, 2025
5312f8e
feat: update description and add types
bishalshrestha013 Aug 13, 2025
cbb157e
Merge branch 'main' of github.com:prefabs-tech/react into refactor/pa…
bishalshrestha013 Aug 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
345 changes: 294 additions & 51 deletions apps/demo/src/Views/Ui/components/PageDemo.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,96 @@
import { useTranslation } from "@prefabs.tech/react-i18n";
import { Button, Page, Tag } from "@prefabs.tech/react-ui";
import { Button, Page, Tag, TDataTable } from "@prefabs.tech/react-ui";
import { useNavigate } from "react-router-dom";

import { CodeBlock, Section } from "../../../components/Demo";

export const PageDemo = () => {
const [t] = useTranslation("ui");
const navigate = useNavigate();

const propertiesData = [
{
default: "-",
description: t("page.propertiesDescription.breadcrumb"),
prop: "breadcrumb",
type: "React.ReactNode",
},
{
default: "false",
description: t("page.propertiesDescription.centered"),
prop: "centered",
type: "boolean",
},
{
default: "-",
description: t("page.propertiesDescription.children"),
prop: "children",
type: "React.ReactNode",
},
{
default: "-",
description: t("page.propertiesDescription.className"),
prop: "className",
type: "string",
},
{
default: "-",
description: t("page.propertiesDescription.errorMessage"),
prop: "errorMessage",
type: "string",
},
{
default: "false",
description: t("page.propertiesDescription.loading"),
prop: "loading",
type: "boolean",
},
{
default: "-",
description: t("page.propertiesDescription.loadingComponent"),
prop: "loadingComponent",
type: "React.ReactElement",
},
{
default: "-",
description: t("page.propertiesDescription.loadingPageStyle"),
prop: "loadingPageStyle",
type: "LoadingPageProperties",
},
{
default: "-",
description: t("page.propertiesDescription.subtitle"),
prop: "subtitle",
type: "string | React.ReactNode",
},
{
default: "-",
description: t("page.propertiesDescription.title"),
prop: "title",
type: "string | React.ReactNode",
},
{
default: "-",
description: t("page.propertiesDescription.titleTag"),
prop: "titleTag",
type: "string | React.ReactNode",
},
{
default: "-",
description: t("page.propertiesDescription.toolbarActionMenu"),
prop: "toolbarActionMenu",
type: "ToolbarActionsMenuProperties",
},
{
default: "-",
description: t("page.propertiesDescription.toolbar"),
prop: "toolbar",
type: "React.ReactNode",
},
];

const pageContent = <div style={{ height: "20vh" }}>Page content.</div>;

const PageContent = <div style={{ height: "20vh" }}>{t("page.content")}</div>;
const breadcrumb = (
<Button
iconLeft={<i className="pi pi-chevron-left"></i>}
Expand All @@ -15,61 +101,218 @@ export const PageDemo = () => {

return (
<>
<Page title={t("page.title.basic")}>{PageContent}</Page>

<hr />
<Page
title={t("page.title.toolbar")}
toolbar={<Button label={t("page.toolbar.edit")} />}
children={PageContent}
/>
title={t("page.title")}
subtitle={t("page.subtitle")}
toolbar={
<Button
label={t("buttons.back")}
variant="textOnly"
iconLeft={<i className="pi pi-chevron-left"></i>}
onClick={() => navigate("..")}
/>
}
></Page>
<Section title={t("headers.usage")}>
<p>{t("common.usage", { component: "Page" })}</p>
<CodeBlock exampleCode='import { Page } from "@prefabs.tech/react-ui"' />
</Section>

<hr />
<Page
title={t("page.title.centerAligned")}
toolbar={<Button label={t("page.toolbar.edit")} />}
children={PageContent}
centered={true}
/>
<Section title={t("page.usage.basic")}>
<Page
title={"Basic page title"}
toolbarActionMenu={{
actions: [
{
iconLeft: <i className="pi pi-chevron-left"></i>,
variant: "textOnly",
label: "Back",
},
{
label: "Click",
severity: "secondary",
},
{
label: "Delete",
className: "danger",
},
],
}}
children={pageContent}
/>
<CodeBlock
exampleCode='const pageContent = <div style={{ height: "20vh" }}>Page content.</div>;

<hr />
<Page
title={t("page.title.stringSubtitle")}
subtitle={t("page.subTitle.title")}
children={PageContent}
/>
<Page
title={"Basic page title"}
toolbarActionMenu={{
actions: [
{
iconLeft: <i className="pi pi-chevron-left"></i>,
variant: "textOnly",
label: "Back",
},
{
label: "Click",
severity: "secondary",
},
{
label: "Delete",
className: "danger",
},
],
}}
children={pageContent}
/>'
/>
</Section>

<hr />
<Page
title={t("page.title.componentSubtitle")}
subtitle={<Tag label={t("page.subTitle.tag")} />}
children={PageContent}
/>
<Section title={t("page.usage.toolbarAndBreadcrumb")}>
<Page
title={"Page title"}
children={pageContent}
breadcrumb={breadcrumb}
toolbar={
<>
<Button severity="secondary" label={"Edit"} />
<Button severity="danger" label={"Delete"} />
</>
}
/>
<CodeBlock
exampleCode='const pageContent = <div style={{ height: "20vh" }}>Page content.</div>;
const breadcrumb = (
<Button
iconLeft={<i className="pi pi-chevron-left"></i>}
variant="textOnly"
label={t("page.breadcrumb.back")}
/>
);

<hr />
<Page
title={t("page.title.breadcrumb")}
children={PageContent}
breadcrumb={breadcrumb}
/>
<Page
title={"Page title"}
children={pageContent}
breadcrumb={breadcrumb}
toolbar={
<>
<Button severity="secondary" label={"Edit"} />
<Button severity="danger" label={"Delete"} />
</>
}
/>'
/>
</Section>

<hr />
<Page
title={t("page.title.complete")}
titleTag={<Tag label={t("page.heading.tag")} />}
toolbar={
<>
<Button
severity="secondary"
label={t("page.toolbar.button.label")}
/>
<Button label={t("page.toolbar.edit")} />
</>
}
subtitle={<Tag label={t("page.subTitle.tag")} />}
children={PageContent}
breadcrumb={breadcrumb}
/>
<Section title={t("page.usage.complete")}>
<Page
title={"Page header title"}
titleTag={<Tag label={"Heading tag"} />}
subtitle={<Tag label={"Subtitle tag"} />}
children={pageContent}
toolbarActionMenu={{
actions: [
{
iconLeft: <i className="pi pi-chevron-left"></i>,
variant: "textOnly",
label: "Back",
},
{
label: "Edit",
severity: "secondary",
},
{
iconLeft: "pi pi-trash",
label: "Delete",
variant: "outlined",
className: "danger",
onClick: () => {
console.log("Event clicked");
},
iconOnly: true,
},
],
}}
/>

<CodeBlock
exampleCode='const pageContent = <div style={{ height: "20vh" }}>Page content.</div>;

<Page
title={"Page header title"}
titleTag={<Tag label={"Heading tag"} />}
subtitle={<Tag label={"Subtitle tag"} />}
children={pageContent}
toolbarActionMenu={{
actions: [
{
iconLeft: <i className="pi pi-chevron-left"></i>,
variant: "textOnly",
label: "Back",
},
{
label: "Edit",
severity: "secondary",
},
{
iconLeft: "pi pi-trash",
label: "Delete",
variant: "outlined",
className: "danger",
onClick: () => {
console.log("Event clicked");
},
iconOnly: true,
},
],
}}
/>'
/>
</Section>

<Section
title={t("headers.propertiesValue", {
value: "PageProperties",
})}
>
<TDataTable
columns={[
{
accessorKey: "prop",
header: t("propertiesTable.header.properties"),
},
{
accessorKey: "type",
header: t("propertiesTable.header.type"),
},
{
accessorKey: "default",
header: t("propertiesTable.header.default"),
},
{
accessorKey: "description",
header: t("propertiesTable.header.description"),
},
]}
data={propertiesData}
paginated={false}
/>
</Section>

<Section title={t("headers.types")}>
<CodeBlock
exampleCode='
interface ActionsMenuItem
extends Omit<MenuItem, "onClick">,
Partial<IButtonProperties> {
iconOnly?: boolean;
onClick?: (event?: React.MouseEvent | React.KeyboardEvent) => void;
}

interface ToolbarActionsMenuProperties {
actions?: ActionsMenuItem[];
}'
/>
</Section>
</>
);
};
2 changes: 1 addition & 1 deletion apps/demo/src/Views/Ui/pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const MISC_ROUTES = [
},
{
path: UI_ROUTES.PAGE_DEMO,
key: "page.title.menu",
key: "page.title",
element: <PageDemo />,
},
{
Expand Down
Loading