Skip to content

Commit e7dcc18

Browse files
committed
moved Tile to deprecated dir
1 parent 8c80ba8 commit e7dcc18

17 files changed

Lines changed: 146 additions & 78 deletions

File tree

packages/react-core/src/components/Card/examples/Card.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ouia: true
1919
import pfLogo from '../../assets/PF-HorizontalLogo-Color.svg';
2020
import pfLogoSmall from '../../assets/PF-IconLogo.svg';
2121
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
22+
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';
2223

2324
## Examples
2425

@@ -178,3 +179,9 @@ Dividers can be placed between sections of the card.
178179
```ts file='./CardWithDividers.tsx'
179180

180181
```
182+
183+
### Cards as tiles
184+
185+
```ts file='./CardTile.tsx'
186+
187+
```
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import React from 'react';
2+
import { Card, CardHeader, CardBody, Gallery } from '@patternfly/react-core';
3+
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';
4+
5+
export const CardTile: React.FunctionComponent = () => {
6+
const [isChecked, setIsChecked] = React.useState('');
7+
const id1 = 'tile-1';
8+
const id2 = 'tile-2';
9+
const id3 = 'tile-3';
10+
11+
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
12+
setIsChecked(event.currentTarget.id);
13+
};
14+
15+
return (
16+
<Gallery hasGutter>
17+
<Card id="tile-example-1" isSelectable isSelected={isChecked === id1}>
18+
<CardHeader
19+
selectableActions={{
20+
selectableActionId: id1,
21+
selectableActionAriaLabelledby: 'tile-example-1',
22+
name: id1,
23+
variant: 'single',
24+
onChange
25+
}}
26+
>
27+
<PlusIcon />
28+
<b>Tile header</b>
29+
</CardHeader>
30+
<CardBody>Tile content and description</CardBody>
31+
</Card>
32+
<Card id="tile-example-2" isSelectable isSelected={isChecked === id2}>
33+
<CardHeader
34+
selectableActions={{
35+
selectableActionId: id2,
36+
selectableActionAriaLabelledby: 'tile-example-2',
37+
name: id2,
38+
variant: 'single',
39+
onChange
40+
}}
41+
>
42+
<PlusIcon />
43+
<b>Tile header</b>
44+
</CardHeader>
45+
<CardBody>Tile content and description</CardBody>
46+
</Card>
47+
<Card id="tile-example-3" isSelectable isDisabled isSelected={isChecked === id3}>
48+
<CardHeader
49+
selectableActions={{
50+
selectableActionId: id3,
51+
selectableActionAriaLabelledby: 'tile-example-3',
52+
name: id3,
53+
variant: 'single',
54+
onChange
55+
}}
56+
>
57+
<PlusIcon />
58+
<b>Tile header</b>
59+
</CardHeader>
60+
<CardBody>Tile content and description</CardBody>
61+
</Card>
62+
</Gallery>
63+
);
64+
};

packages/react-core/src/components/Tile/examples/Tile.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

packages/react-core/src/components/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export * from './Switch';
6565
export * from './Tabs';
6666
export * from './TextArea';
6767
export * from './TextInput';
68-
export * from './Tile';
6968
export * from './TimePicker';
7069
export * from './Timestamp';
7170
export * from './Title';

packages/react-core/src/components/Tile/Tile.tsx renamed to packages/react-core/src/deprecated/components/Tile/Tile.tsx

File renamed without changes.

packages/react-core/src/components/Tile/__tests__/Tile.test.tsx renamed to packages/react-core/src/deprecated/components/Tile/__tests__/Tile.test.tsx

File renamed without changes.

packages/react-core/src/components/Tile/__tests__/__snapshots__/Tile.test.tsx.snap renamed to packages/react-core/src/deprecated/components/Tile/__tests__/__snapshots__/Tile.test.tsx.snap

File renamed without changes.

packages/react-core/src/components/Tile/examples/Tile.css renamed to packages/react-core/src/deprecated/components/Tile/examples/Tile.css

File renamed without changes.

packages/react-core/src/demos/TileDemo.md renamed to packages/react-core/src/deprecated/components/Tile/examples/Tile.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,80 @@
11
---
22
id: Tile
33
section: components
4+
cssPrefix: pf-v5-c-tile
5+
propComponents: ['Tile']
6+
deprecated: true
47
---
58

9+
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';
10+
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
11+
import './Tile.css';
12+
13+
Note: Tile has been deprecated, please use the [Card](/components/card) component.
14+
15+
## Examples
16+
17+
Keyboard interaction patterns and a11y is implemented in the Tile demos, located in the [Demo section](/components/tile/react-demos).
18+
19+
### Basic tile
20+
21+
Basic tiles can appear in one of three states: a default state, selected state, and a disabled state. To change the state of a tile, use the properties `isSelected` and `isDisabled`.
22+
23+
```ts file="./TileBasic.tsx"
24+
25+
```
26+
27+
### With subtext
28+
29+
Tile subtext can provide users with additional context. To add subtext, pass a short description to the `<Tile>` component.
30+
31+
```ts file="./TileWithSubtext.tsx"
32+
33+
```
34+
35+
### With icon
36+
37+
Icons can provide a visual cue that helps users understand what the tile is being used for. To add an icon, use the `icon` property.
38+
39+
```ts file="./TileWithIcon.tsx"
40+
41+
```
42+
43+
### With stacked icon
44+
45+
You can further customize a tile’s appearance by placing an icon above the title. To stack your icon on top of a tile’s title, use the `isStacked` property.
46+
47+
```ts file="./TileStacked.tsx"
48+
49+
```
50+
51+
### With large icons
52+
53+
You can make your icons larger to help catch a user’s attention. To increase the size of an icon, use the `isDisplayLarge` property.
54+
55+
Be aware that `isDisplayLarge` can only be used when `isStacked` is also applied.
56+
57+
```ts file="./TileStackedWithLargeIcons.tsx"
58+
59+
```
60+
61+
### With long subtext
62+
63+
To provide users with a large amount of context, subtext can be elongated to wrap around to the next line. To format a long subtext, you can pass the component `Flex` into `<Tile>`.
64+
65+
You can also change the type of `Flex` you can use so that the line breaks in the subtext fits your needs. You can do this by changing the default flex. The standard is `default: “flex_1”`, and changing the number in the default will also change where the sentence breaks.
66+
67+
```ts file="./TileWithExtraContent.tsx"
68+
69+
```
70+
671
## Demos
772

873
### Tiles with single selection
974

1075
```ts
1176
import React from 'react';
12-
import { Tile } from '@patternfly/react-core';
77+
import { Tile } from '@patternfly/react-core/deprecated';
1378

1479
const TileSingleSelect: React.FunctionComponent = () => {
1580
const [selectedId, setSelectedId] = React.useState<string>('');
@@ -40,7 +105,7 @@ const TileSingleSelect: React.FunctionComponent = () => {
40105

41106
```ts
42107
import React from 'react';
43-
import { Tile } from '@patternfly/react-core';
108+
import { Tile } from '@patternfly/react-core/deprecated';
44109

45110
const TileMultiSelect: React.FunctionComponent = () => {
46111
const [selectedIds, setSelectedIds] = React.useState<string[]>([]);

packages/react-core/src/components/Tile/examples/TileBasic.tsx renamed to packages/react-core/src/deprecated/components/Tile/examples/TileBasic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Tile } from '@patternfly/react-core';
2+
import { Tile } from '@patternfly/react-core/deprecated';
33

44
export const TileBasic: React.FunctionComponent = () => (
55
<div role="listbox" aria-label="Basic tiles">

0 commit comments

Comments
 (0)