forked from jquense/react-big-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add horizontal scrolling for wide resource calendars (jquense#921)
fix: a bunch of DnD bugs
- Loading branch information
Showing
24 changed files
with
603 additions
and
429 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,15 @@ | ||
import React from 'react' | ||
|
||
const propTypes = {} | ||
|
||
function Card({ children, className, style }) { | ||
return ( | ||
<div className={`${className || ''} card`} style={style}> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
Card.propTypes = propTypes | ||
|
||
export default Card |
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,4 @@ | ||
import React from 'react' | ||
import createSlot from 'react-tackle-box/lib/Slot' | ||
|
||
export default createSlot() |
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
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 |
---|---|---|
@@ -1,30 +1,57 @@ | ||
import React from 'react' | ||
import BigCalendar from 'react-big-calendar' | ||
import events from '../events' | ||
import ExampleControlSlot from '../ExampleControlSlot' | ||
|
||
let Selectable = ({ localizer }) => ( | ||
<React.Fragment> | ||
<h3 className="callout"> | ||
Click an event to see more info, or drag the mouse over the calendar to | ||
select a date/time range. | ||
</h3> | ||
<BigCalendar | ||
selectable | ||
events={events} | ||
localizer={localizer} | ||
defaultView={BigCalendar.Views.WEEK} | ||
scrollToTime={new Date(1970, 1, 1, 6)} | ||
defaultDate={new Date(2015, 3, 12)} | ||
onSelectEvent={event => alert(event.title)} | ||
onSelectSlot={slotInfo => | ||
alert( | ||
`selected slot: \n\nstart ${slotInfo.start.toLocaleString()} ` + | ||
`\nend: ${slotInfo.end.toLocaleString()}` + | ||
`\naction: ${slotInfo.action}` | ||
) | ||
} | ||
/> | ||
</React.Fragment> | ||
) | ||
const propTypes = {} | ||
|
||
class Selectable extends React.Component { | ||
constructor(...args) { | ||
super(...args) | ||
|
||
this.state = { events } | ||
} | ||
|
||
handleSelect = ({ start, end }) => { | ||
const title = window.prompt('New Event name') | ||
if (title) | ||
this.setState({ | ||
events: [ | ||
...this.state.events, | ||
{ | ||
start, | ||
end, | ||
title, | ||
}, | ||
], | ||
}) | ||
} | ||
|
||
render() { | ||
const { localizer } = this.props | ||
return ( | ||
<React.Fragment> | ||
<ExampleControlSlot.Entry waitForOutlet> | ||
<strong> | ||
Click an event to see more info, or drag the mouse over the calendar | ||
to select a date/time range. | ||
</strong> | ||
</ExampleControlSlot.Entry> | ||
<BigCalendar | ||
selectable | ||
localizer={localizer} | ||
events={this.state.events} | ||
defaultView={BigCalendar.Views.WEEK} | ||
scrollToTime={new Date(1970, 1, 1, 6)} | ||
defaultDate={new Date(2015, 3, 12)} | ||
onSelectEvent={event => alert(event.title)} | ||
onSelectSlot={this.handleSelect} | ||
/> | ||
</React.Fragment> | ||
) | ||
} | ||
} | ||
|
||
Selectable.propTypes = propTypes | ||
|
||
export default Selectable |
Oops, something went wrong.