| 1 |
--- |
| 2 |
id: Card |
| 3 |
section: components |
| 4 |
--- |
| 5 |
|
| 6 |
import { Fragment, useState } from 'react'; |
| 7 |
import { RhUiEllipsisVerticalFillIcon, RhMicronsCaretRightIcon, RhUiCheckCircleFillIcon, RhUiErrorFillIcon, RhMicronsExternalLinkIcon, RhUiInformationFillIcon, RhUiWarningFillIcon, RhUiNotificationFillIcon } from '@patternfly/react-icons'; |
| 8 |
import { Table, Thead, Tbody, Tr, Th, Td, ExpandableRowContent } from '@patternfly/react-table'; |
| 9 |
import { Chart, ChartAxis, ChartGroup, ChartVoronoiContainer, ChartStack, ChartBar, ChartTooltip, ChartDonutThreshold, ChartDonutUtilization, ChartArea, ChartContainer, ChartLabel } from '@patternfly/react-charts/victory'; |
| 10 |
import chart_color_yellow_100 from '@patternfly/react-tokens/dist/esm/chart_color_yellow_100'; |
| 11 |
import chart_color_yellow_300 from '@patternfly/react-tokens/dist/esm/chart_color_yellow_300'; |
| 12 |
import chart_color_orange_300 from '@patternfly/react-tokens/dist/esm/chart_color_orange_300'; |
| 13 |
import chart_color_red_orange_400 from '@patternfly/react-tokens/dist/esm/chart_color_red_orange_400'; |
| 14 |
import cssGridTemplateColumnsMin from '@patternfly/react-tokens/dist/esm/l_gallery_GridTemplateColumns_min'; |
| 15 |
import t_global_text_color_subtle from '@patternfly/react-tokens/dist/esm/t_global_text_color_subtle'; |
| 16 |
import flex from '@patternfly/react-styles/css/utilities/Flex/flex'; |
| 17 |
import text from '@patternfly/react-styles/css/utilities/Text/text'; |
| 18 |
import sizing from '@patternfly/react-styles/css/utilities/Sizing/sizing'; |
| 19 |
import accessibility from '@patternfly/react-styles/css/utilities/Accessibility/accessibility'; |
| 20 |
|
| 21 |
## Demos |
| 22 |
|
| 23 |
### Horizontal card grid |
| 24 |
|
| 25 |
The following demo shows how you may use a `<Grid>` within a card for scenarios that require multiple subsections. |
| 26 |
|
| 27 |
```ts file="./examples/Card/CardHorizontalGrid.tsx" |
| 28 |
|
| 29 |
``` |
| 30 |
|
| 31 |
### Horizontal split |
| 32 |
|
| 33 |
The following demo shows how you may utilize `<Grid>` to split a card into two halves, one with an image, and one with text content. |
| 34 |
|
| 35 |
```ts file="./examples/Card/CardHorizontalSplit.tsx" |
| 36 |
|
| 37 |
``` |
| 38 |
|
| 39 |
### Details card |
| 40 |
|
| 41 |
```ts file="./examples/Card/CardDetails.tsx" |
| 42 |
|
| 43 |
``` |
| 44 |
|
| 45 |
### Aggregate status card |
| 46 |
|
| 47 |
```ts file="./examples/Card/CardAggregateStatus.tsx" |
| 48 |
|
| 49 |
``` |
| 50 |
|
| 51 |
### Status |
| 52 |
|
| 53 |
```ts file="./examples/Card/CardStatus.tsx" |
| 54 |
|
| 55 |
``` |
| 56 |
|
| 57 |
### Status Tabbed |
| 58 |
|
| 59 |
```ts file="./examples/Card/CardStatusTabbed.tsx" |
| 60 |
|
| 61 |
``` |
| 62 |
|
| 63 |
### Utilization card 1 |
| 64 |
|
| 65 |
```ts file="./examples/Card/CardUtilizationDemo1.tsx" |
| 66 |
|
| 67 |
``` |
| 68 |
|
| 69 |
### Utilization card 2 |
| 70 |
|
| 71 |
```ts file="./examples/Card/CardUtilizationDemo2.tsx" |
| 72 |
|
| 73 |
``` |
| 74 |
|
| 75 |
### Utilization card 3 |
| 76 |
|
| 77 |
```ts file="./examples/Card/CardUtilizationDemo3.tsx" |
| 78 |
|
| 79 |
``` |
| 80 |
|
| 81 |
### Utilization card 4 |
| 82 |
|
| 83 |
```ts file="./examples/Card/CardUtilizationDemo4.tsx" |
| 84 |
|
| 85 |
``` |
| 86 |
|
| 87 |
### Nested cards |
| 88 |
|
| 89 |
```ts file="./examples/Card/CardNested.tsx" |
| 90 |
|
| 91 |
``` |
| 92 |
|
| 93 |
### With accordion |
| 94 |
|
| 95 |
```ts file="./examples/Card/CardWithAccordion.tsx" |
| 96 |
|
| 97 |
``` |
| 98 |
|
| 99 |
### Trend card 1 |
| 100 |
|
| 101 |
```ts file="./examples/Card/CardTrendDemo1.tsx" |
| 102 |
|
| 103 |
``` |
| 104 |
|
| 105 |
### Trend card 2 |
| 106 |
|
| 107 |
```ts file="./examples/Card/CardTrendDemo2.tsx" |
| 108 |
|
| 109 |
``` |
| 110 |
|
| 111 |
### Log view |
| 112 |
|
| 113 |
```ts file="./examples/Card/CardLogView.tsx" |
| 114 |
|
| 115 |
``` |
| 116 |
|
| 117 |
### Events view |
| 118 |
|
| 119 |
```ts file="./examples/Card/CardEventsView.tsx" |
| 120 |
|
| 121 |
``` |