Skip to content

Commit

Permalink
style(input/date_picker): change input dsiabled color (#606)
Browse files Browse the repository at this point in the history
affects: @gio-design/components

change input disabled color and restore dateRangePicker's change

Co-authored-by: Jack <panjie@growingio.com>
  • Loading branch information
WORLDI and jack0pan authored Dec 15, 2020
1 parent efe5fed commit 533118f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props: DateRangePickerP
const prefixCls = usePrefixCls('date-picker', customizePrefixCls);

const calendarContainerRef = useRef(null);
const toggleContainer = useRef(null);
const [open, setOpen] = useState(false);
const [timeRange, setTimeRange] = useState(value);
const [leftInputTimeRange, setLeftInputTimeRange] = useState('');
Expand All @@ -25,18 +24,6 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props: DateRangePickerP
setTimeRange(value);
}, [value]);

const handleBlur = (event: any) => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if(open && !toggleContainer.current.contains(event.target)){
onCancel();
}
}

useEffect(() => {
window.addEventListener('click',handleBlur);
})

const onSelect = (values: Array<Moment>): void => {
setTimeRange(values);
props.onSelect?.(values);
Expand Down Expand Up @@ -136,7 +123,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = (props: DateRangePickerP
);

return (
<div className={classNames(`${prefixCls}-wrap-range`)} ref={toggleContainer}>
<div className={classNames(`${prefixCls}-wrap-range`)}>
<RcDatePicker
animation="slide-up"
calendar={calendar}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
height: 40px;
}
}
.@{date-picker-prefix-cls}-wrap-range {
width: fit-content;
}

.@{date-picker-prefix-cls}-range-input {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/input/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
}

&:disabled {
color: @palette-black-1;
color: @palette-black-2;
background-color: @palette-gray-1;
border-color: @color-border-input-disable;
cursor: not-allowed;
Expand Down
6 changes: 6 additions & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export { default as Form, FormLayout, FormProps } from './components/form';
export { default as TimePicker, TimePickerProps } from './components/time-picker';
export { default as Grid, GridProps } from './components/grid';
export { default as Cascader, CascaderProps } from './components/cascader';
export {
default as DatePicker,
DateRangePicker,
DatePickerProps,
DateRangePickerProps,
} from './components/date-picker';

// provide config context
export { ConfigContext, ConfigConsumer, withConfigConsumer } from './components/config-provider';
Expand Down

1 comment on commit 533118f

@vercel
Copy link

@vercel vercel bot commented on 533118f Dec 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.