fix item remove button in item search
Huh, weird how we seem to need preventDefault for buttons, but stopPropagation for links? idk, in any case, the Remove button was doing that thing where it clicks Remove but also bubbles up to the container and clicks it too :p
This commit is contained in:
parent
8c653ce879
commit
1efc1c0d42
1 changed files with 10 additions and 8 deletions
|
@ -59,7 +59,10 @@ function Item({ item, itemNameId, isWorn, isInOutfit, dispatchToOutfit }) {
|
||||||
<ItemActionButton
|
<ItemActionButton
|
||||||
icon={<EditIcon />}
|
icon={<EditIcon />}
|
||||||
label="Support"
|
label="Support"
|
||||||
onClick={() => setSupportDrawerIsOpen(true)}
|
onClick={(e) => {
|
||||||
|
setSupportDrawerIsOpen(true);
|
||||||
|
e.preventDefault();
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</SupportOnly>
|
</SupportOnly>
|
||||||
<ItemActionButton
|
<ItemActionButton
|
||||||
|
@ -68,14 +71,16 @@ function Item({ item, itemNameId, isWorn, isInOutfit, dispatchToOutfit }) {
|
||||||
href={`https://impress.openneo.net/items/${
|
href={`https://impress.openneo.net/items/${
|
||||||
item.id
|
item.id
|
||||||
}-${item.name.replace(/ /g, "-")}`}
|
}-${item.name.replace(/ /g, "-")}`}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
/>
|
/>
|
||||||
{isInOutfit && (
|
{isInOutfit && (
|
||||||
<ItemActionButton
|
<ItemActionButton
|
||||||
icon={<DeleteIcon />}
|
icon={<DeleteIcon />}
|
||||||
label="Remove"
|
label="Remove"
|
||||||
onClick={() =>
|
onClick={(e) => {
|
||||||
dispatchToOutfit({ type: "removeItem", itemId: item.id })
|
dispatchToOutfit({ type: "removeItem", itemId: item.id });
|
||||||
}
|
e.preventDefault();
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -233,10 +238,7 @@ function ItemActionButton({ icon, label, href, onClick }) {
|
||||||
color="gray.400"
|
color="gray.400"
|
||||||
href={href}
|
href={href}
|
||||||
target={href ? "_blank" : null}
|
target={href ? "_blank" : null}
|
||||||
onClick={(e) => {
|
onClick={onClick}
|
||||||
if (onClick) onClick();
|
|
||||||
e.stopPropagation();
|
|
||||||
}}
|
|
||||||
className={css`
|
className={css`
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
|
|
Loading…
Reference in a new issue