Skip to content

Commit fff1914

Browse files
committed
[fixed] pass culture to View
1 parent f5e179c commit fff1914

File tree

6 files changed

+58
-30944
lines changed

6 files changed

+58
-30944
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
react-big-calendar
22
========================
33

4-
An event Calendar component built for React. Inspired by [Full Calendar](http://fullcalendar.io/).
4+
An event Calendar component built for React.
55

6+
[__DEMO and Docs__](http://intljusticemission.github.io/react-big-calendar/examples/index.html).
67
big calendar is built for modern browsers (read: ie10+) and uses flexbox over the classic tables-ception approach.
78

8-
[__DEMO__](http://jquense.github.io/react-big-calendar/examples/index.html)
9-
109
To run the example locally, `git clone`, `npm install` and `npm run examples`, hosted at localhost:3000.
1110

11+
Inspired by [Full Calendar](http://fullcalendar.io/).
12+
1213
## Use and Setup
1314

1415
`npm install react-big-calendar --save`
1516

1617
Include `react-big-calendar/lib/css/react-big-calendar.css` for styles.
1718

18-
1919
### Localization and Date Formatting
2020

2121
`react-big-calendar` includes two options for handling the date formatting and culture localization, depending

examples/Api.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let Api = React.createClass({
1515

1616
return (
1717
<div {...this.props}>
18-
<h1><a href='#api'>API</a></h1>
18+
<h1 id='api'><a href='#api'>API</a></h1>
1919
<p dangerouslySetInnerHTML={{ __html: calData.descHtml }} />
2020

2121
<h2>Props</h2>
@@ -35,7 +35,7 @@ let Api = React.createClass({
3535

3636
return (
3737
<section>
38-
<Heading>
38+
<Heading id={`prop-${name}`}>
3939
<a href={`#prop-${name}`}>
4040
<code>{name}</code>
4141
</a>

examples/App.js

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const Example = React.createClass({
2424
let Current = {
2525
basic: require('./demos/basic'),
2626
selectable: require('./demos/selectable'),
27+
cultures: require('./demos/cultures'),
2728
popup: require('./demos/popup'),
2829
rendering: require('./demos/rendering')
2930
}[selected];
@@ -54,6 +55,9 @@ const Example = React.createClass({
5455
<li className={cn({active: selected === 'selectable' })}>
5556
<a href='#' onClick={this.select.bind(null, 'selectable')}>Selectable</a>
5657
</li>
58+
<li className={cn({active: selected === 'cultures' })}>
59+
<a href='#' onClick={this.select.bind(null, 'cultures')}>I18n and Locales</a>
60+
</li>
5761
<li className={cn({active: selected === 'popup' })}>
5862
<a href='#' onClick={this.select.bind(null, 'popup')}>Popup</a>
5963
</li>

examples/demos/cultures.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from 'react';
2+
import BigCalendar from 'react-big-calendar';
3+
import events from '../events';
4+
5+
require('globalize/lib/cultures/globalize.culture.en-GB');
6+
require('globalize/lib/cultures/globalize.culture.es');
7+
require('globalize/lib/cultures/globalize.culture.fr');
8+
require('globalize/lib/cultures/globalize.culture.ar-AE');
9+
10+
let Cultures = React.createClass({
11+
12+
getInitialState(){
13+
return { culture: 'fr' }
14+
},
15+
16+
render(){
17+
let cultures = ['en', 'en-GB', 'es', 'fr', 'ar-AE']
18+
19+
return (
20+
<div>
21+
<h3 style={{ marginBottom: 20 }}>
22+
<label>Select a Culture</label>
23+
{' '}
24+
<select
25+
defaultValue={'fr'}
26+
onChange={e => this.setState({ culture: e.target.value })}
27+
>
28+
{
29+
cultures.map((c, idx) =>
30+
<option key={idx} value={c}>{c}</option>
31+
)
32+
}
33+
</select>
34+
</h3>
35+
<BigCalendar
36+
events={events}
37+
culture={this.state.culture}
38+
defaultDate={new Date(2015, 3, 1)}
39+
/>
40+
</div>
41+
)
42+
}
43+
})
44+
45+
export default Cultures;

0 commit comments

Comments
 (0)