Skip to content

Commit

Permalink
fix(input): fix input style feedbacks (#1425)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhang Rui <zhangrui@growingio.com>
  • Loading branch information
Ryan Zhang and Zhang Rui authored Nov 3, 2021
1 parent dc4cde5 commit 52c2000
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/input/InputButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const InputButton = React.forwardRef<HTMLInputElement, InputButtonProps>((props,
className,
style = {},
maxWidth,
active = false,
...rest
} = props;

Expand All @@ -48,8 +49,8 @@ const InputButton = React.forwardRef<HTMLInputElement, InputButtonProps>((props,
);

const wrapperCls = useMemo(
() => classNames(className, prefixCls, { [`${prefixCls}__disabled`]: disabled }),
[className, prefixCls, disabled]
() => classNames(className, prefixCls, { [`${prefixCls}__disabled`]: disabled, [`${prefixCls}__active`]: active }),
[className, prefixCls, disabled, active]
);

const prefix = useMemo(
Expand Down
5 changes: 5 additions & 0 deletions src/input/demos/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,8 @@ const InputButtonMaxWidthTemplate = (args: InputButtonProps) => (

export const InputButtonMaxWidth = InputButtonMaxWidthTemplate.bind({});
InputButtonMaxWidth.args = {};

const InputButtonActiveTemplate = (args: InputButtonProps) => <InputButton {...args} value="请选择事件" active />;

export const InputButtonActive = InputButtonActiveTemplate.bind({});
InputButtonActive.args = {};
6 changes: 6 additions & 0 deletions src/input/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ export interface InputButtonProps
* 空值时,显示的样式
*/
placeholder?: string;

/**
* 设置是否active
* @default false
*/
active?: boolean;
/**
* 当Input Button的值修改后的方法
*/
Expand Down
1 change: 1 addition & 0 deletions src/input/style/InputButton.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
outline: none;
}
}
&__active,
&:hover {
.@{input-btn-input-prefix-cls} {
color: @blue-3;
Expand Down
8 changes: 6 additions & 2 deletions src/input/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.@{input-prefix-cls} {
box-sizing: border-box;
height: 36px;
padding: 7px 12px;
padding: 6px 12px;
color: @gray-5;
font-family+: @font-family-primary;
font-family+: @font-family-number;
Expand Down Expand Up @@ -41,7 +41,7 @@
}
&__small {
height: 30px;
padding: 4px 12px;
padding: 3px 12px;
}
&__error {
border: 1px solid @red-3;
Expand All @@ -50,6 +50,8 @@
&__suffix {
position: absolute;
right: 0;
display: flex;
align-items: center;
padding-right: 12px;

&-wrapper {
Expand All @@ -76,6 +78,8 @@
&__prefix {
position: absolute;
left: 0;
display: flex;
align-items: center;
padding-left: 12px;

&-wrapper {
Expand Down
2 changes: 2 additions & 0 deletions src/popconfirm/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
&__content {
&-title {
.text-h4();
display: flex;
align-items: center;
color: @gray-5;
svg {
color: @yellow-3;
Expand Down

1 comment on commit 52c2000

@vercel
Copy link

@vercel vercel bot commented on 52c2000 Nov 3, 2021

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.