mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
Fix PR review
Signed-off-by: HichamELBSI <elabbassih@gmail.com>
This commit is contained in:
parent
c484119c3e
commit
f597afd59b
@ -6,8 +6,6 @@ import { NumberInput } from '@strapi/design-system/NumberInput';
|
||||
import { TimePicker } from '@strapi/design-system/TimePicker';
|
||||
import { Select, Option } from '@strapi/design-system/Select';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { formatISO } from 'date-fns';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import DateTimePicker from '../DateTimePicker';
|
||||
|
||||
const Inputs = ({ label, onChange, options, type, value }) => {
|
||||
@ -33,13 +31,8 @@ const Inputs = ({ label, onChange, options, type, value }) => {
|
||||
clearLabel={formatMessage({ id: 'clearLabel', defaultMessage: 'Clear' })}
|
||||
ariaLabel={label}
|
||||
name="datepicker"
|
||||
onChange={date => {
|
||||
const formattedDate = formatISO(cloneDeep(date), { representation: 'date' });
|
||||
|
||||
onChange(formattedDate);
|
||||
}}
|
||||
onClear={() => onChange('')}
|
||||
// selectedDate={value || null}
|
||||
onChange={date => onChange(date.toISOString())}
|
||||
onClear={() => onChange(null)}
|
||||
selectedDate={value ? new Date(value) : null}
|
||||
selectedDateLabel={formattedDate => `Date picker, current is ${formattedDate}`}
|
||||
/>
|
||||
@ -52,12 +45,8 @@ const Inputs = ({ label, onChange, options, type, value }) => {
|
||||
clearLabel={formatMessage({ id: 'clearLabel', defaultMessage: 'Clear' })}
|
||||
ariaLabel={label}
|
||||
name="datetimepicker"
|
||||
onChange={date => {
|
||||
const formattedDate = new Date(date).toISOString();
|
||||
|
||||
onChange(formattedDate);
|
||||
}}
|
||||
onClear={() => onChange('')}
|
||||
onChange={date => onChange(date.toISOString())}
|
||||
onClear={() => onChange(null)}
|
||||
value={value ? new Date(value) : null}
|
||||
selectedDateLabel={formattedDate => `Date picker, current is ${formattedDate}`}
|
||||
/>
|
||||
|
||||
@ -17,7 +17,7 @@ import Plus from '@strapi/icons/Plus';
|
||||
import FilterValueInput from './FilterValueInput';
|
||||
import getFilterList from './utils/getFilterList';
|
||||
|
||||
const FilterPopover = ({ displayedFilters, filters, onSubmit, onToggle, source, onBlur }) => {
|
||||
const FilterPopover = ({ displayedFilters, filters, onSubmit, onToggle, source }) => {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
const [modifiedData, setModifiedData] = useState({
|
||||
@ -192,7 +192,7 @@ const FilterPopover = ({ displayedFilters, filters, onSubmit, onToggle, source,
|
||||
|
||||
return (
|
||||
<>
|
||||
<Popover source={source} padding={3} spacing={4} onBlur={onBlur}>
|
||||
<Popover source={source} padding={3} spacing={4}>
|
||||
<FocusTrap onEscape={onToggle}>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<Stack size={1} style={{ minWidth: 184 }}>
|
||||
@ -257,9 +257,6 @@ const FilterPopover = ({ displayedFilters, filters, onSubmit, onToggle, source,
|
||||
);
|
||||
};
|
||||
|
||||
FilterPopover.defaultProps = {
|
||||
onBlur: () => null,
|
||||
};
|
||||
FilterPopover.propTypes = {
|
||||
displayedFilters: PropTypes.arrayOf(
|
||||
PropTypes.shape({
|
||||
@ -269,7 +266,6 @@ FilterPopover.propTypes = {
|
||||
})
|
||||
).isRequired,
|
||||
filters: PropTypes.array.isRequired,
|
||||
onBlur: PropTypes.func,
|
||||
onSubmit: PropTypes.func.isRequired,
|
||||
onToggle: PropTypes.func.isRequired,
|
||||
source: PropTypes.shape({ current: PropTypes.instanceOf(Element) }).isRequired,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user