mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
🚚 Move Separator component
This commit is contained in:
parent
54504b7591
commit
1ca6641d77
7 changed files with 6 additions and 5 deletions
|
@ -0,0 +1,34 @@
|
|||
const Separator = ( { className = '', text = '', withLine = true } ) => {
|
||||
const separatorClass = [ 'ppcp-r-separator' ];
|
||||
const innerClass = withLine
|
||||
? 'ppcp-r-separator__line'
|
||||
: 'ppcp-r-separator__space';
|
||||
|
||||
if ( className ) {
|
||||
separatorClass.push( className );
|
||||
}
|
||||
|
||||
const getClass = ( type ) => `${ innerClass } ${ innerClass }--${ type }`;
|
||||
|
||||
const renderSeparator = () => {
|
||||
if ( text ) {
|
||||
return (
|
||||
<>
|
||||
<span className={ getClass( 'before' ) }></span>
|
||||
<span className="ppcp-r-separator__text">{ text }</span>
|
||||
<span className={ getClass( 'after' ) }></span>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return <span className={ getClass( 'full' ) }></span>;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={ separatorClass.join( ' ' ) }>
|
||||
{ renderSeparator() }
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Separator;
|
Loading…
Add table
Add a link
Reference in a new issue