Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Added navbar package #4

Merged
merged 18 commits into from
Aug 18, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/Navbar/.babelrc
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"
]
}
2 changes: 2 additions & 0 deletions packages/Navbar/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src
yarn.lock
28 changes: 28 additions & 0 deletions packages/Navbar/package.json
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",
Copy link
Collaborator

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

"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"
}
}
29 changes: 29 additions & 0 deletions packages/Navbar/src/index.js
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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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)',
Copy link
Collaborator

Choose a reason for hiding this comment

The 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,
Copy link
Collaborator

Choose a reason for hiding this comment

The 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 }) {
Copy link
Collaborator

Choose a reason for hiding this comment

The 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>
}
}
40 changes: 40 additions & 0 deletions packages/Navbar/webpack.config.js
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
Loading