Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 7 additions & 98 deletions packages/react-core/src/components/Tile/examples/Tile.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,125 +11,34 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

## Examples

Keyboard interaction patterns and a11y is implemented in the Tile demos, located in the [Demo section](/documentation/react/demos/tiledemo).
Keyboard interaction patterns and a11y is implemented in the Tile demos, located in the [Demo section](/components/tile/react-demos).

### Basic

```js
import React from 'react';
import { Tile } from '@patternfly/react-core';

<div role="listbox" aria-label="Basic tiles">
<Tile title="Default" isSelected={false} />
<Tile title="Selected" isSelected />
<Tile title="Disabled" isDisabled isSelected={false} />
</div>;
```ts file="./TileBasic.tsx"
```

### With subtext

```js
import React from 'react';
import { Tile } from '@patternfly/react-core';

<div role="listbox" aria-label="Tiles with subtext">
<Tile title="Default" isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>;
```ts file="./TileWithSubtext.tsx"
```

### With icon

```js
import React from 'react';
import { Tile } from '@patternfly/react-core';
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';

<div role="listbox" aria-label="Tiles with icon">
<Tile title="Default" icon={<PlusIcon />} isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" icon={<PlusIcon />} isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" icon={<PlusIcon />} isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>;
```ts file="./TileWithIcon.tsx"
```

### Stacked

```js
import React from 'react';
import { Tile } from '@patternfly/react-core';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

<div role="listbox" aria-label="Stacked tiles">
<Tile title="Default" icon={<BellIcon />} isStacked isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" icon={<BellIcon />} isStacked isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" icon={<BellIcon />} isStacked isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>;
```ts file="./TileStacked.tsx"
```

### Stacked with large icons

```js
import React from 'react';
import { Tile } from '@patternfly/react-core';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

<div role="listbox" aria-label="Stacked tiles with large icons">
<Tile title="Default" icon={<BellIcon />} isStacked isDisplayLarge isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" icon={<BellIcon />} isStacked isDisplayLarge isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" icon={<BellIcon />} isStacked isDisplayLarge isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>;
```ts file="./TileStackedWithLargeIcons.tsx"
```

### With extra content

```js
import React from 'react';
import { Tile, Flex } from '@patternfly/react-core';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

<div role="listbox" aria-label="Tiles with extra content">
<Flex>
<Flex flex={{ default: 'flex_1' }}>
<Tile title="Default" icon={<BellIcon />} isStacked isSelected={false}>
This is really really long subtext that goes on for so long that it has to wrap to the next line. This is really
really long subtext that goes on for so long that it has to wrap to the next line.
</Tile>
</Flex>
<Flex flex={{ default: 'flex_1' }}>
<Tile title="Selected" icon={<BellIcon />} isStacked isSelected>
This is really really long subtext that goes on for so long that it has to wrap to the next line.
</Tile>
</Flex>
<Flex flex={{ default: 'flex_1' }}>
<Tile title="Disabled" icon={<BellIcon />} isStacked isDisabled isSelected={false}>
Subtext goes here
</Tile>
</Flex>
</Flex>
</div>;
```ts file="./TileWithExtraContent.tsx"
```
10 changes: 10 additions & 0 deletions packages/react-core/src/components/Tile/examples/TileBasic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { Tile } from '@patternfly/react-core';

export const TileBasic: React.FunctionComponent = () => (
<div role="listbox" aria-label="Basic tiles">
<Tile title="Default" isSelected={false} />
<Tile title="Selected" isSelected />
<Tile title="Disabled" isDisabled isSelected={false} />
</div>
);
17 changes: 17 additions & 0 deletions packages/react-core/src/components/Tile/examples/TileStacked.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { Tile } from '@patternfly/react-core';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

