Skip to content

Commit

Permalink
fix(input-button): fix input button active style (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
berber1016 committed Dec 16, 2021
1 parent b6508e0 commit 1f11cce
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/cascader/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export const Cascader: React.FC<CascaderProps> = ({
maxWidth={maxWidth}
size={size}
style={style}
visible={visible}
className={className}
disabled={disabled}
allowClear={allowClear}
Expand Down
4 changes: 2 additions & 2 deletions src/cascader/Trigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import WithRef from '../utils/withRef';
import { TriggerProps } from './interfance';

const Trigger: React.ForwardRefRenderFunction<HTMLInputElement, TriggerProps> = (props, ref) => {
const { value, placeholder, ...rest } = props;
return <Input.Button placeholder={placeholder} ref={ref} value={value?.toString()} {...rest} />;
const { value, placeholder, visible, ...rest } = props;
return <Input.Button placeholder={placeholder} active={visible} ref={ref} value={value?.toString()} {...rest} />;
};

export default WithRef(Trigger);
1 change: 1 addition & 0 deletions src/cascader/interfance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ export interface OptionProps extends ListOptionProps {

export interface TriggerProps extends Omit<InputButtonProps, 'value' | 'active'> {
value?: string | number;
visible?: boolean;
}
6 changes: 4 additions & 2 deletions src/input/InputButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CloseCircleFilled, DownFilled } from '@gio-design/icons';
import { usePrefixCls } from '@gio-design/utils';
import classNames from 'classnames';
import React, { useCallback, useMemo } from 'react';
import React, { useCallback, useEffect, useMemo } from 'react';
import useControlledState from '../utils/hooks/useControlledState';
import Input from './Input';
import { InputButtonProps } from './interface';
Expand Down Expand Up @@ -31,7 +31,9 @@ const InputButton = React.forwardRef<HTMLInputElement, InputButtonProps>((props,
const inputCls = usePrefixCls('input-btn__input', customizePrefixCls);

const [value, setValue] = useControlledState(enterValue, defaultValue);

useEffect(() => {
console.log('active', active);
}, [active]);
const onInputChange = useCallback(
(val: string) => {
onInputUpdate?.(val);
Expand Down
4 changes: 2 additions & 2 deletions src/input/style/InputButton.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
color: @gray-5;
.text-body1();
}
&:not(&__disabled) &__hover,
&:not(&__disabled) &__active,
&__hover:not(&__disabled),
&__active:not(&__disabled),
&:not(&__disabled):hover {
color: @blue-3;
background-color: @gray-1;
Expand Down
2 changes: 1 addition & 1 deletion src/select/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ListProps, OptionProps } from '../list';
import { InputButtonProps } from '../input/interface';
import { Placement } from '../popover/interface';
// 无group 无 multiple
export interface SelectProps extends Omit<ListProps, 'isMultiple' | 'onChange' | 'options'> {
export interface SelectProps extends Omit<ListProps, 'isMultiple' | 'onChange' | 'options' | 'collapse'> {
prefixCls?: string;
/**
* dataSource 数据源
Expand Down

1 comment on commit 1f11cce

@vercel
Copy link

@vercel vercel bot commented on 1f11cce Dec 16, 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.