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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface DataListContentProps extends React.HTMLProps<HTMLElement> {
/** Flag to show if the expanded content of the DataList item is visible */
isHidden?: boolean;
/** Flag to remove padding from the expandable content */
noPadding?: boolean;
hasNoPadding?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to hasPadding and default it to true? Sounds a little better and codemods fix it all the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tlabaj Thoughts?

I don't mind either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping as hasNoPadding per standup discussion for now

/** Adds accessible text to the DataList toggle */
'aria-label': string;
}
Expand All @@ -25,7 +25,7 @@ export const DataListContent: React.FunctionComponent<DataListContentProps> = ({
id = '',
isHidden = false,
'aria-label': ariaLabel,
noPadding = false,
hasNoPadding = false,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
rowid = '',
...props
Expand All @@ -37,6 +37,8 @@ export const DataListContent: React.FunctionComponent<DataListContentProps> = ({
aria-label={ariaLabel}
{...props}
>
<div className={css(styles.dataListExpandableContentBody, noPadding && styles.modifiers.noPadding)}>{children}</div>
<div className={css(styles.dataListExpandableContentBody, hasNoPadding && styles.modifiers.noPadding)}>
{children}
</div>
</section>
);
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ describe('DataList', () => {
});

test('Toggle default with aria label', () => {
const view = shallow(
<DataListToggle aria-label="Toggle details for" id="ex-toggle2" />
);
const view = shallow(<DataListToggle aria-label="Toggle details for" id="ex-toggle2" />);

expect(view.find(Button).props()['aria-label']).toBe('Toggle details for');
expect(view.find(Button).props()['aria-labelledby']).toBe(null);
Expand Down Expand Up @@ -181,9 +179,9 @@ describe('DataList', () => {
expect(view).toMatchSnapshot();
});

test('DataListContent noPadding', () => {
test('DataListContent hasNoPadding', () => {
const view = shallow(
<DataListContent aria-label="Primary Content Details" hidden noPadding>
<DataListContent aria-label="Primary Content Details" hidden hasNoPadding>
test
</DataListContent>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ it('DataListContent should match snapshot (auto-generated)', () => {
id={"''"}
rowid={"''"}
isHidden={false}
noPadding={false}
hasNoPadding={false}
aria-label={'string'}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ exports[`DataList DataListContent 1`] = `
</section>
`;

exports[`DataList DataListContent noPadding 1`] = `
exports[`DataList DataListContent hasNoPadding 1`] = `
<section
aria-label="Primary Content Details"
className="pf-c-data-list__expandable-content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ class ExpandableDataList extends React.Component {
aria-label="Primary Content Details"
id="ex-expand3"
isHidden={!this.state.expanded.includes('ex-toggle3')}
noPadding
hasNoPadding
>
This expanded section has no padding.
</DataListContent>
Expand Down
6 changes: 3 additions & 3 deletions packages/react-core/src/components/Drawer/DrawerHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ export interface DrawerHeadProps extends React.HTMLProps<HTMLDivElement> {
/** Content to be rendered in the drawer head */
children?: React.ReactNode;
/** Indicates if there should be no padding around the drawer panel body of the head*/
noPadding?: boolean;
hasNoPadding?: boolean;
}

export const DrawerHead: React.SFC<DrawerHeadProps> = ({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
className = '',
children,
noPadding = false,
hasNoPadding = false,
...props
}: DrawerHeadProps) => (
<DrawerPanelBody noPadding={noPadding}>
<DrawerPanelBody hasNoPadding={hasNoPadding}>
<div className={css(styles.drawerHead, className)} {...props}>
{children}
</div>
Expand Down
6 changes: 3 additions & 3 deletions packages/react-core/src/components/Drawer/DrawerPanelBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ export interface DrawerPanelBodyProps extends React.HTMLProps<HTMLDivElement> {
/** Content to be rendered in the drawer */
children?: React.ReactNode;
/** Indicates if there should be no padding around the drawer panel body */
noPadding?: boolean;
hasNoPadding?: boolean;
}

export const DrawerPanelBody: React.SFC<DrawerPanelBodyProps> = ({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
className = '',
children,
noPadding = false,
hasNoPadding = false,
...props
}: DrawerPanelBodyProps) => (
<div className={css(styles.drawerBody, noPadding && styles.modifiers.noPadding, className)} {...props}>
<div className={css(styles.drawerBody, hasNoPadding && styles.modifiers.noPadding, className)} {...props}>
{children}
</div>
);
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import { DrawerPanelContent } from '../../DrawerPanelContent';
import {} from '../..';

it('DrawerPanelContent should match snapshot (auto-generated)', () => {
const view = shallow(<DrawerPanelContent className={"''"} children={<div>ReactNode</div>} />);
const view = shallow(<DrawerPanelContent className={"''"} children={<div>ReactNode</div>} hasNoPadding={false} />);
expect(view).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ exports[`Drawer isExpanded = false and isInline = false and isStatic = false 1`]
>
<DrawerHead>
<DrawerPanelBody
noPadding={false}
hasNoPadding={false}
>
<div
className="pf-c-drawer__body"
Expand Down Expand Up @@ -179,7 +179,7 @@ exports[`Drawer isExpanded = false and isInline = true and isStatic = false 1`]
>
<DrawerHead>
<DrawerPanelBody
noPadding={false}
hasNoPadding={false}
>
<div
className="pf-c-drawer__body"
Expand Down Expand Up @@ -312,7 +312,7 @@ exports[`Drawer isExpanded = true and isInline = false and isStatic = false 1`]
>
<DrawerHead>
<DrawerPanelBody
noPadding={false}
hasNoPadding={false}
>
<div
className="pf-c-drawer__body"
Expand Down Expand Up @@ -445,7 +445,7 @@ exports[`Drawer isExpanded = true and isInline = false and isStatic = true 1`] =
>
<DrawerHead>
<DrawerPanelBody
noPadding={false}
hasNoPadding={false}
>
<div
className="pf-c-drawer__body"
Expand Down Expand Up @@ -578,7 +578,7 @@ exports[`Drawer isExpanded = true and isInline = true and isStatic = false 1`] =
>
<DrawerHead>
<DrawerPanelBody
noPadding={false}
hasNoPadding={false}
>
<div
className="pf-c-drawer__body"
Expand Down
Loading