Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
HriBB committed Aug 16, 2016
1 parent cdf373a commit eb29835
Show file tree
Hide file tree
Showing 19 changed files with 101 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
.DS_Store
dist
lib
es
coverage
.idea
examples/bundle.js
Expand Down
25 changes: 11 additions & 14 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
const path = require('path');

module.exports = {
devtool: 'cheap-module-eval-source-map',
module: {
loaders: [
{
test : /\.(scss|css)$/,
loader: 'style!css?sourceMap!postcss!sass?sourceMap'
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}
]
loaders: [{
test : /\.(scss|css)$/,
loader: 'style!css?sourceMap!postcss!sass?sourceMap'
},{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
},{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}]
}
};
61 changes: 37 additions & 24 deletions examples/Example.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
import React, { Component } from 'react';

import { SelectField, MultiSelectField, Option } from '../components';
import { Layout, Header, Navigation, Content, Icon } from 'react-mdl'

import { SelectField, MultiSelectField, Option } from '../src';

import './Example.scss';

export default class Example extends Component {
render() {
return (
<div className="example">
<SelectField label={'Default'}>
<Option value={1}>One</Option>
<Option value={2}>Two</Option>
<Option value={3}>Three</Option>
<Option value={4}>Four</Option>
<Option value={5}>Five</Option>
</SelectField>
<SelectField label={'Editable'} editable>
<Option value={1}>One</Option>
<Option value={2}>Two</Option>
<Option value={3}>Three</Option>
<Option value={4}>Four</Option>
<Option value={5}>Five</Option>
</SelectField>
<MultiSelectField label={'Multiselect'}>
<Option value={1}>Value One</Option>
<Option value={2}>Value Two</Option>
<Option value={3}>Value Three</Option>
<Option value={4}>Value Four</Option>
<Option value={5}>Value Five</Option>
</MultiSelectField>
</div>
<Layout fixedHeader>
<Header title={'React MDL SelectField'}>
<Navigation>
<a href="https://github.com/HriBB/react-mdl-selectfield"><Icon name={'link'}/> GitHub</a>
</Navigation>
</Header>
<Content>
<div className={'example'}>
<SelectField label={'Default'}>
<Option value={1}>One</Option>
<Option value={2}>Two</Option>
<Option value={3}>Three</Option>
<Option value={4}>Four</Option>
<Option value={5}>Five</Option>
</SelectField>
<SelectField label={'Editable'} editable>
<Option value={1}>One</Option>
<Option value={2}>Two</Option>
<Option value={3}>Three</Option>
<Option value={4}>Four</Option>
<Option value={5}>Five</Option>
</SelectField>
<MultiSelectField label={'Multiselect'}>
<Option value={1}>Value One</Option>
<Option value={2}>Value Two</Option>
<Option value={3}>Value Three</Option>
<Option value={4}>Value Four</Option>
<Option value={5}>Value Five</Option>
</MultiSelectField>
</div>
</Content>
</Layout>
)
}
}
4 changes: 4 additions & 0 deletions examples/index.scss → examples/Example.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@import url("https://fonts.googleapis.com/icon?family=Material+Icons");

.mdl-layout__header-row {
padding-left: 24px;
}

.example {
margin: 0 auto;
padding: 20px 0;
Expand Down
4 changes: 2 additions & 2 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>React MDL Selectfield Component</title>
<title>React MDL Selectfield Component Examples</title>
</head>
<body>
<div id="content"></div>
</body>
<script src="./bundle.js"></script>
<script src="./examples.js"></script>
</html>
1 change: 0 additions & 1 deletion examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import ReactDOM from 'react-dom';

import 'react-mdl/extra/material.js';
import 'react-mdl/extra/material.css';
import './index.scss';

import Example from './Example'

Expand Down
28 changes: 28 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "react-mdl-selectfield",
"description": "React MDL SelectField Component Examples",
"main": "index.js",
"scripts": {
"start": "node ./server.js",
"build": "../node_modules/.bin/cross-env NODE_ENV=production ../node_modules/.bin/webpack --progress --verbose --colors"
},
"repository": {
"type": "git",
"url": "https://github.com/HriBB/react-mdl-selectfield.git"
},
"author": {
"name": "Bojan Hribernik",
"email": "[email protected]",
"url": "http://climbuddy.com/"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/HriBB/react-mdl-selectfield/issues"
},
"homepage": "https://hribb.github.io/react-mdl-selectfield/",
"devDependencies": {
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.12.2"
},
"dependencies": {}
}
2 changes: 1 addition & 1 deletion server.js → examples/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ app.use(require('webpack-hot-middleware')(compiler, {
}));

app.get('*', function(req, res) {
res.sendFile(path.join(__dirname, 'examples', 'index.html'));
res.sendFile(path.join(__dirname, 'index.html'));
});

app.listen(3000, 'localhost', function(err) {
Expand Down
13 changes: 4 additions & 9 deletions webpack.config.dev.js → examples/webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
'use strict';

var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackPluginRemove = require('html-webpack-plugin-remove');

module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: [
'eventsource-polyfill',
'webpack-hot-middleware/client?path=/__webpack_hmr',
path.resolve(__dirname, 'examples', 'index')
path.resolve(__dirname, 'index')
],
output: {
path: path.resolve(__dirname, 'examples', 'dist'),
filename: 'bundle.js'
path: path.resolve(__dirname, 'dist'),
filename: 'examples.js'
},
resolve: {
extensions: ['', '.js']
Expand All @@ -36,8 +31,8 @@ module.exports = {
}]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
Expand Down
5 changes: 5 additions & 0 deletions examples/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if (process.env.NODE_ENV === 'production') {
module.exports = require('./webpack.config.prod')
} else {
module.exports = require('./webpack.config.dev')
}
15 changes: 6 additions & 9 deletions webpack.config.prod.js → examples/webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
Expand All @@ -8,11 +6,11 @@ var HtmlWebpackPluginRemove = require('html-webpack-plugin-remove');

module.exports = {
entry: [
path.resolve(__dirname, 'examples', 'index')
path.resolve(__dirname, 'index')
],
output: {
path: path.resolve(__dirname, 'examples', 'dist'),
filename: 'example.js'
path: path.resolve(__dirname, 'dist'),
filename: 'examples.js'
},
resolve: {
extensions: ['', '.js']
Expand All @@ -33,15 +31,14 @@ module.exports = {
}]
},
plugins: [
new HtmlWebpackPluginRemove('\n <script src="./bundle.js"></script>'),
new HtmlWebpackPluginRemove('\n <script src="./examples.js"></script>'),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'examples', 'index.html'),
template: path.resolve(__dirname, 'index.html'),
filename: 'index.html',
inject: 'body',
hash: true,
xhtml: true,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
Expand All @@ -59,6 +56,6 @@ module.exports = {
screw_ie8: true
}
}),
new ExtractTextPlugin('example.css', { allChunks: true })
new ExtractTextPlugin('examples.css')
],
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion stories/MultiSelectField.story.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { storiesOf, action } from '@kadira/storybook';

import { MultiSelectField, Option } from '../components';
import { MultiSelectField, Option } from '../src';

storiesOf('MultiSelectField', module)
.add('default', () => (
Expand Down
2 changes: 1 addition & 1 deletion stories/SelectField.story.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { storiesOf, action } from '@kadira/storybook';

import { SelectField, Option } from '../components';
import { SelectField, Option } from '../src';

storiesOf('SelectField', module)
.add('default', () => (
Expand Down

0 comments on commit eb29835

Please sign in to comment.