FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(Divider): add divider component by christiemolloy · Pull Request #3125 · patternfly/patternfly-react · GitHub

feat(Divider): add divider component - #3125

Merged
tlabaj merged 12 commits into
patternfly:masterfrom
christiemolloy:divider
Oct 22, 2019
Merged

feat(Divider): add divider component#3125
tlabaj merged 12 commits into
patternfly:masterfrom
christiemolloy:divider

Conversation

Copy link
Copy Markdown
Member

closes #2575

Copy link
Copy Markdown
Collaborator

PatternFly-React preview: https://patternfly-react-pr-3125.surge.sh

/** Adds a role to the divider for accessibility */
'role'?: string;
/** the component type to use */
variant?: 'hr' | 'li' | 'div' ;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you call the prop component to be consistent with other components in the library

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

could you explain what you mean here :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Our other components name the prop 'component' rather than variant when we want to change the html tag.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

thanks updated

/** additional classes added to the Badge */
className?: string;
/** Adds a role to the divider for accessibility */
'role'?: string;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no need for a role prop. Looks like it should be set to separator for div or li . We should do that conditionally in in the component when the 'component prop is not an hr.

const Component: any = variant;

return (
<Component {...props} className={css(styles.divider, className)} role={role}/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you spread props at the end here so they take precedence.

<Divider/>

<ul>
<li>List item one</li>

tlabaj Oct 11, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

after you update the component you can update these to remove the role='separator'

Comment thread yarn.lock Outdated
"@patternfly/patternfly@2.33.8":
version "2.33.8"
resolved "https://registry.yarnpkg.com/@patternfly/patternfly/-/patternfly-2.33.8.tgz#2885847b4c49d8606abed17a0415da24fec222aa"
integrity sha512-tkT1GrdIyvGiDvNHATOa7XLMLKdztpra8ngS8qhCcEWBKh9MWNj5ysjOrkna32bSF9GEkR4TFX492W8ESTHWvQ==

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you revert the changes in this file. It should not have been updated with the changes you made.

tlabaj self-assigned this Oct 11, 2019

codecov-io commented Oct 11, 2019
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #3125 into master will increase coverage by 0.01%.
The diff coverage is 92.85%.

@@            Coverage Diff             @@
##           master    #3125      +/-   ##
==========================================
+ Coverage   69.02%   69.04%   +0.01%     
==========================================
  Files         858      859       +1     
  Lines       23535    23549      +14     
  Branches     1877     1880       +3     
==========================================
+ Hits        16246    16259      +13     
  Misses       6336     6336              
- Partials      953      954       +1
Flag Coverage Δ
#misc 95.45% <ø> (ø) ⬆️
#patternfly3 69.23% <ø> (ø) ⬆️
#patternfly4 68.14% <92.85%> (+0.03%) ⬆️
Impacted Files Coverage Δ
...re/src/experimental/components/Divider/Divider.tsx 92.85% <92.85%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8dcfb49...a25e8d1. Read the comment docs.

DividerLi = (
<ul>
<li>List item one</li>
<Divider variant="li" role="separator"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

you can remove role="seperator"

import { Divider } from '@patternfly/react-core/dist/esm/experimental';

DividerLi = (
<Divider variant="div" role="separator"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

you can remove role="seperator"

/** Adds a role to the divider for accessibility */
'role'?: string;
/** the component type to use */
variant?: 'hr' | 'li' | 'div' ;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Our other components name the prop 'component' rather than variant when we want to change the html tag.

const Component: any = variant;

return (
<Component className={css(styles.divider, className)} role={ variant!='hr' ? 'separator' : undefined } {...props}/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think you want to do something like this instead.

Suggested change
<Component className={css(styles.divider, className)} role={ variant!='hr' ? 'separator' : undefined } {...props}/>
<Component className={css(styles.divider, className)} {...(variant != 'hr' && {role : 'seperator' })} {...props}/>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That makes sense thank you @tlabaj !

tlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Looking great Christie. A few more small comments.

import React from 'react';
import { Divider } from '@patternfly/react-core/dist/esm/experimental';

DividerHr = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Did you mean for this to be a function? e.g.

Suggested change
DividerHr = (
DividerHr = () => (

same comment for other examples.

}

export interface DividerProps extends React.HTMLProps<HTMLElement> {
/** additional classes added to the Badge */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can you change the prop descriptions to Sentence case.

tlabaj previously approved these changes Oct 16, 2019

tlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

const Component: any = component;

return (
<Component className={css(styles.divider, className)} {...(component != 'hr' && {role : 'seperator' })} {...props} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
<Component className={css(styles.divider, className)} {...(component != 'hr' && {role : 'seperator' })} {...props} />
<Component className={css(styles.divider, className)} {...(component != 'hr' && {role : 'separator' })} {...props} />

exports[`divider using div 1`] = `
<div
className="pf-c-divider"
role="seperator"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
role="seperator"
role="separator"

exports[`divider using li 1`] = `
<li
className="pf-c-divider"
role="seperator"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
role="seperator"
role="separator"

mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

😀👍

tlabaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

tlabaj merged commit 92971d3 into patternfly:master Oct 22, 2019
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Divider Feature

6 participants


Back | FazBrowse Home | New Git URL