export const TileStacked: React.FunctionComponent = () => (
<div role="listbox" aria-label="Stacked tiles">
<Tile title="Default" icon={<BellIcon />} isStacked isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" icon={<BellIcon />} isStacked isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" icon={<BellIcon />} isStacked isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { Tile } from '@patternfly/react-core';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

export const TileStackedWithLargeIcons: React.FunctionComponent = () => (
<div role="listbox" aria-label="Stacked tiles with large icons">
<Tile title="Default" icon={<BellIcon />} isStacked isDisplayLarge isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" icon={<BellIcon />} isStacked isDisplayLarge isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" icon={<BellIcon />} isStacked isDisplayLarge isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { Tile, Flex } from '@patternfly/react-core';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';

export const TileWithExtraContent: React.FunctionComponent = () => (
<div role="listbox" aria-label="Tiles with extra content">
<Flex>
<Flex flex={{ default: 'flex_1' }}>
<Tile title="Default" icon={<BellIcon />} isStacked isSelected={false}>
This is really really long subtext that goes on for so long that it has to wrap to the next line. This is
really really long subtext that goes on for so long that it has to wrap to the next line.
</Tile>
</Flex>
<Flex flex={{ default: 'flex_1' }}>
<Tile title="Selected" icon={<BellIcon />} isStacked isSelected>
This is really really long subtext that goes on for so long that it has to wrap to the next line.
</Tile>
</Flex>
<Flex flex={{ default: 'flex_1' }}>
<Tile title="Disabled" icon={<BellIcon />} isStacked isDisabled isSelected={false}>
Subtext goes here
</Tile>
</Flex>
</Flex>
</div>
);
17 changes: 17 additions & 0 deletions packages/react-core/src/components/Tile/examples/TileWithIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { Tile } from '@patternfly/react-core';
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';

export const TileWithIcon: React.FunctionComponent = () => (
<div role="listbox" aria-label="Tiles with icon">
<Tile title="Default" icon={<PlusIcon />} isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" icon={<PlusIcon />} isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" icon={<PlusIcon />} isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import { Tile } from '@patternfly/react-core';

export const TileWithSubtext: React.FunctionComponent = () => (
<div role="listbox" aria-label="Tiles with subtext">
<Tile title="Default" isSelected={false}>
Subtext goes here
</Tile>{' '}
<Tile title="Selected" isSelected>
Subtext goes here
</Tile>{' '}
<Tile title="Disabled" isDisabled isSelected={false}>
Subtext goes here
</Tile>
</div>
);
14 changes: 7 additions & 7 deletions packages/react-core/src/demos/TileDemo.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ const TileSingleSelect: React.FunctionComponent = () => {

return (
<div role="listbox" aria-label="Single selection tiles">
<Tile title="Tile 1" id="single-select-tile-1" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'tile-1'} />
<Tile title="Tile 2" id="single-select-tile-2" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'tile-2'} />
<Tile title="Tile 3" id="single-select-tile-3" isDisabled isSelected={selectedId === 'tile-3'} />
<Tile title="Tile 4" id="single-select-tile-4" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'tile-4'} />
<Tile title="Tile 1" id="single-select-tile-1" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'single-select-tile-1'} />
<Tile title="Tile 2" id="single-select-tile-2" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'single-select-tile-2'} />
<Tile title="Tile 3" id="single-select-tile-3" isDisabled isSelected={selectedId === 'single-select-tile-3'} />
<Tile title="Tile 4" id="single-select-tile-4" onClick={onSelect} onKeyDown={onKeyDown} isSelected={selectedId === 'single-select-tile-4'} />
</div>
);
};
Expand Down Expand Up @@ -71,22 +71,22 @@ const TileMultiSelect: React.FunctionComponent = () => {
id="multiselect-tile-1"
onClick={onSelect}
onKeyDown={onKeyDown}
isSelected={selectedIds.includes('tile-1')}
isSelected={selectedIds.includes('multiselect-tile-1')}
/>
<Tile
title="Tile 2"
id="multiselect-tile-2"
onClick={onSelect}
onKeyDown={onKeyDown}
isSelected={selectedIds.includes('tile-2')}
isSelected={selectedIds.includes('multiselect-tile-2')}
/>
<Tile title="Tile 3" id="multiselect-tile-3" isDisabled />
<Tile
title="Tile 4"
id="multiselect-tile-4"
onClick={onSelect}
onKeyDown={onKeyDown}
isSelected={selectedIds.includes('tile-4')}
isSelected={selectedIds.includes('multiselect-tile-4')}
/>
</div>
);
Expand Down