Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a responsiveHeader prop to the EuiAccordion #2141

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added responsiveHeader prop to `EuiAccordion` ([#2141](https://github.com/elastic/eui/pull/2141))
- Added support for negated or clauses to `EuiSearchBar` ([#2140](https://github.com/elastic/eui/pull/2140))

**Bug fixes**
Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/accordion/accordion_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export default () => (
buttonClassName="euiAccordionForm__button"
buttonContent={buttonContent}
extraAction={extraAction}
paddingSize="l">
paddingSize="l"
responsiveHeader={false}>
{repeatableForm}
</EuiAccordion>

Expand Down
10 changes: 9 additions & 1 deletion src/components/accordion/accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export type EuiAccordionProps = HTMLAttributes<HTMLDivElement> &
* The padding around the exposed accordion content.
*/
paddingSize: EuiAccordionSize;
/**
* Set the responsive to the header container.
*/
responsiveHeader?: boolean;
};

export class EuiAccordion extends Component<
Expand Down Expand Up @@ -113,6 +117,7 @@ export class EuiAccordion extends Component<
extraAction,
paddingSize,
initialIsOpen,
responsiveHeader,
...rest
} = this.props;

Expand Down Expand Up @@ -145,7 +150,10 @@ export class EuiAccordion extends Component<

return (
<div className={classes} {...rest}>
<EuiFlexGroup gutterSize="none" alignItems="center">
<EuiFlexGroup
gutterSize="none"
alignItems="center"
responsive={responsiveHeader}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @sulemanof ! I actually think this just has been overlooked since there are few instances of accordions using the extra actions. However, I don't think there's a reason responsive should ever be true. The inner label will just wrap and everything else will just stay center aligned. How about we remove this new prop and just change this to be

Suggested change
responsive={responsiveHeader}>
responsive={false}>

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, looking at @maryia-lapata's PR and the nested craziness of selectors in this file https://github.com/elastic/kibana/pull/40866/files#diff-1235e98f96e13b1964ee5a0e1b0ff94d makes me think we need to remove the EuiFlexGroup dependency all together from EuiAccordion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's largely due to the negative margin issue with our flex system. It causes really dumb problems with anything that has an overflow applied (like accordion). #937

We could either address it there or simply make something more specific in accordion like you mention. Likely though, people would just add flex groups back into it for more complicated layouts.

<EuiFlexItem>
<button
aria-controls={id}
Expand Down