UNPKG

@gechiui/block-editor

Version:
51 lines (49 loc) 1.76 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import { createElement } from "@gechiui/element"; /** * External dependencies */ import classnames from 'classnames'; /** * GeChiUI dependencies */ import { safeDecodeURI, filterURLForDisplay } from '@gechiui/url'; import { __ } from '@gechiui/i18n'; import { Button, TextHighlight } from '@gechiui/components'; import { Icon, globe } from '@gechiui/icons'; export const LinkControlSearchItem = _ref => { let { itemProps, suggestion, isSelected = false, onClick, isURL = false, searchTerm = '', shouldShowType = false } = _ref; return createElement(Button, _extends({}, itemProps, { onClick: onClick, className: classnames('block-editor-link-control__search-item', { 'is-selected': isSelected, 'is-url': isURL, 'is-entity': !isURL }) }), isURL && createElement(Icon, { className: "block-editor-link-control__search-item-icon", icon: globe }), createElement("span", { className: "block-editor-link-control__search-item-header" }, createElement("span", { className: "block-editor-link-control__search-item-title" }, createElement(TextHighlight, { text: suggestion.title, highlight: searchTerm })), createElement("span", { "aria-hidden": !isURL, className: "block-editor-link-control__search-item-info" }, !isURL && (filterURLForDisplay(safeDecodeURI(suggestion.url)) || ''), isURL && __('按回车件以添加此链接'))), shouldShowType && suggestion.type && createElement("span", { className: "block-editor-link-control__search-item-type" }, suggestion.type === 'post_tag' ? 'tag' : suggestion.type)); }; export default LinkControlSearchItem; //# sourceMappingURL=search-item.js.map