| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| import { AngleRightIcon } from '@patternfly/react-icons'; | ||
| import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; | ||
| import { AccordionContext } from './Accordion'; | ||
| import { ApplicationLauncherPosition } from '../ApplicationLauncher/applicationLauncherConstants'; |
There was a problem hiding this comment.
this should not be here
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, the price of auto-import-on-tab-completion.
Sorry, something went wrong.
| <button | ||
| id={id} | ||
| className={css(styles.accordionToggle, isExpanded && styles.modifiers.expanded, className)} | ||
| {...props} |
There was a problem hiding this comment.
would you mind making {...props} the last attribute
Sorry, something went wrong.
| ); | ||
| export const AccordionContext = React.createContext({ headingLevel: 'h3' }); | ||
|
|
||
| export const HeadingLevelTypes = { |
There was a problem hiding this comment.
Why is this needed? I think we can just pass headingLevel through into context
Sorry, something went wrong.
There was a problem hiding this comment.
Do you mean I should just set AccordionContext = React.createContext(); ?
Sorry, something went wrong.
There was a problem hiding this comment.
I think this const is good to have for the consumer (it'll be the same as enums we export elsewhere, when this is ported over to the typescript version) but Joachim is saying that on line 18 we don't need const HeadingLevel = HeadingLevelTypes[headingLevel];, we can just pass lowercase-h headingLevel into the provider. The HeadingLevelTypes object doesn't really do anything for us internally, it's just for the consumer
Sorry, something went wrong.
|
PatternFly-React preview: https://2273-pr-patternfly-react-patternfly.surge.sh |
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #2273 +/- ##
=========================================
Coverage ? 80.63%
=========================================
Files ? 666
Lines ? 8431
Branches ? 711
=========================================
Hits ? 6798
Misses ? 1280
Partials ? 353
Continue to review full report at Codecov.
|
Sorry, something went wrong.
…nfly#2147) * Convert context selector to typescript * Fix linting and build error * Add demo and integration tests * Add typescript badge to docs * Made event argument optional
There was a problem hiding this comment.
Looking really good! I think we probably also want to add a snapshot test to https://github.com/patternfly/patternfly-react/blob/master/packages/patternfly-4/react-core/src/components/Accordion/Accordion.test.tsx that renders an accordion with a non-default headingLevel prop, just to assert that it actually renders the alternate heading tag in the snapshot.
Sorry, something went wrong.
| h6 = 'h6' | ||
| } | ||
|
|
||
| // declare global { |
There was a problem hiding this comment.
We can fully remove this now.
Sorry, something went wrong.
|
|
||
| export const AccordionContext = React.createContext('h3'); | ||
|
|
||
| export enum HeadingLevel { |
There was a problem hiding this comment.
Judging by our discussion in Slack, since the user already has TitleLevel we don't need this enum after all.
Sorry, something went wrong.
| }: AccordionProps) => ( | ||
| <dl className={css(styles.accordion, className)} aria-label={ariaLabel} {...props}> | ||
| {children} | ||
| <AccordionContext.Provider value={ headingLevel }>{children}</AccordionContext.Provider> |
There was a problem hiding this comment.
I guess we still have eslint turned off, but I think when it's eventually turned back on it'll complain about the spacing here, I think you want to remove the spaces around headingLevel here (value={headingLevel})
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you! I resolved the changes you mentioned above in this commit here
Sorry, something went wrong.
| import * as React from 'react'; | ||
| import { css } from '@patternfly/react-styles'; | ||
| import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; | ||
| import {TitleLevel} from '../Title'; |
There was a problem hiding this comment.
You don't need to import this here, it's not being used in the component itself.
Sorry, something went wrong.
| </button> | ||
| </h3> | ||
| <AccordionContext.Consumer> | ||
| {(TitleLevel: any) => ( |
There was a problem hiding this comment.
Sorry to be confusing here, but I think this is actually better off staying as HeadingLevel like it was before, since that's the name of the prop that is passed into Accordion, and it'll be more clear where this came from. TitleLevel is just the object a consumer can use to get predefined values for what they should pass into the headingLevel prop. I don't think you need any reference to TitleLevel at all in these components, you could use it maybe just in a unit test (e.g.<Accordion headingLevel={TitleLevel.h2}> ...)
Sorry, something went wrong.
There was a problem hiding this comment.
But even for the unit test, since you'd have to import it from over in the Title folder, I don't think you necessarily need to use TitleLevel in this PR at all.
Sorry, something went wrong.
| > | ||
| <TimesIcon | ||
| color="currentColor" | ||
| noVerticalAlign={false} |
Sorry, something went wrong.
There was a problem hiding this comment.
react-icons was recently updated to include this prop, pull down latest from master and rerun yarn install
Sorry, something went wrong.
…by default. (patternfly#2270) Pie chart tooltips display the x value of each slice as a tooltip label by default. Because we are doing our own calculations on the data and manually setting the x-value, this can lead to tooltips displaying array index values. Also, fix a bug where ChartDonutThreshold accessors were being used for child ChartDonutUtilization data prop.
…y-react into iss1881_copy
|
final PR is #2290 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What: closes #1881