-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(Tile): deprecate in docs * moved Tile to deprecated dir * add isHidden, add example & desc * update to screenreader css, add link * rebase, use styles obj, fix screenreader application * add more spacing to icon * revert stylesheet import, adjust flex
- Loading branch information
Showing
19 changed files
with
264 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
packages/react-core/src/components/Card/examples/CardTile.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
import { Card, CardHeader, CardBody, Gallery, Flex } from '@patternfly/react-core'; | ||
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon'; | ||
|
||
export const CardTile: React.FunctionComponent = () => { | ||
const [isChecked, setIsChecked] = React.useState(''); | ||
const id1 = 'tile-1'; | ||
const id2 = 'tile-2'; | ||
const id3 = 'tile-3'; | ||
|
||
const onChange = (event: React.FormEvent<HTMLInputElement>) => { | ||
setIsChecked(event.currentTarget.id); | ||
}; | ||
|
||
return ( | ||
<Gallery hasGutter> | ||
<Card id="tile-example-1" isSelectable isSelected={isChecked === id1}> | ||
<CardHeader | ||
selectableActions={{ | ||
selectableActionId: id1, | ||
selectableActionAriaLabelledby: 'tile-example-1', | ||
name: id1, | ||
variant: 'single', | ||
onChange, | ||
isHidden: true | ||
}} | ||
> | ||
<Flex gap={{ default: 'gapSm' }} alignItems={{ default: 'alignItemsCenter' }}> | ||
<PlusIcon /> | ||
<b>Tile header</b> | ||
</Flex> | ||
</CardHeader> | ||
<CardBody>Tile content and description</CardBody> | ||
</Card> | ||
<Card id="tile-example-2" isSelectable isSelected={isChecked === id2}> | ||
<CardHeader | ||
selectableActions={{ | ||
selectableActionId: id2, | ||
selectableActionAriaLabelledby: 'tile-example-2', | ||
name: id2, | ||
variant: 'single', | ||
onChange, | ||
isHidden: true | ||
}} | ||
> | ||
<Flex gap={{ default: 'gapSm' }} alignItems={{ default: 'alignItemsCenter' }}> | ||
<PlusIcon /> | ||
<b>Tile header</b> | ||
</Flex> | ||
</CardHeader> | ||
<CardBody>Tile content and description</CardBody> | ||
</Card> | ||
<Card id="tile-example-3" isSelectable isDisabled isSelected={isChecked === id3}> | ||
<CardHeader | ||
selectableActions={{ | ||
selectableActionId: id3, | ||
selectableActionAriaLabelledby: 'tile-example-3', | ||
name: id3, | ||
variant: 'single', | ||
onChange, | ||
isHidden: true | ||
}} | ||
> | ||
<Flex gap={{ default: 'gapSm' }} alignItems={{ default: 'alignItemsCenter' }}> | ||
<PlusIcon /> | ||
<b>Tile header (disabled)</b> | ||
</Flex> | ||
</CardHeader> | ||
<CardBody>Tile content and description</CardBody> | ||
</Card> | ||
</Gallery> | ||
); | ||
}; |
84 changes: 84 additions & 0 deletions
84
packages/react-core/src/components/Card/examples/CardTileMulti.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react'; | ||
import { Card, CardHeader, CardBody, Gallery, Flex } from '@patternfly/react-core'; | ||
import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon'; | ||
|
||
export const CardTileMulti: React.FunctionComponent = () => { | ||
const [isChecked1, setIsChecked1] = React.useState(false); | ||
const [isChecked2, setIsChecked2] = React.useState(false); | ||
const [isChecked3, setIsChecked3] = React.useState(false); | ||
const id1 = 'multi-tile-1'; | ||
const id2 = 'multi-tile-2'; | ||
const id3 = 'multi-tile-3'; | ||
|
||
const onChange = (event: React.FormEvent<HTMLInputElement>, checked: boolean) => { | ||
const name = event.currentTarget.name; | ||
|
||
switch (name) { | ||
case id1: | ||
setIsChecked1(checked); | ||
break; | ||
case id2: | ||
setIsChecked2(checked); | ||
break; | ||
case id3: | ||
setIsChecked3(checked); | ||
break; | ||
} | ||
}; | ||
|
||
return ( | ||
<Gallery hasGutter> | ||
<Card id="multi-tile-example-1" isSelectable isSelected={isChecked1}> | ||
<CardHeader | ||
selectableActions={{ | ||
selectableActionId: id1, | ||
selectableActionAriaLabelledby: 'multi-tile-example-1', | ||
name: id1, | ||
onChange, | ||
isHidden: true | ||
}} | ||
> | ||
<Flex gap={{ default: 'gapSm' }} alignItems={{ default: 'alignItemsCenter' }}> | ||
<PlusIcon /> | ||
<b>Tile header</b> | ||
</Flex> | ||
</CardHeader> | ||
<CardBody>Tile content and description</CardBody> | ||
</Card> | ||
<Card id="multi-tile-example-2" isSelectable isSelected={isChecked2}> | ||
<CardHeader | ||
selectableActions={{ | ||
selectableActionId: id2, | ||
selectableActionAriaLabelledby: 'multi-tile-example-2', | ||
name: id2, | ||
onChange, | ||
isHidden: true | ||
}} | ||
> | ||
<Flex gap={{ default: 'gapSm' }} alignItems={{ default: 'alignItemsCenter' }}> | ||
<PlusIcon /> | ||
<b>Tile header</b> | ||
</Flex> | ||
</CardHeader> | ||
<CardBody>Tile content and description</CardBody> | ||
</Card> | ||
<Card id="multi-tile-example-3" isSelectable isDisabled isSelected={isChecked3}> | ||
<CardHeader | ||
selectableActions={{ | ||
selectableActionId: id3, | ||
selectableActionAriaLabelledby: 'multi-tile-example-3', | ||
name: id3, | ||
onChange, | ||
isHidden: true | ||
}} | ||
> | ||
<Flex gap={{ default: 'gapSm' }} alignItems={{ default: 'alignItemsCenter' }}> | ||
<PlusIcon /> | ||
<b>Tile header (disabled)</b> | ||
</Flex> | ||
</CardHeader> | ||
<CardBody>Tile content and description</CardBody> | ||
</Card> | ||
</Gallery> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rc/components/Tile/examples/TileBasic.tsx → ...ed/components/Tile/examples/TileBasic.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../components/Tile/examples/TileStacked.tsx → .../components/Tile/examples/TileStacked.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...le/examples/TileStackedWithLargeIcons.tsx → ...le/examples/TileStackedWithLargeIcons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.