| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
PatternFly-React preview: https://patternfly-react-pr-2816.surge.sh |
Sorry, something went wrong.
|
fixed merge conflicts |
Sorry, something went wrong.
|
Hi @boaz0 , what i meant is that we don't need to code duplication, we can simply fix the conditionals. {label !== '' || labelOff !== '' ? (
<React.Fragment>
<span className={css(styles.switchToggle)} />
<span
className={css(styles.switchLabel, styles.modifiers.on)}
id={isAriaLabelledBy ? `${this.id}-on` : null}
aria-hidden="true"
>
{label}
</span>
<span
className={css(styles.switchLabel, styles.modifiers.off)}
id={isAriaLabelledBy ? `${this.id}-off` : null}
aria-hidden="true"
>
{labelOff}
</span>
</React.Fragment>
) : (
<span className={css(styles.switchToggle)}>
<div className={css(styles.switchToggleIcon)} aria-hidden="true">
<CheckIcon noVerticalAlign />
</div>
</span>
)}
After: {label !== '' ? (
<React.Fragment>
<span className={css(styles.switchToggle)} />
<span
className={css(styles.switchLabel, styles.modifiers.on)}
id={isAriaLabelledBy ? `${this.id}-on` : null}
aria-hidden="true"
>
{label}
</span>
<span
className={css(styles.switchLabel, styles.modifiers.off)}
id={isAriaLabelledBy ? `${this.id}-off` : null}
aria-hidden="true"
>
{labelOff || label}
</span>
</React.Fragment>
) : (
<span className={css(styles.switchToggle)}>
<div className={css(styles.switchToggleIcon)} aria-hidden="true">
<CheckIcon noVerticalAlign />
</div>
</span>
)}
|
Sorry, something went wrong.
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What:
Add a check if label is set but not labelOff - in that case display label on both labels.
if both label and labelOff are set display in the new format
Otherwise - display switch without labels.
Added tests to verify that if labelOff not given the label is shown.
fixes #2814
//cc @spytec