| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
|
| 3 |
// SCSS. |
| 4 |
import './GlobalFlowItem.scss'; |
| 5 |
|
| 6 |
function GlobalFlowItem( { item, isChecked, isActive } ) { |
| 7 |
const { thumbnail_image_url, title, type, is_recommanded } = item; |
| 8 |
|
| 9 |
return ( |
| 10 |
<> |
| 11 |
{ 'pro' === type ? ( |
| 12 |
<span className={ `wcf-item__type wcf-item__type--${ type }` }> |
| 13 |
{ type } |
| 14 |
</span> |
| 15 |
) : ( |
| 16 |
'' |
| 17 |
) } |
| 18 |
|
| 19 |
<div |
| 20 |
className={ `wcf-item__inner bg-white border shadow-sm relative overflow-hidden rounded-lg cursor-pointer transition-all block group hover:-translate-y-px hover:border-primary-400 hover:shadow-xl hover:shadow-primary-50 ${ |
| 21 |
isChecked || isActive |
| 22 |
? 'border-primary-400' |
| 23 |
: 'border-slate-200' |
| 24 |
}` } |
| 25 |
> |
| 26 |
{ is_recommanded && ( |
| 27 |
<span |
| 28 |
className={ `wcf-item__recommanded-badge bg-primary-500 border-primary-500 text-white absolute top-0 right-0 px-2.5 py-0.5 font-normal text-xs rounded-tr-lg rounded-bl-lg border cursor-default z-10` } |
| 29 |
> |
| 30 |
{ __( 'Recommended', 'cartflows' ) } |
| 31 |
</span> |
| 32 |
) } |
| 33 |
<div className="wcf-item__thumbnail-wrap transition-none"> |
| 34 |
<div |
| 35 |
className="wcf-item__thumbnail group-hover:transform-none bg-white relative position bg-top bg-cover bg-no-repeat overflow-hidden before:block before:pt-[100%]" |
| 36 |
style={ { |
| 37 |
backgroundImage: `url("${ thumbnail_image_url }")`, |
| 38 |
} } |
| 39 |
></div> |
| 40 |
</div> |
| 41 |
<div className="wcf-item__heading-wrap py-2.5 px-4 text-center border-t border-slate-200"> |
| 42 |
<div className="wcf-item__heading text-slate-600 text-center text-base font-semibold"> |
| 43 |
{ title } |
| 44 |
</div> |
| 45 |
</div> |
| 46 |
</div> |
| 47 |
</> |
| 48 |
); |
| 49 |
} |
| 50 |
|
| 51 |
export default GlobalFlowItem; |
| 52 |
|