Skip to content

Commit 2a4831a

Browse files
authored
chore(Accordion, ExpandableSection, DescriptionList): update displaySize prop values (#8206)
* updated displaySize prop to match new recommendations * update test description * fix expandable integration demo * fix displaySize in remaining md files * address PR feedback for descriptionList example
1 parent e5242a8 commit 2a4831a

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

packages/react-core/src/components/Accordion/Accordion.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface AccordionProps extends React.HTMLProps<HTMLDListElement> {
1717
/** Flag to indicate the accordion had a border */
1818
isBordered?: boolean;
1919
/** Display size variant. */
20-
displaySize?: 'default' | 'large';
20+
displaySize?: 'default' | 'lg';
2121
}
2222

2323
export const Accordion: React.FunctionComponent<AccordionProps> = ({
@@ -36,7 +36,7 @@ export const Accordion: React.FunctionComponent<AccordionProps> = ({
3636
className={css(
3737
styles.accordion,
3838
isBordered && styles.modifiers.bordered,
39-
displaySize === 'large' && styles.modifiers.displayLg,
39+
displaySize === 'lg' && styles.modifiers.displayLg,
4040
className
4141
)}
4242
aria-label={ariaLabel}

packages/react-core/src/components/Accordion/__tests__/Accordion.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ test('Renders without pf-m-display-lg by default', () => {
128128
expect(screen.getByText('Test')).not.toHaveClass('pf-m-display-lg');
129129
});
130130

131-
test('Renders with pf-m-display-lg when displaySize=large', () => {
132-
render(<Accordion displaySize="large">Test</Accordion>);
131+
test('Renders with pf-m-display-lg when displaySize="lg"', () => {
132+
render(<Accordion displaySize="lg">Test</Accordion>);
133133

134134
expect(screen.getByText('Test')).toHaveClass('pf-m-display-lg');
135135
});

packages/react-core/src/components/Accordion/examples/AccordionBordered.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const AccordionBordered: React.FunctionComponent = () => {
1414
const [expanded, setExpanded] = React.useState('bordered-toggle4');
1515
const [isDisplayLarge, setIsDisplayLarge] = React.useState(false);
1616

17-
const displaySize = isDisplayLarge ? 'large' : 'default';
17+
const displaySize = isDisplayLarge ? 'lg' : 'default';
1818
const onToggle = (id: string) => {
1919
if (id === expanded) {
2020
setExpanded('');
@@ -124,7 +124,7 @@ export const AccordionBordered: React.FunctionComponent = () => {
124124
label="Display size large"
125125
isChecked={isDisplayLarge}
126126
onChange={setIsDisplayLarge}
127-
aria-label="show displlay large variation checkbox"
127+
aria-label="show display large variation checkbox"
128128
id="toggle-display-lg"
129129
name="toggle-display-lg"
130130
/>

packages/react-core/src/components/DescriptionList/DescriptionList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface DescriptionListProps extends Omit<React.HTMLProps<HTMLDListElem
3131
/** Sets the the default placement of description list groups to fill from top to bottom. */
3232
isFillColumns?: boolean;
3333
/** Sets the display size of the descriptions in the description list.*/
34-
displaySize?: 'lg' | '2xl';
34+
displaySize?: 'default' | 'lg' | '2xl';
3535
/** Sets the number of columns on the description list at various breakpoints */
3636
columnModifier?: {
3737
default?: '1Col' | '2Col' | '3Col';
@@ -90,7 +90,7 @@ export const DescriptionList: React.FunctionComponent<DescriptionListProps> = ({
9090
isCompact,
9191
isFluid,
9292
isFillColumns,
93-
displaySize,
93+
displaySize = 'default',
9494
columnModifier,
9595
autoFitMinModifier,
9696
termWidth,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ import FlagIcon from '@patternfly/react-icons/dist/esm/icons/flag-icon';
8585
```ts file='./DescriptionListColumnFill.tsx'
8686
```
8787

88-
### Display size
88+
### Large display size
8989

90-
```ts file='./DescriptionListWithDisplaySize.tsx'
90+
```ts file='./DescriptionListWithLargeDisplaySize.tsx'
9191
```
9292

9393
## Responsive column definitions
@@ -135,9 +135,9 @@ A [card component](/components/card) can be used in place of a description list
135135
```ts file='./DescriptionListWithCard.tsx'
136136
```
137137

138-
### Description list with display size and card
138+
### Description list with large display size and card
139139

140-
```ts file='./DescriptionListDisplaySizeAndCard.tsx'
140+
```ts file='./DescriptionListWithLargeDisplaySizeAndCard.tsx'
141141
```
142142

143143
### Display size with card, three column on large breakpoint
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@patternfly/react-core';
1010
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
1111

12-
export const DescriptionListWithDisplaySize: React.FunctionComponent = () => {
12+
export const DescriptionListWithLargeDisplaySize: React.FunctionComponent = () => {
1313
const [isChecked, setIsChecked] = React.useState<boolean>(false);
1414
const [displaySize, setDisplaySize] = React.useState<'lg' | '2xl'>('lg');
1515

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from '@patternfly/react-core';
1010
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
1111

12-
export const DescriptionListDisplaySizeAndCard: React.FunctionComponent = () => {
12+
export const DescriptionListWithLargeDisplaySizeAndCard: React.FunctionComponent = () => {
1313
const [isChecked, setIsChecked] = React.useState<boolean>(false);
1414
const [displaySize, setDisplaySize] = React.useState<'lg' | '2xl'>('lg');
1515

packages/react-core/src/components/ExpandableSection/ExpandableSection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export interface ExpandableSectionProps extends React.HTMLProps<HTMLDivElement>
2121
* property's value should match the contenId property of the expandable section toggle sub-component.
2222
*/
2323
contentId?: string;
24-
/** Display size variant. Set to "large" for disclosure styling. */
25-
displaySize?: 'default' | 'large';
24+
/** Display size variant. Set to "lg" for disclosure styling. */
25+
displaySize?: 'default' | 'lg';
2626
/** Forces active state. */
2727
isActive?: boolean;
2828
/** Indicates the expandable section has a detached toggle. */
@@ -193,7 +193,7 @@ export class ExpandableSection extends React.Component<ExpandableSectionProps, E
193193
propOrStateIsExpanded && styles.modifiers.expanded,
194194
isActive && styles.modifiers.active,
195195
isDetached && styles.modifiers.detached,
196-
displaySize === 'large' && styles.modifiers.displayLg,
196+
displaySize === 'lg' && styles.modifiers.displayLg,
197197
isWidthLimited && styles.modifiers.limitWidth,
198198
isIndented && styles.modifiers.indented,
199199
variant === ExpandableSectionVariant.truncate && styles.modifiers.truncate,

packages/react-core/src/components/ExpandableSection/__tests__/ExpandableSection.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test('Detached ExpandableSection renders successfully', () => {
4949

5050
test('Disclosure ExpandableSection', () => {
5151
const { asFragment } = render(
52-
<ExpandableSection {...props} displaySize="large" isWidthLimited>
52+
<ExpandableSection {...props} displaySize="lg" isWidthLimited>
5353
test{' '}
5454
</ExpandableSection>
5555
);

packages/react-core/src/components/ExpandableSection/examples/ExpandableSectionDisclosure.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const ExpandableSectionDisclosure: React.FunctionComponent = () => {
1313
toggleText={isExpanded ? 'Show less' : 'Show more'}
1414
onToggle={onToggle}
1515
isExpanded={isExpanded}
16-
displaySize="large"
16+
displaySize="lg"
1717
isWidthLimited
1818
>
1919
This content is visible only when the component is expanded.

0 commit comments

Comments
 (0)