Skip to content

Commit

Permalink
feat: add date picker component prop size
Browse files Browse the repository at this point in the history
  • Loading branch information
yvmunayev committed Sep 27, 2022
1 parent 2b5b73e commit 40938d2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/DatePicker/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface DatePickerProps extends BaseProps {
variant?: 'single' | 'double';
icon?: ReactNode;
disabledDays?: Array<Date | string>;
size?: 'small' | 'medium' | 'large';
}

export default function(props: DatePickerProps): JSX.Element | null;
5 changes: 5 additions & 0 deletions src/components/DatePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const DatePicker = React.forwardRef((props, ref) => {
selectionType,
icon: iconInProps,
disabledDays,
size,
} = useReduxForm(props);

const currentLocale = useLocale(locale);
Expand Down Expand Up @@ -129,6 +130,7 @@ const DatePicker = React.forwardRef((props, ref) => {
readOnly={readOnly}
disabled={disabled}
tabIndex={tabIndex}
size={size}
/>
<DatePickerModal
id={modalId}
Expand Down Expand Up @@ -217,6 +219,8 @@ DatePicker.propTypes = {
disabledDays: PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
),
/** The size of the input. Valid values are small, and large. */
size: PropTypes.oneOf(['small', 'medium', 'large']),
};

DatePicker.defaultProps = {
Expand Down Expand Up @@ -248,6 +252,7 @@ DatePicker.defaultProps = {
variant: 'single',
icon: undefined,
disabledDays: [],
size: 'medium',
};

export default DatePicker;
4 changes: 4 additions & 0 deletions src/components/Input/pickerInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default class Input extends Component {
hideLabel,
labelAlignment,
iconPosition,
size,
} = this.props;

return (
Expand All @@ -126,6 +127,7 @@ export default class Input extends Component {
iconPosition={iconPosition}
readOnly={readOnly}
error={error}
size={size}
>
{icon}
</StyledIconContainer>
Expand Down Expand Up @@ -189,6 +191,7 @@ Input.propTypes = {
autoComplete: PropTypes.string,
labelAlignment: PropTypes.oneOf(['left', 'center', 'right']),
hideLabel: PropTypes.bool,
size: PropTypes.oneOf(['small', 'medium', 'large']),
};

Input.defaultProps = {
Expand Down Expand Up @@ -220,4 +223,5 @@ Input.defaultProps = {
autoComplete: 'on',
labelAlignment: 'center',
hideLabel: false,
size: 'medium',
};

0 comments on commit 40938d2

Please sign in to comment.