ColorPopup.js
2 years ago
EntitySearchDropdown.js
2 years ago
LoadSelect.js
5 years ago
ProBadge.js
5 years ago
SelectMediaDropdown.js
2 years ago
UrlSelect.js
2 years ago
VideoIcon.js
2 years ago
VideoIcon.js
57 lines
| 1 | import { __ } from "@wordpress/i18n"; |
| 2 | import { getBlockType } from "@wordpress/blocks"; |
| 3 | import { css } from "@emotion/core"; |
| 4 | |
| 5 | export default ({ thumbnail, type }) => { |
| 6 | const getIcon = () => { |
| 7 | const blockType = getBlockType(`presto-player/${type}`); |
| 8 | return blockType?.icon?.src ? ( |
| 9 | blockType.icon.src |
| 10 | ) : ( |
| 11 | <svg |
| 12 | xmlns="http://www.w3.org/2000/svg" |
| 13 | viewBox="0 0 24 24" |
| 14 | fill="currentColor" |
| 15 | className="w-6 h-6" |
| 16 | css={css` |
| 17 | color: var(--wp-admin-theme-color, #007cba); |
| 18 | `} |
| 19 | > |
| 20 | <path |
| 21 | fillRule="evenodd" |
| 22 | d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm14.024-.983a1.125 1.125 0 0 1 0 1.966l-5.603 3.113A1.125 1.125 0 0 1 9 15.113V8.887c0-.857.921-1.4 1.671-.983l5.603 3.113Z" |
| 23 | clipRule="evenodd" |
| 24 | /> |
| 25 | </svg> |
| 26 | ); |
| 27 | }; |
| 28 | |
| 29 | if (thumbnail) { |
| 30 | return ( |
| 31 | <img |
| 32 | css={css` |
| 33 | width: 24px; |
| 34 | height: 24px; |
| 35 | object-fit: cover; |
| 36 | margin-right: 8px; |
| 37 | border-radius: 3px; |
| 38 | `} |
| 39 | src={thumbnail} |
| 40 | alt="Presto video thumbnail" |
| 41 | /> |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | return ( |
| 46 | <div |
| 47 | css={css` |
| 48 | width: 24px; |
| 49 | margin-right: 8px; |
| 50 | line-height: 0; |
| 51 | `} |
| 52 | > |
| 53 | {getIcon()} |
| 54 | </div> |
| 55 | ); |
| 56 | }; |
| 57 |