-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
HorizontalRule component for cross-platform separator block #14361
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d632f74
Port separator block to mobile
koke 7336885
Default style for Hr on native
koke dc7bab2
Rename Hr primitive to HorizontalRule
koke 913bbe0
Improved prop handling on HorizontalRule
koke c106ea3
Merge branch 'master' into rnmobile/separator-block
koke 8616d45
Fix HorizontalRule import after renaming
koke 842c6be
Add HorizontalRule README
koke 3b24f25
Add Usage section to HorizontalRule README
koke 48ab935
Add Changelog entry for HorizontalRule
koke ad913ef
Expand definition of HorizontalRule from MDN documentation
gziolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,3 +1,8 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { HorizontalRule } from '@wordpress/components'; | ||
|
||
export default function SeparatorEdit( { className } ) { | ||
return <hr className={ className } />; | ||
return <HorizontalRule className={ className } />; | ||
} |
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,3 +1,7 @@ | ||
## 7.4.0 (Unreleased) | ||
|
||
- Added a new `HorizontalRule` component. | ||
|
||
## 7.3.0 (2019-04-16) | ||
|
||
### New Features | ||
|
13 changes: 13 additions & 0 deletions
13
packages/components/src/primitives/horizontal-rule/README.md
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# HorizontalRule | ||
|
||
A drop-in replacement for the HTML [hr](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/hr) element that works both on the web and in the mobile apps. It represents a thematic break between paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section. | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { HorizontalRule } from '@wordpress/components'; | ||
|
||
const MyHorizontalRule = () => ( | ||
<HorizontalRule /> | ||
); | ||
``` |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export const HorizontalRule = 'hr'; |
16 changes: 16 additions & 0 deletions
16
packages/components/src/primitives/horizontal-rule/index.native.js
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import Hr from 'react-native-hr'; | ||
|
||
export const HorizontalRule = ( props ) => { | ||
const lineStyle = { | ||
backgroundColor: '#555d66', | ||
height: 2, | ||
...props.lineStyle, | ||
}; | ||
|
||
return ( | ||
<Hr { ...props } lineStyle={ lineStyle } /> | ||
); | ||
}; |
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 +1,2 @@ | ||
export * from './svg'; | ||
export * from './horizontal-rule'; | ||
koke marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automation works :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of 😁
I think this was generated by the precommit hook, but not included in the commit that added the README. I only noticed it because I did a second commit with the Usage section