slate/pages/_/system/buttons.js

198 lines
5.4 KiB
JavaScript
Raw Normal View History

import * as React from "react";
import * as System from "~/components/system";
import SystemPage from "~/components/system/SystemPage";
import ViewSourceLink from "~/components/system/ViewSourceLink";
import CodeBlock from "~/components/system/CodeBlock";
2020-08-25 02:29:40 +03:00
import Group from "~/components/system/Group";
export default class SystemPageButtons extends React.Component {
render() {
return (
2020-07-28 23:27:53 +03:00
<SystemPage
title="SDS: Buttons"
description="..."
url="https://slate.host/_/system/buttons"
2020-07-28 23:27:53 +03:00
>
<System.H1>
Buttons <ViewSourceLink file="system/buttons.js" />
</System.H1>
<br />
<br />
2020-06-24 05:02:55 +03:00
<System.P>
The Button component is used to trigger an action or event, such as
submitting a form or saving users information.
2020-06-24 05:02:55 +03:00
</System.P>
<br />
<br />
<br />
<System.H2>Imports</System.H2>
<hr />
<br />
<System.P>Import React and the Button Components.</System.P>
<br />
<br />
<CodeBlock>
2020-07-28 23:27:53 +03:00
{`import * as React from "react";
import {
ButtonPrimary,
ButtonSecondary,
ButtonDisabled,
2020-07-28 23:27:53 +03:00
} from "slate-react-system";`}
</CodeBlock>
<br />
<br />
2020-06-24 05:02:55 +03:00
<System.H2>Regular width</System.H2>
<hr />
<br />
<System.P>
2020-08-02 22:17:13 +03:00
There are three variations of the button component.
<br />
2020-06-24 05:02:55 +03:00
Primary, Secondary and Disabled.
</System.P>
<br />
<System.ButtonPrimary>Primary</System.ButtonPrimary> &nbsp;
<System.ButtonSecondary>Secondary</System.ButtonSecondary> &nbsp;
<System.ButtonDisabled>Disabled</System.ButtonDisabled>
<br />
<br />
<CodeBlock>
{`class ExamplePrimary extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonPrimary>Primary Button</ButtonPrimary>;
}
}
class ExampleSecondary extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonSecondary>Secondary Button</ButtonSecondary>;
}
}
class ExampleDisabled extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonDisabled>Disabled Button</ButtonDisabled>;
}
}`}
</CodeBlock>
<br />
<br />
<br />
2020-06-24 05:02:55 +03:00
<System.H2>Full width</System.H2>
<hr />
<br />
2020-08-02 22:17:13 +03:00
<System.P>Each of the button styles has a full width option.</System.P>
<br />
<System.ButtonPrimary full>Primary button full</System.ButtonPrimary>
<br />
2020-08-02 22:17:13 +03:00
<System.ButtonSecondary full>
Secondary button full
2020-08-02 22:17:13 +03:00
</System.ButtonSecondary>
<br />
<System.ButtonDisabled full>Disabled button full</System.ButtonDisabled>
<br />
<br />
<CodeBlock>
{`class ExamplePrimaryFull extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonPrimary full>Primary button full</ButtonPrimary>;
2020-07-28 23:27:53 +03:00
}
}
class ExampleSecondaryFull extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonSecondary full>Secondary button full</ButtonSecondary>;
2020-07-28 23:27:53 +03:00
}
}
class ExampleDisabledFull extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonDisabled full>Disabled button full</ButtonDisabled>;
2020-07-28 23:27:53 +03:00
}
}`}
</CodeBlock>
<br />
<br />
<br />
2020-06-24 05:02:55 +03:00
<System.H2>Labels</System.H2>
<hr />
<br />
<System.P>
You can add the <i>type='label'</i> property to convert any of the
above buttons into a label.
2020-06-24 05:02:55 +03:00
</System.P>
<br />
<System.ButtonPrimary type="label">
Primary label
</System.ButtonPrimary>{" "}
&nbsp;
<System.ButtonSecondary type="label">
Secondary label
</System.ButtonSecondary>{" "}
&nbsp;
<System.ButtonDisabled type="label">
Disabled label
</System.ButtonDisabled>
<br />
<br />
<CodeBlock>
{`class ExamplePrimaryLabel extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonPrimary type="label">Primary Button Label</ButtonPrimary>;
}
}
class ExampleSecondaryLabel extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return (
<ButtonSecondary type="label">Secondary Button Label</ButtonSecondary>
);
}
}
class ExampleDisabledLabel extends React.Component {
2020-07-28 23:27:53 +03:00
render() {
return <ButtonDisabled type="label">Disabled Button Label</ButtonDisabled>;
}
}`}
</CodeBlock>
2020-08-25 02:29:40 +03:00
<br />
<br />
<br />
<System.H2>Accepted React Properties</System.H2>
<hr />
<br />
<Group title="Buttons">
<System.Table
data={{
columns: [
{ key: "a", name: "Name", width: "128px" },
{ key: "b", name: "Type", width: "88px", type: "OBJECT_TYPE" },
{ key: "c", name: "Default", width: "88px" },
{ key: "d", name: "Description", width: "100%" },
],
rows: [
{
id: 1,
a: "type",
b: "string",
c: "null",
d: "If set to 'label', button will be a label.",
},
{
id: 2,
a: "full",
b: "boolean",
c: "false",
d:
"If true, width is set to 100%. Otherwise, width is according to the content of the button.",
},
],
}}
/>
</Group>
</SystemPage>
);
}
}