-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Accordion): pulled in Penta updates (#9876)
* feat(Accordion): pulled in Penta updates * Updated unit tests * Updated demo app * Updated card with accordion demo
- Loading branch information
1 parent
5aae45c
commit e7ebfc0
Showing
21 changed files
with
220 additions
and
294 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
23 changes: 20 additions & 3 deletions
23
packages/react-core/src/components/Accordion/AccordionItem.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 |
---|---|---|
@@ -1,11 +1,28 @@ | ||
import * as React from 'react'; | ||
import { css } from '@patternfly/react-styles'; | ||
import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; | ||
import { AccordionItemContext } from './AccordionContext'; | ||
|
||
export interface AccordionItemProps { | ||
/** Content rendered inside the Accordion item */ | ||
/** Content rendered inside the accordion item. */ | ||
children?: React.ReactNode; | ||
/** Additional classes added to the accordion item. */ | ||
className?: string; | ||
/** Flag to indicate whether the accordion item is expanded. */ | ||
isExpanded?: boolean; | ||
} | ||
|
||
export const AccordionItem: React.FunctionComponent<AccordionItemProps> = ({ children = null }: AccordionItemProps) => ( | ||
<React.Fragment>{children}</React.Fragment> | ||
export const AccordionItem: React.FunctionComponent<AccordionItemProps> = ({ | ||
children = null, | ||
className, | ||
isExpanded: isExpandedProp = false | ||
}: AccordionItemProps) => ( | ||
<AccordionItemContext.Provider | ||
value={{ | ||
isExpanded: isExpandedProp | ||
}} | ||
> | ||
<div className={css(styles.accordionItem, isExpandedProp && styles.modifiers.expanded, className)}>{children}</div> | ||
</AccordionItemContext.Provider> | ||
); | ||
AccordionItem.displayName = 'AccordionItem'; |
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.