joyent-portal/packages/ui-toolkit/src/card/usage.md

513 lines
10 KiB
Markdown
Raw Normal View History

#### Card > Headed > Collapsed
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardInfo
} = require('./');
const { InstancesIconLight } = require('../icons');
<Card collapsed headed>
<CardHeader>
<CardMeta>
<CardTitle>Nginx</CardTitle>
<CardDescription>
<CardInfo
icon={<InstancesIconLight />}
iconPosition="left"
label="4 of 4 instances"
/>
2017-10-12 21:15:51 +03:00
</CardDescription>
</CardMeta>
<CardOptions />
</CardHeader>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Headed
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardInfo
} = require('./');
const { InstancesIconLight, HealthyIcon } = require('../icons');
<Card headed>
<CardHeader>
<CardMeta>
<CardTitle>Nginx</CardTitle>
<CardDescription>
<CardInfo
icon={<InstancesIconLight />}
iconPosition="left"
label="4 of 4 instances"
/>
2017-10-12 21:15:51 +03:00
</CardDescription>
</CardMeta>
<CardOptions />
</CardHeader>
<CardView>
<CardDescription>
<CardInfo
2017-10-12 21:15:51 +03:00
icon={<HealthyIcon healthy="HEALTHY" />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Single state
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardInfo
} = require('./');
const { InstancesIconLight, HealthyIcon } = require('../icons');
<Card headed>
<CardHeader>
<CardMeta>
<CardTitle>Nginx</CardTitle>
<CardDescription>
<CardInfo
icon={<InstancesIconLight />}
iconPosition="left"
label="4 of 4 instances"
/>
2017-10-12 21:15:51 +03:00
</CardDescription>
</CardMeta>
<CardOptions />
</CardHeader>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
1 instance paused <br />
1 instances stopped <br />
1 instance not responding <br />
</CardDescription>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Metrics
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardInfo
} = require('./');
const { MetricGraph, GraphContainer, GraphTitle } = require('../metrics');
const { Row } = require('react-styled-flexboxgrid');
const metrics = require('./metrics.json');
const { InstancesIconLight, HealthyIcon } = require('../icons');
<Card headed>
<CardHeader>
<CardMeta>
<CardTitle>Nginx</CardTitle>
<CardDescription>
<CardInfo
icon={<InstancesIconLight />}
iconPosition="left"
label="4 of 4 instances"
/>
2017-10-12 21:15:51 +03:00
</CardDescription>
</CardMeta>
<CardOptions />
</CardHeader>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<span>Scaling from 1 to 4: finished</span>
<CardInfo
icon={<HealthyIcon />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
<CardDescription>
2017-10-12 21:15:51 +03:00
<Row>
<GraphContainer xs={4}>
<GraphTitle>Memory usage</GraphTitle>
<MetricGraph metricsData={metrics} graphDurationSeconds={90} />
</GraphContainer>
<GraphContainer xs={4}>
<GraphTitle>CPU usage</GraphTitle>
<MetricGraph metricsData={metrics} graphDurationSeconds={90} />
</GraphContainer>
<GraphContainer xs={4}>
<GraphTitle>CPU wait time</GraphTitle>
<MetricGraph metricsData={metrics} graphDurationSeconds={90} />
</GraphContainer>
</Row>
</CardDescription>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Provisioning
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardInfo
} = require('./');
const StatusLoader = require('../status-loader').default;
const { InstancesIconLight, HealthyIcon } = require('../icons');
<Card collapsed headed disabled>
<CardHeader disabled>
<CardMeta>
<CardTitle disabled>
<span>Nginx</span>
2017-10-12 21:15:51 +03:00
<StatusLoader inline row msg="Provisioning" />
</CardTitle>
</CardMeta>
2017-10-12 21:15:51 +03:00
<CardOptions disabled />
</CardHeader>
2017-10-12 21:15:51 +03:00
</Card>;
```
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardInfo
} = require('./');
const { MetricGraph, GraphContainer, GraphTitle } = require('../metrics');
const StatusLoader = require('../status-loader').default;
const { InstancesIconLight, HealthyIcon } = require('../icons');
<Card headed>
<CardHeader>
<CardMeta>
<CardTitle>Nginx</CardTitle>
<CardDescription>
<CardInfo
icon={<InstancesIconLight />}
iconPosition="left"
label="4 of 4 instances"
/>
2017-10-12 21:15:51 +03:00
</CardDescription>
</CardMeta>
<CardOptions />
</CardHeader>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<StatusLoader row msg="Provisioning 3 instances" />
<br />
<br />
<br />
<CardInfo
icon={<HealthyIcon />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Disabled
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardInfo
} = require('./');
const { InstancesIcon, HealthyIcon } = require('../icons');
const StatusLoader = require('../status-loader').default;
<Card headed disabled>
<CardHeader disabled>
<CardMeta>
<CardTitle disabled>Nginx</CardTitle>
<CardDescription disabled>
<CardInfo
icon={<InstancesIcon />}
iconPosition="left"
label="4 of 4 instances"
color="dark"
/>
2017-10-12 21:15:51 +03:00
</CardDescription>
</CardMeta>
2017-10-12 21:15:51 +03:00
<CardOptions disabled />
</CardHeader>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<StatusLoader row msg="Provisioning 3 instances" />
</CardDescription>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Instance
```jsx
const {
CardDescription,
CardOutlet,
CardTitle,
CardView,
CardInfo
} = require('./');
const { MetricGraph, GraphContainer, GraphTitle } = require('../metrics');
const { Row } = require('react-styled-flexboxgrid');
const metrics = require('./metrics.json');
const { InstancesIconLight, HealthyIcon } = require('../icons');
<Card>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<b>percona_primary</b>
<CardInfo
icon={<HealthyIcon />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Instance > Stacked
```jsx
const {
CardDescription,
CardOutlet,
CardTitle,
CardView,
CardInfo
} = require('./');
const { MetricGraph, GraphContainer, GraphTitle } = require('../metrics');
const { Row } = require('react-styled-flexboxgrid');
const { InstancesIconLight, HealthyIcon } = require('../icons');
<Card stacked>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<b>percona_primary</b>
<span>4 instances</span>
<CardInfo
icon={<HealthyIcon />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Instance > Group
```jsx
const {
CardDescription,
CardOutlet,
CardTitle,
CardView,
CardInfo
} = require('./');
const { MetricGraph, GraphContainer, GraphTitle } = require('../metrics');
const { Row } = require('react-styled-flexboxgrid');
const { InstancesIconLight, HealthyIcon } = require('../icons');
<div>
<Card>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<b>percona_primary</b>
<CardInfo
icon={<HealthyIcon />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
</CardView>
</Card>
<Card>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<b>percona_primary</b>
<CardInfo
icon={<HealthyIcon />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
</CardView>
</Card>
<Card stacked>
<CardView>
<CardDescription>
2017-10-12 21:15:51 +03:00
<b>percona_primary</b>
<span>4 instances</span>
<CardInfo
icon={<HealthyIcon />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
</CardView>
</Card>
2017-10-12 21:15:51 +03:00
</div>;
```
#### Card > Instance > List
```jsx
const {
Card,
CardInfo,
CardView,
CardTitle,
CardDescription,
CardOptions
} = require('./');
const { HealthyIcon, DataCenterIcon } = require('../icons');
<Card collapsed>
<CardView>
2017-10-12 21:15:51 +03:00
<CardTitle>WordPress_01</CardTitle>
<CardDescription>
<CardInfo
2017-10-12 21:15:51 +03:00
icon={<HealthyIcon healthy="HEALTHY" />}
iconPosition="left"
label="Healthy"
color="dark"
/>
</CardDescription>
<CardDescription>
<CardInfo
icon={<DataCenterIcon />}
iconPosition="left"
label="eu-ams-1"
color="dark"
/>
</CardDescription>
<CardOptions />
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Secondary
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardGroupView,
CardFooter
} = require('./');
<Card transparent>
<CardView>
<CardMeta>
<CardTitle>$0.016 per hour</CardTitle>
<CardSubTitle>0.256 GB RAM</CardSubTitle>
<CardSubTitle>0.25 vCPUs</CardSubTitle>
<CardSubTitle>0.01 TB disk</CardSubTitle>
<CardSubTitle>SSD</CardSubTitle>
<CardFooter>Compute Optimise</CardFooter>
</CardMeta>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```
#### Card > Secondary > Active
```jsx
const {
CardDescription,
CardHeader,
CardMeta,
CardOptions,
CardOutlet,
CardSubTitle,
CardTitle,
CardView,
CardGroupView,
CardFooter
} = require('./');
<Card transparent selected>
<CardView>
<CardMeta>
<CardTitle selected>$0.016 per hour</CardTitle>
<CardSubTitle selected>0.256 GB RAM</CardSubTitle>
<CardSubTitle selected>0.25 vCPUs</CardSubTitle>
<CardSubTitle selected>0.01 TB disk</CardSubTitle>
<CardSubTitle selected>SSD</CardSubTitle>
<CardFooter selected>Compute Optimise</CardFooter>
</CardMeta>
</CardView>
2017-10-12 21:15:51 +03:00
</Card>;
```