1
0
Fork 0

Combine warning and options iconed buttons in one line

Signed-off-by: Egor Savkin <es@m-labs.hk>
This commit is contained in:
Egor Savkin 2023-11-27 17:12:22 +08:00
parent b7087711aa
commit 38541f8928
4 changed files with 51 additions and 48 deletions

View File

@ -255,13 +255,10 @@ button {
.item-card-name, .item-card-name,
.price { .price {
> .alert-warning, .alert-info { .alert-warning, .alert-info {
background-color: inherit; background-color: inherit;
height: inherit; height: inherit;
width: 20px; width: 20px;
padding-bottom: 3px;
}
.alert-info {
padding-bottom: 0; padding-bottom: 0;
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -655,8 +655,8 @@ class ProductCartItem extends React.PureComponent {
provided.draggableProps.style, provided.draggableProps.style,
snapshot, snapshot,
true, true,
hovered ? true : false, !!hovered,
model.selected ? true : false, !!model.selected,
true true
)}} )}}
onMouseEnter={this.handleOnMouseEnterRemoveItem.bind(this, index)} onMouseEnter={this.handleOnMouseEnterRemoveItem.bind(this, index)}
@ -664,24 +664,28 @@ class ProductCartItem extends React.PureComponent {
> >
{/* warning container */} {/* warning container */}
<OverlayTrigger
placement="bottom" <div className="progress-container warning d-flex justify-content-evenly">
trigger={warning ? ['click', 'hover', 'focus'] : []} {warning &&
overlay={ (<OverlayTrigger
({arrowProps, hasDoneInitialMeasure, show, ...props}) => ( placement="bottom"
<div className="k-popup-warning" {...props}> trigger={['click', 'hover', 'focus']}
<p className="rule warning"> overlay={
<i>{warning.message}</i> ({arrowProps, hasDoneInitialMeasure, show, ...props}) => (
</p> <div className="k-popup-warning" {...props}>
</div>) <p className="rule warning">
<i>{warning.message}</i>
</p>
</div>)
}
rootClose
>
<img className="alert-warning" src={`/images${warning.icon}`}/>
</OverlayTrigger>)
} }
rootClose
> {options && (
<div className="progress-container warning"> <OptionsDialogPopup
{warning ?
(<img className="alert-warning" src={warning ? `/images${warning.icon}` : null}/>) :
(options && (
<OptionsDialogPopup
options={options} options={options}
data={options_data} data={options_data}
options_class={model.options_class} options_class={model.options_class}
@ -699,11 +703,9 @@ class ProductCartItem extends React.PureComponent {
onCardUpdate(); onCardUpdate();
}) })
}} }}
/> />
)) )}
} </div>
</div>
</OverlayTrigger>
<h6>{model.name_number}</h6> <h6>{model.name_number}</h6>
@ -1423,30 +1425,35 @@ class OrderSumary extends React.PureComponent {
</td> </td>
<td className="price"> <td className="price">
<div> <div className="d-inline-flex align-content-center">
{`${currency} ${formatMoney(item.price)}`} {`${currency} ${formatMoney(item.price)}`}
<button onClick={this.handleOnDeleteItem.bind(this, index)}> <button onClick={this.handleOnDeleteItem.bind(this, index)}>
<img src="/images/shop/icon-remove.svg" /> <img src="/images/shop/icon-remove.svg" />
</button> </button>
<div style={{'width': '45px', 'height': '20px'}} className="d-inline-flex align-content-center align-self-center justify-content-evenly">
{(warning ? (
<img
className="alert-warning align-self-start"
src={`/images/${warning.icon}`}
/>
) : (
<span style={{
'display': 'inline-block',
'width': '20px',
}}>&nbsp;</span>
))}
{((options && options_data) ? (
<OptionsSummaryPopup id={item.id + "options"} options={options} data={options_data} />
) : (
<span style={{
'display': 'inline-block',
'width': '20px',
}}>&nbsp;</span>
))}
</div>
</div> </div>
{warning ? (
<img
style={{'marginLeft': '10px'}}
className="alert-warning"
src={`/images/${warning.icon}`}
/>
) : ( (options && options_data) ?
( <OptionsSummaryPopup id={item.id + "options"} options={options} data={options_data} /> ) : null
)}
{(!warning && !options) && (
<span style={{
'display': 'inline-block',
'width': '30px',
}}>&nbsp;</span>
)}
</td> </td>
</tr> </tr>
); );

View File

@ -423,7 +423,6 @@ export function OptionsSummaryPopup({id, options, data}) {
return ( return (
<div ref={ref}> <div ref={ref}>
<img className="alert-info" src={show ? "/images/shop/icon-close.svg" : "/images/shop/icon-customize.svg"} <img className="alert-info" src={show ? "/images/shop/icon-close.svg" : "/images/shop/icon-customize.svg"}
style={{'marginLeft': '10px'}}
id={id + "img"} id={id + "img"}
onClick={handleClick}/> onClick={handleClick}/>
<div style={{'display': show ? 'flex' : 'none', 'top': position.y, 'left': position.x}} <div style={{'display': show ? 'flex' : 'none', 'top': position.y, 'left': position.x}}