Skip to content

Commit

Permalink
rebase, use styles obj, fix screenreader application
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcfaul committed Sep 23, 2024
1 parent f4dfecd commit dc4b967
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 74 deletions.
6 changes: 4 additions & 2 deletions packages/react-core/src/components/Card/CardHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/Card/card';
import accessibilityStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility';
import { CardContext } from './Card';
import { CardHeaderMain } from './CardHeaderMain';
import { CardActions } from './CardActions';
Expand Down Expand Up @@ -135,7 +136,8 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({

const SelectableCardInput = selectableActions?.variant === 'single' ? Radio : Checkbox;
const getSelectableProps = () => ({
className: css('pf-m-standalone', selectableActions?.isHidden && 'pf-v6-screen-reader'),
className: css('pf-m-standalone'),
inputClassName: css(selectableActions?.isHidden && accessibilityStyles.screenReader),
label: <></>,
'aria-label': selectableActions.selectableActionAriaLabel,
'aria-labelledby': selectableActions.selectableActionAriaLabelledby,
Expand All @@ -155,7 +157,7 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
className: css(
'pf-v6-c-card__clickable-action',
isDisabledLinkCard && styles.modifiers.disabled,
selectableActions?.isHidden && 'pf-v6-screen-reader'
selectableActions?.isHidden && accessibilityStyles.screenReader
),
id: selectableActions.selectableActionId,
'aria-label': selectableActions.selectableActionAriaLabel,
Expand Down
8 changes: 7 additions & 1 deletion packages/react-core/src/components/Card/examples/Card.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,22 @@ Dividers can be placed between sections of the card.

## Cards as tiles

Sets of selectable cards may also be used as tiles, and may be made either single selectable or multiselectable by passing the `variant` property to the `selectableActions` object. You may toggle the visibility of the radio or checkbox by additionally passing the `isHidden` property to the `selectableActions` object.
Sets of selectable cards can be used as tiles, which are static options that users can select.

They can be either single selectable or multi selectable, by passing the `variant` property to the `selectableActions` object. You can also toggle the visibility of the radio or checkbox by passing the `isHidden` property to the `selectableActions` object.

### Single selectable tiles

To prevent users from selecting more than 1 tile in a set, set `variant` to "single" within the `selectableActions` object of `<CardHeader>`.

```ts file='./CardTile.tsx'

```

### Multi selectable tiles

To allow users to select more than 1 tile in a set, do not set `variant` within the `selectableActions` object of `<CardHeader>`.

```ts file='./CardTileMulti.tsx'

```
69 changes: 0 additions & 69 deletions packages/react-core/src/components/Tile/examples/Tile.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: Tile
section: components
cssPrefix: pf-v5-c-tile
cssPrefix: pf-v6-c-tile
propComponents: ['Tile']
deprecated: true
---
Expand All @@ -10,7 +10,7 @@ import PlusIcon from '@patternfly/react-icons/dist/esm/icons/plus-icon';
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
import './Tile.css';

Note: Tile has been deprecated, please use the [Card](/components/card#cards-as-tiles) component.
**Note:** Tile has been deprecated. Use the [card](/components/card#cards-as-tiles) component instead.

## Examples

Expand Down

0 comments on commit dc4b967

Please sign in to comment.