Skip to content
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 10 commits into from
Apr 17, 2019
6 changes: 6 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,12 @@
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/popover/README.md",
"parent": "components"
},
{
"title": "HorizontalRule",
Copy link
Member

Choose a reason for hiding this comment

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

Automation works :)

Copy link
Contributor Author

@koke koke Apr 17, 2019

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

"slug": "horizontal-rule",
"markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/primitives/horizontal-rule/README.md",
"parent": "components"
},
{
"title": "Svg",
"slug": "svg",
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export const registerCoreBlocks = () => {
more,
image,
nextpage,
separator,
list,
].forEach( ( { metadata, name, settings } ) => {
registerBlockType( name, {
Expand Down
7 changes: 6 additions & 1 deletion packages/block-library/src/separator/edit.js
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 } />;
}
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
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
Expand Down
13 changes: 13 additions & 0 deletions packages/components/src/primitives/horizontal-rule/README.md
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 />
);
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const HorizontalRule = 'hr';
16 changes: 16 additions & 0 deletions packages/components/src/primitives/horizontal-rule/index.native.js
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 } />
);
};
1 change: 1 addition & 0 deletions packages/components/src/primitives/index.js
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