Skip to content

Commit 3a9fbc0

Browse files
authored
Merge pull request #1 from viniarruda/fix/month-class
fix: add variants to month classname and adjust initial year
2 parents e5d9c64 + c3ae648 commit 3a9fbc0

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Visit http://localhost:6006/
4848

4949
```typescript
5050

51+
5152
onRangeSelect: (params: RangeParams) => void
5253

5354
type RangeParams = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@viniarruda/react-month-range-picker",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"author": "Vinicius Arruda",
55
"description": "React Month Range Picker",
66
"types": "types/index.d.ts",

src/MonthRangePicker/MonthRangePicker.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ const TemplateTwoColumns: StoryFn<MonthRangePickerProps> = () => {
7676
<MonthRangePicker
7777
onRangeSelect={onRangeSelect}
7878
columns={2}
79-
initialYear={2020}
79+
initialYear={2023}
8080
locale="en-US"
81+
monthClassName="month"
8182
/>
8283
<h1>Initial: {initialDate}</h1>
8384
<h1>Final: {finalDate}</h1>

src/MonthRangePicker/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const MonthRangePicker: React.FC<MonthRangePickerProps> = ({
8080
return (
8181
<Month
8282
key={month}
83-
className={monthClassName}
83+
className={`${monthClassName}_${getVariants()}`}
8484
justify="center"
8585
disabled={isDisabled}
8686
variant={getVariants()}
@@ -92,7 +92,7 @@ export const MonthRangePicker: React.FC<MonthRangePickerProps> = ({
9292
}
9393

9494
const renderYear = (year: number) => (
95-
<Row wrap="wrap" justify="center" p="4" css={{ gap: '4px 0' }}>
95+
<Row wrap="wrap" justify="center" p="4" rowGap="4">
9696
{monthsNumber.map(month => renderMonth(year, month))}
9797
</Row>
9898
)
@@ -165,20 +165,20 @@ export const MonthRangePicker: React.FC<MonthRangePickerProps> = ({
165165
</Arrow>
166166
<Flex mx="4">
167167
<Typography color="secondary" size="14" weight="regular">
168-
{today.getFullYear() + yearOffset}
168+
{initialYear + yearOffset}
169169
</Typography>
170170
</Flex>
171171
<Flex mx="4">
172172
<Typography color="secondary" size="14" weight="regular">
173-
{today.getFullYear() + yearOffset + 1}
173+
{initialYear + yearOffset + 1}
174174
</Typography>
175175
</Flex>
176176
<Arrow onClick={handleNextYear}>
177177
<ChevronRight fill="$textSecondary" fontSize="$20" />
178178
</Arrow>
179179
</Row>
180180
<Flex gap="4">
181-
{renderYear(today.getFullYear() + yearOffset)}
181+
{renderYear(initialYear + yearOffset)}
182182
{renderYear(today.getFullYear() + yearOffset + 1)}
183183
</Flex>
184184
</Calender>

0 commit comments

Comments
 (0)