woocommerce-paypal-payments/modules/ppcp-settings/resources/js/Components/ReusableComponents/SelectBox.js

42 lines
1 KiB
JavaScript
Raw Normal View History

2024-10-23 15:24:52 +02:00
import data from '../../utils/data';
const SelectBox = ( props ) => {
2024-10-24 06:35:48 +02:00
let boxClassName = 'ppcp-r-select-box';
if ( props.value === props.currentValue ) {
boxClassName += ' selected';
}
2024-10-23 15:24:52 +02:00
return (
2024-10-24 06:35:48 +02:00
<div className={ boxClassName }>
2024-10-23 15:24:52 +02:00
<div className="ppcp-r-select-box__radio">
<input
className="ppcp-r-select-box__radio-value"
type="radio"
2024-10-24 06:35:48 +02:00
name={ props.name }
value={ props.value }
onChange={ () => props.changeCallback( props.value ) }
2024-10-23 15:24:52 +02:00
/>
<span className="ppcp-r-select-box__radio-presentation"></span>
</div>
<div className="ppcp-r-select-box__content">
{ data().getImage( props.icon ) }
<div className="ppcp-r-select-box__content-inner">
<span className="ppcp-r-select-box__title">
{ props.title }
</span>
<p className="ppcp-r-select-box__description">
{ props.description }
</p>
{ props.children && (
<div className="ppcp-r-select-box__additional-content">
{ props.children }
</div>
) }
</div>
</div>
</div>
);
};
export default SelectBox;