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
// customPropToClassName.js | |
const traverse = element => { | |
if (element.props) { | |
let props = {}; | |
if (element.props.customProp) { | |
// Inject className or anything you want | |
props.className = 'important-class'; | |
} |
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
import React from 'react'; | |
class Slice extends Component { | |
static propsTypes = { | |
children: PropTypes.func.isRequired | |
} | |
render() { | |
return this.props.children(); | |
} |
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
'use strict';//jshint | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
less: { | |
compileCore: { | |
files: { | |
'css/style.css': 'less/style.less' | |
} | |
} |
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
@import "../bootstrap/less/bootstrap.less"; | |
@import "variables.less"; | |
// Your rules go here |
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
{ | |
"name": "My project", | |
"version": "1.0.0", | |
"author": "author", | |
"homepage": "", | |
"devDependencies": { | |
"grunt": "*", | |
"grunt-contrib-clean": "*", | |
"grunt-contrib-watch": "*", | |
"grunt-contrib-less": "*" |
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
export default ({ Event, Region, Animate, Button, dispatch }) => ([ | |
<Event start='00:00:00.000' end='00:00:10.000'> | |
<Region id='left' transition='cross-fade' duration={ 2 }> | |
<Button test={ dispatch('test') } type='important'> | |
Hello John ! | |
</Button> | |
</Region> | |
<Region id='bottom' transition='cross-fade' duration={ 2 }> | |
<Button test={ dispatch('test') } type='important'> | |
Hello John ! |
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
export default class Video extends Component { | |
render() { | |
return ( | |
<video | |
ref='video' | |
{ ...this.props } | |
onDurationChange={ this.handleDurationChange } | |
onRateChange={ this.handleRateChange } | |
onTimeUpdate={ this.handleTimeUpdate } | |
onSeeking={ this.handleSeeking } |
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
class Example extends Component { | |
componentWillReceiveProps(nextProps) { | |
// Only update state if needed. | |
if (nextProps.startTime !== this.state.startTime) { | |
// Change state using new prop value. | |
this.setState({ | |
seconds: toSeconds(this.props.startTime) | |
}) | |
} | |
} |
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
// package.json | |
{ | |
//... | |
"tooling": { | |
"presets": [ | |
"modern", // es2015, stage-0, autoprefixer... | |
"react", | |
"redux", | |
"react-router", | |
"css-modules", |
OlderNewer