MediaFolder.js
5 years ago
MediaItem.js
5 years ago
MediaPopup.js
2 weeks ago
MediaPopup.scss
2 weeks ago
MediaPopupTemplate.js
2 weeks ago
MediaPopupTemplate.scss
2 weeks ago
chunk-upload.js
5 years ago
MediaFolder.js
44 lines
| 1 | export default ({ item, onClick, className }) => { |
| 2 | function bytesToSize(bytes) { |
| 3 | var sizes = ["Bytes", "KB", "MB", "GB", "TB"]; |
| 4 | if (bytes == 0) return "0 Byte"; |
| 5 | var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); |
| 6 | return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i]; |
| 7 | } |
| 8 | |
| 9 | function formatDate(date) { |
| 10 | return new Date(date).toLocaleString(); |
| 11 | } |
| 12 | |
| 13 | return ( |
| 14 | <div |
| 15 | className={`presto-player__media-list-item ${className}`} |
| 16 | onClick={onClick} |
| 17 | > |
| 18 | <div className="presto-player__media-list-item-icon"> |
| 19 | <svg |
| 20 | xmlns="http://www.w3.org/2000/svg" |
| 21 | width="24" |
| 22 | height="24" |
| 23 | viewBox="0 0 24 24" |
| 24 | fill="none" |
| 25 | stroke="currentColor" |
| 26 | strokeWidth="2" |
| 27 | strokeLinecap="round" |
| 28 | strokeLinecap="round" |
| 29 | > |
| 30 | <polygon points="23 7 16 12 23 17 23 7"></polygon> |
| 31 | <rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect> |
| 32 | </svg> |
| 33 | </div> |
| 34 | <div className="presto-player__media-list-item-title">{item?.title}</div> |
| 35 | <div className="presto-player__media-list-item-size"> |
| 36 | {bytesToSize(item?.size)} |
| 37 | </div> |
| 38 | <div className="presto-player__media-list-item-modified"> |
| 39 | {formatDate(item.updated_at)} |
| 40 | </div> |
| 41 | </div> |
| 42 | ); |
| 43 | }; |
| 44 |