mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-14 14:21:23 +00:00
refactor(metadata): update code structure (#6765)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Editor from '../../cell-editors/rate-editor';
|
||||
import { gettext } from '../../../../utils/constants';
|
||||
|
||||
import './index.css';
|
||||
|
||||
const RateEditor = ({ value, field, onChange: onChangeAPI }) => {
|
||||
|
||||
const onChange = useCallback((update) => {
|
||||
onChangeAPI(update[field.key]);
|
||||
}, [field, onChangeAPI]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="sf-metadata-property-detail-editor sf-metadata-rate-property-detail-editor"
|
||||
placeholder={gettext('Empty')}
|
||||
>
|
||||
<Editor isCellSelected={true} field={field} value={value} onChange={onChange} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
RateEditor.propTypes = {
|
||||
value: PropTypes.number,
|
||||
field: PropTypes.object,
|
||||
onChange: PropTypes.func,
|
||||
};
|
||||
|
||||
export default RateEditor;
|
Reference in New Issue
Block a user