GridLi.jsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { h } from 'preact'
  2. import classNames from 'classnames'
  3. function GridListItem (props) {
  4. const {
  5. className,
  6. isDisabled,
  7. restrictionError,
  8. isChecked,
  9. title,
  10. itemIconEl,
  11. showTitles,
  12. toggleCheckbox,
  13. recordShiftKeyPress,
  14. id,
  15. children,
  16. } = props
  17. const checkBoxClassName = classNames(
  18. 'uppy-u-reset',
  19. 'uppy-ProviderBrowserItem-checkbox',
  20. 'uppy-ProviderBrowserItem-checkbox--grid',
  21. { 'uppy-ProviderBrowserItem-checkbox--is-checked': isChecked },
  22. )
  23. return (
  24. <li
  25. className={className}
  26. title={isDisabled ? restrictionError?.message : null}
  27. >
  28. <input
  29. type="checkbox"
  30. className={checkBoxClassName}
  31. onChange={toggleCheckbox}
  32. onKeyDown={recordShiftKeyPress}
  33. name="listitem"
  34. id={id}
  35. checked={isChecked}
  36. disabled={isDisabled}
  37. data-uppy-super-focusable
  38. />
  39. <label
  40. htmlFor={id}
  41. aria-label={title}
  42. className="uppy-u-reset uppy-ProviderBrowserItem-inner"
  43. >
  44. {itemIconEl}
  45. {showTitles && title}
  46. {children}
  47. </label>
  48. </li>
  49. )
  50. }
  51. export default GridListItem