-
-
Notifications
You must be signed in to change notification settings - Fork 928
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Calendar,DatePicker,DateRangePicker): add support for
weekStart
(
#3814) * feat(Calendar,DatePicker,DateRangePicker): add support for `weekStart` * test: add tests for weekStart
- Loading branch information
Showing
36 changed files
with
1,095 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!--start-code--> | ||
|
||
```js | ||
import { Calendar, RadioGroup, Radio, Form, Toggle } from 'rsuite'; | ||
|
||
const App = () => { | ||
const [weekStart, setWeekStart] = React.useState(0); | ||
const [isoWeek, setIsoWeek] = React.useState(false); | ||
const [showWeekNumbers, setShowWeekNumbers] = React.useState(true); | ||
return ( | ||
<div style={{ display: 'flex' }}> | ||
<div style={{ width: 280, padding: '0 10px' }}> | ||
<Calendar | ||
bordered | ||
compact | ||
weekStart={weekStart} | ||
showWeekNumbers={showWeekNumbers} | ||
isoWeek={isoWeek} | ||
/> | ||
</div> | ||
<div style={{ borderLeft: '1px solid var(--rs-border-primary)', padding: '0 20px' }}> | ||
<Form> | ||
<Form.Group> | ||
<RadioGroup | ||
value={weekStart} | ||
onChange={value => { | ||
setWeekStart(value); | ||
setIsoWeek(false); | ||
}} | ||
inline | ||
appearance="picker" | ||
> | ||
<RadioLabel>Week start</RadioLabel> | ||
<Radio value={0}>Sun</Radio> | ||
<Radio value={1}>Mon</Radio> | ||
<Radio value={2}>Tue</Radio> | ||
<Radio value={3}>Wed</Radio> | ||
<Radio value={4}>Thu</Radio> | ||
<Radio value={5}>Fri</Radio> | ||
<Radio value={6}>Sat</Radio> | ||
</RadioGroup> | ||
</Form.Group> | ||
|
||
<Form.Group> | ||
<Form.ControlLabel> | ||
<Toggle checked={isoWeek} onChange={setIsoWeek} /> | ||
ISO week | ||
</Form.ControlLabel> | ||
</Form.Group> | ||
|
||
<Form.Group> | ||
<Form.ControlLabel> | ||
<Toggle checked={showWeekNumbers} onChange={setShowWeekNumbers} /> | ||
Show week numbers | ||
</Form.ControlLabel> | ||
</Form.Group> | ||
</Form> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const RadioLabel = ({ children }) => <label style={{ padding: 7 }}>{children}</label>; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
``` | ||
|
||
<!--end-code--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.