@wordpress/block-library
Version:
Block library for the WordPress editor.
53 lines (48 loc) • 1.26 kB
JavaScript
import { createElement } from "@wordpress/element";
/**
* External dependencies
*/
import { View } from 'react-native';
import Hr from 'react-native-hr';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { withPreferredColorScheme } from '@wordpress/compose';
/**
* Internal dependencies
*/
import styles from './editor.scss';
export class MoreEdit extends Component {
constructor() {
super(...arguments);
this.state = {
defaultText: __('Read more')
};
}
render() {
const {
attributes,
getStylesFromColorScheme
} = this.props;
const {
customText
} = attributes;
const {
defaultText
} = this.state;
const content = customText || defaultText;
const textStyle = getStylesFromColorScheme(styles.moreText, styles.moreTextDark);
const lineStyle = getStylesFromColorScheme(styles.moreLine, styles.moreLineDark);
return createElement(View, null, createElement(Hr, {
text: content,
marginLeft: 0,
marginRight: 0,
textStyle: textStyle,
lineStyle: lineStyle
}));
}
}
export default withPreferredColorScheme(MoreEdit);
//# sourceMappingURL=edit.native.js.map