Skip to content

Commit

Permalink
chore(TimePicker): updated size prop for v11 (#10944)
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandra Davila <aledavila@ibm.com>
  • Loading branch information
sstrubberg and Alessandra Davila authored Mar 15, 2022
1 parent f308fd7 commit ee251fd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
3 changes: 1 addition & 2 deletions packages/react/src/components/TimePicker/TimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ export default class TimePicker extends Component {
placeholder: PropTypes.string,

/**
* Specify the size of the Time Picker. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
* TODO V11: remove `xl` (replaced with lg)
* Specify the size of the Time Picker.
*/
size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl']),

Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/TimePicker/next/TimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const TimePicker = React.forwardRef(function TimePicker(
onBlur = () => {},
pattern = '(1[012]|[1-9]):[0-5][0-9](\\s)?',
placeholder = 'hh:mm',
size,
size = 'md',
type = 'text',
value,
...rest
Expand Down Expand Up @@ -211,7 +211,7 @@ TimePicker.propTypes = {
placeholder: PropTypes.string,

/**
* Specify the size of the Time Picker. Currently supports either `sm`, 'md' (default) or 'lg` as an option.
* Specify the size of the Time Picker.
*/
size: PropTypes.oneOf(['sm', 'md', 'lg']),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,24 @@ import { Layer } from '../../Layer';
export default {
title: 'Components/TimePicker',
component: TimePicker,
argTypes: {
size: {
options: ['sm', 'md', 'lg'],
control: { type: 'select' },
},
},
args: {
size: 'md',
},
subcomponents: {
TimePickerSelect,
SelectItem,
},
};

export const Default = () => {
export const Default = (args) => {
return (
<TimePicker id="time-picker" labelText="Select a time">
<TimePicker id="time-picker" labelText="Select a time" {...args}>
<TimePickerSelect id="time-picker-select-1">
<SelectItem value="AM" text="AM" />
<SelectItem value="PM" text="PM" />
Expand All @@ -75,10 +84,10 @@ export const Default = () => {
);
};

export const WithLayer = () => {
export const WithLayer = (args) => {
return (
<>
<TimePicker id="time-picker" labelText="First layer">
<TimePicker id="time-picker" labelText="First layer" {...args}>
<TimePickerSelect id="time-picker-select-1">
<SelectItem value="AM" text="AM" />
<SelectItem value="PM" text="PM" />
Expand All @@ -89,7 +98,7 @@ export const WithLayer = () => {
</TimePickerSelect>
</TimePicker>
<Layer>
<TimePicker id="time-picker" labelText="Second layer">
<TimePicker id="time-picker" labelText="Second layer" {...args}>
<TimePickerSelect id="time-picker-select-1">
<SelectItem value="AM" text="AM" />
<SelectItem value="PM" text="PM" />
Expand All @@ -100,7 +109,7 @@ export const WithLayer = () => {
</TimePickerSelect>
</TimePicker>
<Layer>
<TimePicker id="time-picker" labelText="Third layer">
<TimePicker id="time-picker" labelText="Third layer" {...args}>
<TimePickerSelect id="time-picker-select-1">
<SelectItem value="AM" text="AM" />
<SelectItem value="PM" text="PM" />
Expand Down
3 changes: 0 additions & 3 deletions packages/styles/scss/components/time-picker/_time-picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
max-height: rem(32px);
}

// TODO V11: Remove xl selector
.#{$prefix}--time-picker--xl .#{$prefix}--select-input,
.#{$prefix}--time-picker--xl .#{$prefix}--time-picker__input-field,
.#{$prefix}--time-picker--lg .#{$prefix}--select-input,
.#{$prefix}--time-picker--lg .#{$prefix}--time-picker__input-field {
height: rem(48px);
Expand Down

0 comments on commit ee251fd

Please sign in to comment.