Skip to content

Commit

Permalink
Style tweaks (#112)
Browse files Browse the repository at this point in the history
* style tweaks for time grid

* fix auto-prefixing

* [fixed] Toolbar proptype

* refresh demo page

* clean up linting

* test cm
  • Loading branch information
jquense committed Jun 9, 2016
1 parent c476a9a commit b67ace3
Show file tree
Hide file tree
Showing 25 changed files with 272 additions and 198 deletions.
10 changes: 10 additions & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const path = require('path');
const Autoprefixer = require('less-plugin-autoprefix');

module.exports = {
resolve: {
extensions: ['', '.js', '.jsx']
Expand All @@ -24,5 +26,13 @@ module.exports = {
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file'},
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml'}
]
},

lessLoader: {
lessPlugins: [
new Autoprefixer({
browsers: ['last 2 versions', 'ie >= 10']
})
]
}
};
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
sudo: false
language: node_js
node_js:
- "iojs"
- stable
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
branches:
only:
- master
2 changes: 1 addition & 1 deletion examples/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let Api = React.createClass({
let typeInfo = this.renderType(data);

return (
<section>
<section key={name}>
<Heading id={`prop-${name}`}>
<a href={`#prop-${name}`}>
<code>{name}</code>
Expand Down
6 changes: 3 additions & 3 deletions examples/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ const Example = React.createClass({
</ul>
</aside>
<div className='example'>
<div style={{ marginBottom: 15 }}>
<div className='view-source'>
<a target='_blank' href={demoRoot + '/' + selected + '.js' }>
<strong><i className='fa fa-code'/>{' view example source code'}</strong>
<strong><i className='fa fa-code'/>{' View example source code'}</strong>
</a>
</div>
<Current />
<Current className='demo' />
</div>
</div>
<div className='docs'>
Expand Down
1 change: 1 addition & 0 deletions examples/demos/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ let Basic = React.createClass({
render(){
return (
<BigCalendar
{...this.props}
events={events}
defaultDate={new Date(2015, 3, 1)}
/>
Expand Down
4 changes: 2 additions & 2 deletions examples/demos/cultures.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ let Cultures = React.createClass({
let rtl = this.state.culture === 'ar-AE';

return (
<div>
<h3 style={{ marginBottom: 20 }}>
<div {...this.props}>
<h3 className="callout">
<label>Select a Culture</label>
{' '}
<select
Expand Down
6 changes: 3 additions & 3 deletions examples/demos/popup.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { PropTypes } from 'react';
import React from 'react';
import BigCalendar from 'react-big-calendar';
import events from '../events';
let Popup = React.createClass({
render(){
return (
<div>
<h3 className='text-info text-center demo-info'>
<div {...this.props}>
<h3 className='callout'>
Click the "+x more" link on any calendar day that cannot fit all the days events to
see an inline popup of all the events.
</h3>
Expand Down
4 changes: 2 additions & 2 deletions examples/demos/rendering.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react';
import React from 'react';
import BigCalendar from 'react-big-calendar';
import events from '../events';

Expand All @@ -24,7 +24,7 @@ function EventAgenda({ event }) {
let Rendering = React.createClass({
render(){
return (
<div>
<div {...this.props}>
<BigCalendar
events={events}
defaultDate={new Date(2015, 3, 1)}
Expand Down
6 changes: 3 additions & 3 deletions examples/demos/selectable.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { PropTypes } from 'react';
import React from 'react';
import BigCalendar from 'react-big-calendar';
import events from '../events';

let Selectable = React.createClass({
render(){
return (
<div>
<h3 className='text-info text-center demo-info'>
<div {...this.props}>
<h3 className="callout">
Click an event to see more info, or
drag the mouse over the calendar to select a date/time range.
</h3>
Expand Down
49 changes: 42 additions & 7 deletions examples/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
// .panel-default {
// border-radius: 0;
// }
@blue: #3174ad;

body {
font-size: 16px;
}

.jumbotron {
background-color: #3174ad;
background-color: @blue;
color: white;

a {
Expand All @@ -17,10 +18,6 @@ body {
}
}

.example {
font-size: 14px;
}

.contain {
background-color: white;
border-radius: 3px;
Expand All @@ -30,15 +27,37 @@ body {
}

.docs {
background-color: #3174ad;
background-color: @blue;
margin-top: 20px;
padding: 30px;
}

.examples {
position: relative;
height: 100vh;
display: flex;
flex-direction: column;
}

.example {
font-size: 14px;
flex: 1;

&,
& > * {
display: flex;
flex-direction: column;
min-height: 0;
}

.demo,
.rbc-calendar {
flex: 1;
min-height: 580px;
}
}


.section {
margin-bottom: 20px;
}
Expand All @@ -48,11 +67,27 @@ aside {
}

h3 > a > code {
color: #3174ad;
color: @blue;
background: none;
padding: 0;
}

.view-source {
font-size: 90%;
float: right;
margin-bottom: 15px;
margin-left: auto;
}

.callout {
border-left: 4px solid @blue;
padding: 10px;
color: darken(@blue, 10%);
font-size: 20px;
margin-bottom: 15px;
margin-top: 0;
}

pre {
border-radius: 0;
border: none;
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@
"scripts": {
"clean": "rimraf lib",
"clean:examples": "rimraf examples/static",
"less": "lessc -x src/less/styles.less ./lib/css/react-big-calendar.css",
"less": "lessc --autoprefix=\"ie >= 10, last 2 versions\" src/less/styles.less ./lib/css/react-big-calendar.css",
"assets": "cpy src/less/* lib/less",
"build": "npm run clean && babel src --out-dir lib && npm run assets && npm run less",
"build:examples": "npm run clean:examples && webpack --config webpack/docs.config.es6.js",
"build:visual-test": "webpack --config webpack/visual-test.es6.js",
"examples": "npm run clean:examples && babel-node ./examples/server.js",
"lint": "eslint src test",
"storybook": "start-storybook -p 9002",
"test": "npm run lint && karma start --single-run",
"test": "npm run lint",
"tdd": "karma start",
"lint": "eslint src --ext .jsx --ext .js",
"release": "release"
},
"peerDependencies": {
Expand All @@ -42,7 +43,6 @@
},
"devDependencies": {
"@kadira/storybook": "^1.28.1",
"autoprefixer-core": "^5.2.1",
"babel-cli": "^6.7.5",
"babel-core": "^6.7.6",
"babel-eslint": "^6.0.2",
Expand Down Expand Up @@ -75,6 +75,7 @@
"karma-webpack": "^1.7.0",
"less": "^2.5.1",
"less-loader": "^2.2.0",
"less-plugin-autoprefix": "^1.5.1",
"lolex": "^1.4.0",
"markdown-jsx-loader": "^2.0.1",
"marked": "^0.3.5",
Expand Down
8 changes: 6 additions & 2 deletions src/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ let Calendar = React.createClass({
components: PropTypes.shape({
event: elementType,

toolbar: PropTypes.element,
toolbar: elementType,

agenda: PropTypes.shape({
date: elementType,
Expand Down Expand Up @@ -457,4 +457,8 @@ let Calendar = React.createClass({
}
});

export default uncontrollable(Calendar, { view: 'onView', date: 'onNavigate', selected: 'onSelectEvent' })
export default uncontrollable(Calendar, {
view: 'onView',
date: 'onNavigate',
selected: 'onSelectEvent'
})
11 changes: 5 additions & 6 deletions src/DayColumn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function snapToSlot(date, step){
return new Date(Math.floor(date.getTime() / roundTo) * roundTo)
}

function positionFromDate(date, min, step){
function positionFromDate(date, min){
return dates.diff(min, dates.merge(min, date), 'minutes')
}

Expand Down Expand Up @@ -105,8 +105,7 @@ let DaySlot = React.createClass({

return (
<TimeColumn {...props}
type="day"
showLabels={false}
className='rbc-day-slot'
timeslots={timeslots}
now={now}
min={min}
Expand All @@ -126,7 +125,7 @@ let DaySlot = React.createClass({
);
},

renderEvents(numSlots, totalMin) {
renderEvents() {
let {
events, step, min, culture, eventPropGetter
, selected, eventTimeRangeFormat, eventComponent
Expand Down Expand Up @@ -220,7 +219,7 @@ let DaySlot = React.createClass({
this.setState(state)
}

let selectionState = ({ x, y }) => {
let selectionState = ({ y }) => {
let { step, min, max } = this.props;
let { top, bottom } = getBoundsForNode(node)

Expand Down Expand Up @@ -279,7 +278,7 @@ let DaySlot = React.createClass({
this._selector = null;
},

_selectSlot({ startDate, endDate, endSlot, startSlot }) {
_selectSlot({ startDate, endDate }) {
let current = startDate
, slots = [];

Expand Down
4 changes: 2 additions & 2 deletions src/Month.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ let MonthView = React.createClass({
}, false)
},

componentDidUpdate(prevProps, prevState) {
componentDidUpdate() {
if (this.state.needLimitMeasure)
this._measureRowLimit(this.props)
},
Expand Down Expand Up @@ -308,7 +308,7 @@ let MonthView = React.createClass({
)
},

_measureRowLimit(props) {
_measureRowLimit() {
let eventHeight = getHeight(this._measureEvent);
let labelHeight = getHeight(this._firstDateRow);
let eventSpace = getHeight(this._firstRow) - labelHeight;
Expand Down
Loading

0 comments on commit b67ace3

Please sign in to comment.