Skip to content

Commit a8aa6a8

Browse files
committed
Add example
1 parent e979e11 commit a8aa6a8

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

docs-site/src/components/Examples/examples.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@
133133
color: #f00;
134134
}
135135

136+
.react-datepicker__week.highlighted {
137+
background-color: #ddffdd;
138+
border-radius: 5px;
139+
}
140+
136141
.example-custom-input {
137142
cursor: pointer;
138143
padding: 5px 15px;

docs-site/src/components/Examples/index.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import CustomDateFormat from "../../examples/customDateFormat?raw";
1818
import CustomClassName from "../../examples/customClassName?raw";
1919
import CustomCalendarClassName from "../../examples/customCalendarClassName?raw";
2020
import CustomDayClassName from "../../examples/customDayClassName?raw";
21+
import CustomWeekClassName from "../../examples/customWeekClassName?raw";
2122
import CustomTimeClassName from "../../examples/customTimeClassName?raw";
2223
import Today from "../../examples/today?raw";
2324
import PlaceholderText from "../../examples/placeholderText?raw";
@@ -222,6 +223,10 @@ export default class exampleComponents extends React.Component {
222223
title: "Custom day class name",
223224
component: CustomDayClassName,
224225
},
226+
{
227+
title: "Custom week class name",
228+
component: CustomWeekClassName,
229+
},
225230
{
226231
title: "Custom date format",
227232
component: CustomDateFormat,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
() => {
2+
const [selectedDate, setSelectedDate] = useState(new Date());
3+
return (
4+
<DatePicker
5+
selected={selectedDate}
6+
onChange={(date) => setSelectedDate(date)}
7+
weekClassName={(date) =>
8+
getDate(date) % 2 === 0 ? "highlighted" : undefined
9+
}
10+
/>
11+
);
12+
};

0 commit comments

Comments
 (0)