Last active
March 31, 2019 18:19
-
-
Save developit/b3db0d9bd810626bf3acf7329f3bcccd to your computer and use it in GitHub Desktop.
git clone https://gist.github.com/b3db0d9bd810626bf3acf7329f3bcccd.git foo && cd foo && npm i && npm start
This file contains hidden or 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
node_modules | |
npm-debug.log | |
dist | |
build |
This file contains hidden or 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 'material-design-icons'; | |
import { Component } from 'preact'; | |
import DatePicker from 'react-toolbox/lib/date_picker'; | |
export default class App extends Component { | |
state = { | |
date: new Date() | |
}; | |
updateDate = date => { | |
this.setState({ date }); | |
}; | |
render({ }, { date }) { | |
return ( | |
<div> | |
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" /> | |
<h1>Date Picker Example</h1> | |
<DatePicker | |
label="PickaDate" | |
value={date} | |
onChange={this.updateDate} | |
/> | |
</div> | |
); | |
} | |
} |
This file contains hidden or 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": "date-picker-demo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "eslint src && preact test", | |
"start": "if-env NODE_ENV=production && npm run -s serve || npm run -s dev", | |
"build": "preact build", | |
"serve": "preact build && preact serve", | |
"dev": "preact watch" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"eslintConfig": { | |
"extends": "eslint-config-synacor" | |
}, | |
"devDependencies": { | |
"eslint": "^4.6.1", | |
"eslint-config-synacor": "^1.1.1", | |
"if-env": "^1.0.0", | |
"postcss-cssnext": "^3.0.2", | |
"postcss-each": "^0.10.0", | |
"postcss-import": "^10.0.0", | |
"postcss-mixins": "^6.1.0", | |
"postcss-modules-scope": "^1.0.2", | |
"preact-cli": "^1.4.1", | |
"preact-cli-postcss": "^1.0.0" | |
}, | |
"dependencies": { | |
"preact": "^8.2.5", | |
"preact-compat": "^3.17.0", | |
"preact-router": "^2.5.7", | |
"react-toolbox": "^2.0.0-beta.12" | |
} | |
} |
This file contains hidden or 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
module.exports = { | |
plugins: { | |
'postcss-import': { | |
root: __dirname | |
}, | |
'postcss-mixins': {}, | |
'postcss-each': {}, | |
'postcss-cssnext': {} | |
} | |
}; |
This file contains hidden or 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 path from 'path'; | |
import postcss from 'preact-cli-postcss'; | |
const reactToolboxPath = path.resolve('./node_modules', 'react-toolbox'); | |
export default (config, env, helpers) => { | |
postcss(config, helpers); | |
const rules = helpers.getLoadersByName(config, 'postcss-loader'); | |
const cssModulesRule = rules[0].rule; | |
cssModulesRule.include.push(reactToolboxPath); // this enables css modules for react-toolbox | |
const globalCssRule = rules[1].rule; | |
globalCssRule.exclude.push(reactToolboxPath); // exclude react-toolbox from global css | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment