StoreCategories.jsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // styling
  2. import styled from 'styled-components/macro';
  3. import theme from 'styled-theming';
  4. // components
  5. import Spring from '@components/Spring';
  6. import BasicCheckbox from '@ui/BasicCheckbox';
  7. // hooks
  8. import {useThemeProvider} from '@contexts/themeContext';
  9. const Category = styled.div`
  10. .item {
  11. position: relative;
  12. &_qty {
  13. position: absolute;
  14. color: ${theme('theme', {
  15. light: 'var(--btn-text-light)',
  16. dark: '#B0B7A1'
  17. })};
  18. &.ltr {
  19. margin: -4px 0 0 8px;
  20. }
  21. &.rtl {
  22. margin: -4px 8px 0 0;
  23. }
  24. }
  25. }
  26. `;
  27. const StoreCategories = ({standalone = true}) => {
  28. const {direction} = useThemeProvider();
  29. const Wrapper = standalone ? Spring : 'div';
  30. const wrapperProps = standalone ? {className: 'card d-flex flex-column g-20 card-padded'} : {className: 'd-flex flex-column g-20'};
  31. const data = [
  32. {id: 'swim', name: 'Swimwear', qty: 24},
  33. {id: 'hoodies', name: 'Hoodies & Sweatshirts', qty: 72},
  34. {id: 'tshirts', name: 'T-shirts', qty: 59},
  35. {id: 'jackets', name: 'Jackets', qty: 31}
  36. ];
  37. return (
  38. <Wrapper {...wrapperProps}>
  39. <h3>Categories</h3>
  40. <div className="d-flex flex-column g-12">
  41. {
  42. data.map(item => (
  43. <Category className="d-flex align-items-center g-12" key={item.id}>
  44. <BasicCheckbox id={item.id} color="grass"/>
  45. <label className="item text-16" htmlFor={item.id}>
  46. {item.name}
  47. <span className={`item_qty h6 ${direction}`}>{item.qty}</span>
  48. </label>
  49. </Category>
  50. ))
  51. }
  52. </div>
  53. </Wrapper>
  54. )
  55. }
  56. export default StoreCategories