import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import { Formatter, Icon } from '@seafile/sf-metadata-ui-component'; import classnames from 'classnames'; import { CellType, COLUMNS_ICON_CONFIG } from '../../../metadata/metadata-view/_basic'; import { gettext } from '../../../utils/constants'; import './index.css'; const DetailItem = ({ field, value, valueId, valueClick, children, ...params }) => { const icon = useMemo(() => { if (field.type === 'size') return COLUMNS_ICON_CONFIG[CellType.NUMBER]; return COLUMNS_ICON_CONFIG[field.type]; }, [field]); return (
{field.name}
{children ? children : ()}
); }; DetailItem.defaultProps = { emptyTip: gettext('Empty') }; DetailItem.propTypes = { field: PropTypes.object.isRequired, value: PropTypes.any, children: PropTypes.any, valueId: PropTypes.string, }; export default DetailItem;