Skip to content

Commit

Permalink
Initial release of brand-assets package
Browse files Browse the repository at this point in the history
  • Loading branch information
HowlingEverett committed Feb 22, 2017
1 parent 8609c31 commit 37e3337
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
*.log
.idea
.DS_Store
13 changes: 12 additions & 1 deletion packages/brand-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
"version": "1.0.0-1",
"main": "dist/index.js",
"scripts": {
"prepublish": ""
"build": "webpack --config webpack.config.js",
"prepublish": "npm run build"
},
"dependencies": {
"lodash": "^4.17.4"
},
"devDependencies": {
"babel-loader": "^6.3.2",
"babel-preset-latest": "^6.22.0",
"babel-preset-stage-0": "^6.22.0",
"file-loader": "^0.10.0",
"webpack": "^2.2.1"
}
}
38 changes: 38 additions & 0 deletions packages/brand-assets/source/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import transform from 'lodash/transform'

const buildAbsoluteResourceUrls = (resources) => (
transform(resources, (result, resource) => {
result['svg'][resource] = require(`./images/${resource}.svg`)
result['png'][resource] = require(`./images/${resource}.png`)
result['eps'][resource] = require(`./images/${resource}.eps`)
}, {svg: {}, png: {}, eps: {}})
)

const RESOURCE_URLS = buildAbsoluteResourceUrls([
'standard',
'standard-padded',
'standard-padded-markup',
'inverted',
'inverted-padded',
'inverted-background',
'inverted-padded-background',
'mark-standard',
'mark-standard-padded',
'mark-standard-padded-markup',
'mark-inverted',
'mark-inverted-padded',
'mark-inverted-padded-background',
'powered-by',
'powered-by-padded',
'powered-by-inverted-padded',
'powered-by-inverted-padded-background',
'old-standard',
'old-inverted',
'old-mark',
'old-mark-inverted'
])

export const logo = (name, ext = 'svg') => (
RESOURCE_URLS[ext][name]
)

40 changes: 40 additions & 0 deletions packages/brand-assets/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const path = require('path')

const CDN_ROOT = 'https://raw.githubusercontent.com/everydayhero/experience/master/packages/brand-assets/source/images/'

const config = {
entry: {
'index': './source/index.js'
},
output: {
filename: '[name].js',
libraryTarget: 'commonjs-module',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['latest', 'stage-0']
}
}
]
},
{
test: /\.(png|svg|eps)$/,
loader: 'file-loader'
}
]
},
devtool: 'source-map'
}

if (process.env.NODE_ENV === 'production') {
config.output.publicPath = CDN_ROOT
}

module.exports = config
3 changes: 2 additions & 1 deletion packages/experience-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-helmet": "^3.2.2",
"react-markdown-loader": "^1.1.10"
"react-markdown-loader": "^1.1.10",
"@edh/brand-assets": "1.0.0-1"
},
"devDependencies": {
"enzyme": "^2.4.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import {Link} from 'react-router'
import {logo} from '@edh/brand-assets'

const NAVIGATION_CONTENT = [
{route: '/', title: 'Home'},
Expand All @@ -25,6 +26,8 @@ const NAVIGATION_CONTENT = [

const Navigation = ({routes = NAVIGATION_CONTENT, id = 'primary'}) => (
<nav id={`navigation-${id}`}>
<img src={logo('standard')} />

{routes.map((navItem, index) => {
const link = (
<Link
Expand Down

0 comments on commit 37e3337

Please sign in to comment.