Skip to content

Commit f5d92ab

Browse files
feat(demo): add code example for submit button (#1356)
* fix: add code example * fix: update translation message
1 parent 0fd0084 commit f5d92ab

3 files changed

Lines changed: 66 additions & 5 deletions

File tree

apps/demo/src/Views/Ui/components/SubmitButton.tsx

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,71 @@
11
import { useTranslation } from "@dzangolab/react-i18n";
22
import { Page, SubmitButton } from "@dzangolab/react-ui";
3+
import { TDataTable } from "@dzangolab/react-ui";
34

4-
import { Section } from "../../../components/Demo";
5+
import { CodeBlock, Section } from "../../../components/Demo";
6+
7+
const data = [
8+
{
9+
id: 1,
10+
prop: "disabled",
11+
type: "boolean",
12+
description: "If true, the button will be disabled and non-interactive.",
13+
},
14+
{
15+
id: 2,
16+
prop: "label",
17+
type: "string",
18+
description: "Text to be displayed in the button.",
19+
},
20+
{
21+
id: 3,
22+
prop: "loading",
23+
type: "boolean",
24+
description:
25+
"If true, indicates that the button is in a loading state and disables user interaction.",
26+
},
27+
];
528

629
export const SubmitButtonDemo = () => {
730
const [t] = useTranslation("ui");
831

932
return (
1033
<Page title={t("submitButton.title")}>
11-
<Section>
34+
<Section title={t("headers.usage")}>
35+
<p>{t("common.usage", { component: "SubmitButton" })}</p>
36+
<CodeBlock exampleCode="import { SubmitButton } from '@dzangolab/react-ui';" />
37+
</Section>
38+
<Section title={t("submitButton.usage.basic")}>
1239
<SubmitButton label="Submit" />
40+
<CodeBlock exampleCode="<SubmitButton label='Submit'/>" />
1341
</Section>
14-
<Section>
42+
<Section title={t("submitButton.usage.loading")}>
1543
<SubmitButton label="Submit loading" loading />
44+
<CodeBlock exampleCode="<SubmitButton label='Submit loading' loading/>" />
45+
</Section>
46+
<Section
47+
title={t("headers.propertiesValue", {
48+
value: "SubmitButtonProperties",
49+
})}
50+
>
51+
<TDataTable
52+
columns={[
53+
{
54+
accessorKey: "prop",
55+
header: "Properties",
56+
},
57+
{
58+
accessorKey: "type",
59+
header: "Type",
60+
},
61+
{
62+
accessorKey: "description",
63+
header: "Description",
64+
},
65+
]}
66+
data={data}
67+
paginated={false}
68+
/>
1669
</Section>
1770
</Page>
1871
);

apps/demo/src/locales/en/ui.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@
115115
"title": "Responsive menu"
116116
},
117117
"submitButton": {
118-
"title": "Submit button"
118+
"title": "Submit button",
119+
"usage": {
120+
"basic": "Basic",
121+
"loading": "Loading"
122+
}
119123
},
120124
"youtubeFacade": {
121125
"title": "Youtube facade"

apps/demo/src/locales/fr/ui.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@
115115
"title": "Responsive menu (fr)"
116116
},
117117
"submitButton": {
118-
"title": "Submit button (fr)"
118+
"title": "Submit button (fr)",
119+
"usage": {
120+
"basic": "Basic (fr)",
121+
"loading": "Loading (fr)"
122+
}
119123
},
120124
"youtubeFacade": {
121125
"title": "Youtube facade (fr)"

0 commit comments

Comments
 (0)