import React from 'react'; import PropTypes from 'prop-types'; import './ImagePackItem.scss'; import { openReusableContextMenu } from '../../../client/action/navigation'; import { getEventCords } from '../../../util/common'; import Avatar from '../../atoms/avatar/Avatar'; import Text from '../../atoms/text/Text'; import Button from '../../atoms/button/Button'; import RawIcon from '../../atoms/system-icons/RawIcon'; import IconButton from '../../atoms/button/IconButton'; import ImagePackUsageSelector from './ImagePackUsageSelector'; import ChevronBottomIC from '../../../../public/res/ic/outlined/chevron-bottom.svg'; import PencilIC from '../../../../public/res/ic/outlined/pencil.svg'; import BinIC from '../../../../public/res/ic/outlined/bin.svg'; function ImagePackItem({ url, shortcode, usage, onUsageChange, onDelete, onRename, }) { const handleUsageSelect = (event) => { openReusableContextMenu( 'bottom', getEventCords(event, '.btn-surface'), (closeMenu) => ( { onUsageChange(shortcode, newUsage); closeMenu(); }} /> ), ); }; return (
{shortcode}
{onRename && onRename(shortcode)} />} {onDelete && onDelete(shortcode)} />}
); } ImagePackItem.defaultProps = { onUsageChange: null, onDelete: null, onRename: null, }; ImagePackItem.propTypes = { url: PropTypes.string.isRequired, shortcode: PropTypes.string.isRequired, usage: PropTypes.oneOf(['emoticon', 'sticker', 'both']).isRequired, onUsageChange: PropTypes.func, onDelete: PropTypes.func, onRename: PropTypes.func, }; export default ImagePackItem;