Skip to content

Commit

Permalink
feat(Input): hint icon overlap (alibaba-fusion#1729)
Browse files Browse the repository at this point in the history
Co-authored-by: wb-xd391517 <[email protected]>
  • Loading branch information
xdddi and wb-xd391517 authored Apr 2, 2020
1 parent 188a761 commit 43cd5a3
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/date-picker/date-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ class DatePicker extends Component {
hint={
<Icon
type="calendar"
className={`${prefix}date-picker-symble-calendar-icon`}
className={`${prefix}date-picker-symbol-calendar-icon`}
/>
}
hasClear={allowClear}
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
vertical-align: baseline;
}

&-symble-calendar-icon::before {
&-symbol-calendar-icon::before {
content: $date-picker-calendar-icon;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/month-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ class MonthPicker extends Component {
hint={
<Icon
type="calendar"
className={`${prefix}date-picker-symble-calendar-icon`}
className={`${prefix}date-picker-symbol-calendar-icon`}
/>
}
hasClear={allowClear}
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/range-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ class RangePicker extends Component {
hint={
<Icon
type="calendar"
className={`${prefix}date-picker-symble-calendar-icon`}
className={`${prefix}date-picker-symbol-calendar-icon`}
/>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/week-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class WeekPicker extends Component {
hint={
<Icon
type="calendar"
className={`${prefix}date-picker-symble-calendar-icon`}
className={`${prefix}date-picker-symbol-calendar-icon`}
/>
}
hasClear={value && hasClear}
Expand Down
2 changes: 1 addition & 1 deletion src/date-picker/year-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class YearPicker extends Component {
hint={
<Icon
type="calendar"
className={`${prefix}date-picker-symble-calendar-icon`}
className={`${prefix}date-picker-symbol-calendar-icon`}
/>
}
hasClear={allowClear}
Expand Down
18 changes: 13 additions & 5 deletions src/input/input.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { isValidElement, cloneElement } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Icon from '../icon';
Expand Down Expand Up @@ -179,12 +179,20 @@ export default class Input extends Base {
if (hint || showClear) {
let hintIcon = null;
if (hint) {
hintIcon =
typeof hint === 'string' ? (
if (typeof hint === 'string') {
hintIcon = (
<Icon type={hint} className={`${prefix}input-hint`} />
) : (
hint
);
} else if (isValidElement(hint)) {
hintIcon = cloneElement(hint, {
className: classNames(
hint.props.className,
`${prefix}input-hint`
),
});
} else {
hintIcon = hint;
}
} else {
hintIcon = (
<Icon
Expand Down
2 changes: 1 addition & 1 deletion src/time-picker/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
box-shadow: $time-picker-panel-shadow;
}

&-symble-clock-icon::before {
&-symbol-clock-icon::before {
content: $time-picker-clock-icon;
}
}
2 changes: 1 addition & 1 deletion src/time-picker/time-picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ class TimePicker extends Component {
hint: (
<Icon
type="clock"
className={`${prefix}time-picker-symble-clock-icon`}
className={`${prefix}time-picker-symbol-clock-icon`}
/>
),
};
Expand Down

0 comments on commit 43cd5a3

Please sign in to comment.