简体   繁体   English

如何将订单数量放在购物车图标上方

[英]how to put order quantity above cart icon

hello I tried to put number at top left corner of cart icon and I didnt succeeded你好,我试着把数字放在购物车图标的左上角,但我没有成功

I'm trying to get a result as in the picture enter image description here我正在尝试获得图片中的结果enter image description here

this is my code:这是我的代码:

<BagContainer>
  <Bag src={bag} hideIcons={hideIcons} title="bag" onClick={openCart}/>
  <Number>5</Number>
</BagContainer>
export const BagContainer= styled.img<{hideIcons:boolean}>`
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.8rem;
    display: ${(icon) => icon.hideIcons ? 'none' : 'inline'}

`;

export const BagContainer=styled.div`
    position: relative;
    width: fit-content;
`
export const Number=styled.span`


`
export const BagContainer = styled.img<{hideIcons:boolean}>`
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.8rem;
  display: ${(icon) => icon.hideIcons ? 'none' : 'inline'}
  position: relative;
`;

export const Number = styled.span`
  position: absolute;
  left: 0;
  top: 0;
  transform: translate3d(-50%, -50%, 0);
`;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM