-
Notifications
You must be signed in to change notification settings - Fork 2
Added navbar package #4
Changes from 1 commit
661d25e
7fa9d63
6b67afa
4439045
c35b946
a7e179f
478e83e
aed2255
5799770
dd6e007
e749832
70328ea
d5db0ac
ecc7b6e
122d221
18788df
136f2a2
f04ff84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"presets": [ "es2015" ], | ||
"plugins": [ | ||
"inferno", | ||
"transform-decorators-legacy", | ||
"transform-class-properties", | ||
"transform-object-rest-spread" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src | ||
yarn.lock |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "@slup/navbar", | ||
"version": "0.0.1", | ||
"description": "Material design app bar", | ||
"main": "dist.js", | ||
"author": "Gejsi", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-core": "6.25.0", | ||
"babel-loader": "7.1.1", | ||
"babel-plugin-inferno": "3.2.0", | ||
"babel-plugin-transform-class-properties": "6.24.1", | ||
"babel-plugin-transform-decorators-legacy": "1.3.4", | ||
"babel-plugin-transform-object-rest-spread": "6.23.0", | ||
"babel-preset-es2015": "6.24.1", | ||
"babili-webpack-plugin": "0.1.2", | ||
"cross-env": "5.0.4", | ||
"decko": "1.2.0", | ||
"inferno": "3.7.1", | ||
"inferno-component": "3.7.1", | ||
"webpack": "3.4.1" | ||
}, | ||
"scripts": { | ||
"compile:watch": "webpack --watch --progress", | ||
"compile:build": "cross-env NODE_ENV=production webpack --progress", | ||
"prepublish": "yarn run compile:build" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Inferno from 'inferno' | ||
import Component from 'inferno-component' | ||
import { bind } from 'decko' | ||
|
||
export class Navbar extends Component { | ||
|
||
@bind | ||
getStyles() { | ||
const { backgroundColor, color } = this.props | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use just background, not backgroundColor, for both consistency, simplicity and convention |
||
|
||
const styles = { | ||
boxShadow: '0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a template litteral and add some new lines for each scope of the shadow. |
||
height: 64, | ||
display: 'flex', | ||
alignItems: 'center', | ||
padding: '0 16px', | ||
backgroundColor: backgroundColor, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix accordingly to what said before |
||
color: color | ||
} | ||
|
||
return styles | ||
} | ||
|
||
render({ children, backgroundColor, color }) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you import backgroundColor and color when you dont use them? |
||
const styles = this.getStyles() | ||
|
||
return <div style={styles}>{children}</div> | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const webpack = require('webpack') | ||
const BabiliPlugin = require("babili-webpack-plugin") | ||
const { join } = require('path') | ||
|
||
let config = { | ||
entry: join(__dirname, 'src', 'index'), | ||
|
||
output: { | ||
path: __dirname, | ||
filename: 'dist.js' | ||
}, | ||
|
||
resolve: { | ||
extensions: [ '.js' ] | ||
}, | ||
|
||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js?$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader' | ||
} | ||
] | ||
}, | ||
|
||
plugins: [ | ||
new webpack.optimize.ModuleConcatenationPlugin() | ||
], | ||
|
||
devtool: 'source-map', | ||
target: 'web' | ||
} | ||
|
||
if(process.env.NODE_ENV == 'production') { | ||
config.plugins.push(new BabiliPlugin()) | ||
config.plugins.push(new webpack.optimize.ModuleConcatenationPlugin()) | ||
} | ||
|
||
module.exports = config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use nav bar instead for consistency