|
1 | 1 | import { useTranslation } from "@dzangolab/react-i18n"; |
2 | 2 | import { Page, SubmitButton } from "@dzangolab/react-ui"; |
| 3 | +import { TDataTable } from "@dzangolab/react-ui"; |
3 | 4 |
|
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 | +]; |
5 | 28 |
|
6 | 29 | export const SubmitButtonDemo = () => { |
7 | 30 | const [t] = useTranslation("ui"); |
8 | 31 |
|
9 | 32 | return ( |
10 | 33 | <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")}> |
12 | 39 | <SubmitButton label="Submit" /> |
| 40 | + <CodeBlock exampleCode="<SubmitButton label='Submit'/>" /> |
13 | 41 | </Section> |
14 | | - <Section> |
| 42 | + <Section title={t("submitButton.usage.loading")}> |
15 | 43 | <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 | + /> |
16 | 69 | </Section> |
17 | 70 | </Page> |
18 | 71 | ); |
|
0 commit comments