Skip to content

Commit

Permalink
fix: improve style of month datepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-hv committed Dec 14, 2023
1 parent cff07b7 commit 1a5c2d3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
20 changes: 20 additions & 0 deletions docs/pages/components/date-picker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,26 @@ function () {
}
```

## Only display months

Pass `showMonthYearPicker` to only display months, without days

```jsx
function () {
const [value, setValue] = React.useState(Date.now())

const handleChange = newValue => {
setValue(newValue)
}

return (
<Field label="Date">
<DatePicker showMonthYearPicker dateFormat="MM/yyyy" name="welcome" onChange={handleChange} value={value} />
</Field>
)
}
```

## Properties

<props propTypes={props.propTypes.DatePicker} />
Expand Down
13 changes: 10 additions & 3 deletions packages/DateTimePickerCommon/src/CustomPopper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,22 @@ const StyledCustomPopper = styled.div(
.react-datepicker__day--keyboard-selected,
.react-datepicker__day--selected,
.react-datepicker__day--in-selecting-range,
.react-datepicker__day--in-range,
.react-datepicker__day--in-range {
border-radius: 50%;
&:hover {
border-radius: 50%;
}
}
.react-datepicker__month-text,
.react-datepicker__month-text--selected,
.react-datepicker__month-text--keyboard-selected,
.react-datepicker__month-text--in-selecting-range,
.react-datepicker__month-text--in-range,
.react-datepicker__month-text:hover {
border-radius: 50%;
border-radius: 2rem;
&:hover {
border-radius: 50%;
border-radius: 2rem;
}
}
Expand Down

0 comments on commit 1a5c2d3

Please sign in to comment.