-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from CMSgov/staging
- Loading branch information
Showing
109 changed files
with
7,149 additions
and
834 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
}, | ||
"presets": [ | ||
"react", | ||
"es2015" | ||
"es2015", | ||
"stage-3" | ||
] | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Design System</title> | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.container { | ||
margin-left: auto; | ||
margin-right: auto; | ||
max-width: 700px; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var gulp = require('gulp'); | ||
var sass = require('gulp-sass'); | ||
|
||
/** | ||
* Copy the static assets from the design system, such as the fonts and images. | ||
* We could do this manually, but why not automate it so it's easy to do | ||
* as things are updated :) | ||
*/ | ||
gulp.task('copy-design-system', function() { | ||
return gulp.src([ | ||
'node_modules/@cmsgov/design-system-core/src/**/fonts/*', | ||
'node_modules/@cmsgov/design-system-core/src/**/images/*' | ||
]) | ||
.pipe(gulp.dest('./dist')); | ||
}); | ||
|
||
/** | ||
* Transpile Sass to CSS | ||
*/ | ||
gulp.task('sass', function() { | ||
var transpiler = sass({ | ||
// Add node_modules to the list of paths used to resolve @import | ||
// declarations. This way it's easier to import our design system's | ||
// Sass files. | ||
includePaths: ['./node_modules'], | ||
outputStyle: 'compressed' | ||
}).on('error', sass.logError); | ||
|
||
return gulp.src('./src/**/*.scss') | ||
.pipe(transpiler) | ||
.pipe(gulp.dest('./dist')); | ||
}); | ||
|
||
gulp.task('default', [ | ||
'copy-design-system', | ||
'sass' | ||
]); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Introduction | ||
|
||
This example shows how you can incorporate the design system into your build process. It uses [Webpack](https://webpack.js.org) to bundle and optimize JavaScript files, [Babel](https://babeljs.io/) to transpile JSX, and [Gulp](http://gulpjs.com/) to transpile Sass and copy static assets from the design system. | ||
|
||
## Getting started | ||
|
||
_Note_: The instructions below assume you have Yarn installed. You can also use NPM if that's your flavor. | ||
|
||
1. Install packages: `yarn install` | ||
1. Transpile and bundle assets: `yarn run build` | ||
1. Open `index.html` in a browser. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Design System</title> | ||
<link rel="stylesheet" href="dist/index.css"> | ||
</head> | ||
<body class="ds-base"> | ||
<div class="wrap"> | ||
<div id="jsx-root"> | ||
<h1>Build assets before viewing</h1> | ||
<p>Seeing this message in the browser? Make sure to run the following command first:</p> | ||
<p> | ||
<code>yarn run build</code> | ||
<br> | ||
<em>or</em> | ||
<br /> | ||
<code>npm run build</code> | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<script src="dist/bundle.js"></script> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "react-app-example", | ||
"version": "1.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"@cmsgov/design-system-core": "^1.0.0-alpha", | ||
"react": "^15.5.4", | ||
"react-dom": "^15.5.4" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
"babel-loader": "^7.0.0-beta.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"gulp": "^3.9.1", | ||
"gulp-sass": "^3.1.0", | ||
"webpack": "^2.3.3" | ||
}, | ||
"scripts": { | ||
"build": "NODE_ENV=production webpack -p --progress && gulp" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
// Import all components and reference one by name. You can optimize this using | ||
// your build process (ie. Tree shaking in Webpack) | ||
import { Alert } from '@cmsgov/design-system-core'; | ||
// Import individual component. No special optimizations needed. | ||
import Button from '@cmsgov/design-system-core/dist/components/Button/Button'; | ||
|
||
const Example = function() { | ||
return ( | ||
<div> | ||
<Alert heading='Hello world'> | ||
<p className='ds-c-alert__text'> | ||
You did it! You've ran the example. | ||
</p> | ||
<Button className='ds-u-margin-top--2'> | ||
Learn more | ||
</Button> | ||
</Alert> | ||
</div> | ||
); | ||
}; | ||
|
||
ReactDOM.render( | ||
<Example />, | ||
document.querySelector('#jsx-root') | ||
); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// In our Gulp Sass task, we've added node_modules to the list of paths that | ||
// are used to resolve @import declarations, so we omit it from the path below. | ||
@import '@cmsgov/design-system-core/src/index'; | ||
|
||
.wrap { | ||
margin: auto; | ||
max-width: 800px; | ||
width: 95%; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Use Webpack + Babel to bundle and transpile our JSX | ||
*/ | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
|
||
var config = { | ||
entry: './src/index.js', | ||
output: { | ||
filename: 'bundle.js', | ||
path: path.resolve(__dirname, 'dist') | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: [/node_modules/], | ||
use: [{ | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['es2015', 'react'] | ||
} | ||
}] | ||
} | ||
] | ||
} | ||
}; | ||
|
||
module.exports = config; |
Oops, something went wrong.