Skip to content

Commit

Permalink
Merge branch 'master' into release-1
Browse files Browse the repository at this point in the history
  • Loading branch information
martinhecher committed May 25, 2016
2 parents 15d3970 + 90fad9c commit c649353
Show file tree
Hide file tree
Showing 98 changed files with 113 additions and 5,187 deletions.
88 changes: 51 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,78 @@
# Redsift UI
# RedsiftUI

[![Circle CI](https://circleci.com/gh/Redsift/redsift-ui.svg?style=svg)](https://circleci.com/gh/Redsift/redsift-ui)

Common UI components for Sifts and Apps.
RedsiftUI is a user interface library for rapid development of Sifts and other Red Sift applications. The documentation is available at [here](https://docs.redsift.io/docs/client-code-redsift-ui).

## Development workflow
This repository does not contain UI components itself. It contains logic to grab available Red Sift UI components from NPM and to bundle them into packages. Those packages are then served by our CDN as UMD modules. There are multiple bundles which you can use:

### Interactive development
###### `core` bundle

$ npm install
$ npm run serve
Contains the Redsift theme in the *light* and *dark* flavour, as well as UI logic shared between components.

### Development integration into your project
To use the bundle add the following HTML to your project:

To extend and update **redsift-ui** from within an application which uses the library you can do the following (the application has to be a git repository):
```html
<!-- in the <head> section -->
<link rel="stylesheet" href="//static.redsift.io/ui/latest/css/core/redsift-light.min.css">
<!-- or the dark theme: -->
<link rel="stylesheet" href="//static.redsift.io/ui/latest/css/core/redsift-dark.min.css">

```shell
cd my-application
git submodule add https://github.com/Redsift/redsift-ui.git
(cd redsift-ui && npm install && sudo npm link)
npm link redsift-ui
<!-- in the <body> section -->
<script src="//static.redsift.io/ui/latest/js/core/redsift.umd.min.js"></script>
```

After these lines 'redsift-ui' is installed as npm module in *my-application* and you can import its files from 'npm_modules/redsift-ui'.
###### `sift` bundle

### Trigger application reload on redsift-ui change
This is probably the most important one to start with Sift development. It contains the Redsift theme in the *light* and *dark* flavour, together with the `rs-hero` component.

Gulp, Grunt, Meteor, etc. provide auto reload functionality when a file within the application tree is changing. Typically the `npm_modules` folder is not watched, therefore a change within the **redsift-ui** folder will not trigger a reload of the application.
To use the bundle add the following HTML to your project:

To enable this handy feature create a new file `./my-application/npm_modules/redsift-ui/trigger-app-reload.json` and add the following content:
```html
<!-- in the <head> section -->
<link rel="stylesheet" href="//static.redsift.io/ui/latest/css/sift/redsift-light.min.css">
<!-- or the dark theme: -->
<link rel="stylesheet" href="//static.redsift.io/ui/latest/css/sift/redsift-dark.min.css">

```JSON
{
"watchedFolder": "/path/to/watched/folder"
}
<!-- in the <body> section -->
<script src="//static.redsift.io/ui/latest/js/sift/redsift.umd.min.js"></script>
```

Replace `/path/to/watched/folder` with a path suited for your application and restart the interactive development setup of **redsift-ui**:
###### `full` bundle

> CAUTION: Do **NOT** use `~` to specify a home folder, it is not supported!
To get all the functionality provided by RedsiftUI use this bundle. It contains the Redsift theme in the *light* and *dark* flavour, together with the following (data visualization) components:

```shell
cd my-application/npm_modules/redsift-ui
npm run serve
```
* `rs-hero`: A hero unit for your Sift or app
* `rs-radial-chart`: A radial chart for visualizing monthly data
* `rs-schedule`: A scheduling component

After this setup each change in **redsift-ui** will trigger a file creation/update in the `watchedFolder` and reload the application, which in turn pulls in the updated **redsift-ui** files.
To use the bundle add the following HTML to your project:

### Image optimization
```html
<!-- in the <head> section -->
<link rel="stylesheet" href="//static.redsift.io/ui/latest/css/full/redsift-light.min.css">
<!-- or the dark theme: -->
<link rel="stylesheet" href="//static.redsift.io/ui/latest/css/full/redsift-dark.min.css">

The repository contains the script `./scripts/forweb.sh` to optimize images in size. It also takes care of generating an image version for high-dpi, retina displays.
<!-- in the <body> section -->
<script src="//static.redsift.io/ui/latest/js/full/redsift.umd.min.js"></script>
```

#### Prerequisites (MacOS)
## Development and Customization

1. install [brew](http://brew.sh/)
2. install [cwebp](https://developers.google.com/speed/webp/docs/precompiled#getting_cwebp_dwebp_and_the_webp_libraries) in copying the scripts in the `bin` folder to `/usr/local/bin`
3. `brew install imagemagick`
The bundles are provided to start quickly with developing your Sifts or applications. To have more control on which parts to include into your project you are encouraged to use the UI components directly. The components are develop in ES2015 for the Javascript and with the [Stylus](http://stylus-lang.com/) CSS preprocessor. It is easy to integrate and customize these components into your projects. Have a look at the `./bundles` folder to get an idea on how to integrate the functionality into your own projects. The following components are available as separate repositories and also als NPM modules:

After that run the script like so:
* [ui-rs-core](https://github.com/Redsift/ui-rs-core) | [npm](https://www.npmjs.com/package/@redsift/ui-rs-core)
* [ui-rs-hero](https://github.com/Redsift/ui-rs-hero) | [npm](https://www.npmjs.com/package/@redsift/ui-rs-hero)
* [ui-rs-radial-chart](https://github.com/Redsift/ui-rs-radial-chart) | [npm](https://www.npmjs.com/package/@redsift/ui-rs-radial-chart)
* [ui-rs-schedule](https://github.com/Redsift/ui-rs-schedule) | [npm](https://www.npmjs.com/package/@redsift/ui-rs-schedule)

## Development Setup

For development directly within this repository run

```bash
> npm run serve
```
./scripts/forweb.sh path/to/image outputpath/basename
```

within the repository folder. It will start a web server serving the content of `./samples` and supports live-reloading when a source file is changed.
3 changes: 1 addition & 2 deletions bundles/core/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from '../../components/core/index.js';
export { html } from '@redsift/d3-rs-svg';
export * from '@redsift/ui-rs-core';
4 changes: 2 additions & 2 deletions bundles/core/redsift-dark.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '../../components/core/index.import';
@import '../../components/core/src/styles/brand.import';
@import '../../node_modules/@redsift/ui-rs-core/src/index.import';
@import '../../node_modules/@redsift/ui-rs-core/src/styles/brand.import';

$textColour = $brandWhite;
$lineColour = $brandWhite;
Expand Down
4 changes: 2 additions & 2 deletions bundles/core/redsift-light.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '../../components/core/index.import';
@import '../../components/core/src/styles/brand.import';
@import '../../node_modules/@redsift/ui-rs-core/src/index.import';
@import '../../node_modules/@redsift/ui-rs-core/src/styles/brand.import';

$textColour = $brandBlack;
$lineColour = #666;
Expand Down
2 changes: 1 addition & 1 deletion bundles/core/redsift-xtra.styl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@import './redsift-light';
@import '../../components/core/src/styles/components/xkcd.import';
@import '../../node_modules/@redsift/ui-rs-core/src/styles/components/xkcd.import';
6 changes: 6 additions & 0 deletions bundles/crx/_components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export { RedsiftHero } from '@redsift/ui-rs-hero';

export { RedsiftLoader } from '@redsift/ui-rs-loader';

export { Scroll, Sliders } from '@redsift/ui-rs-core';

11 changes: 1 addition & 10 deletions bundles/crx/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
import { registerHeroElement } from '../../components/hero/index';

registerHeroElement();

export {
registerHeroElement
} from '../../components/hero/index.js';

export { Scroll } from '../../components/core/src/js/scroll/index';
export { Sliders } from '../../components/core/src/js/widgets/sliders';
export * from './_components';
2 changes: 2 additions & 0 deletions bundles/crx/redsift-light.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import '../../node_modules/@redsift/ui-rs-loader/src/index.import';

4 changes: 2 additions & 2 deletions bundles/full/_components.import.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '../../components/hero/index.import';
@import '../../components/radial-chart/index.import';
@import '../../node_modules/@redsift/ui-rs-hero/src/index.import';
@import '../../node_modules/@redsift/ui-rs-radial-chart/src/index.import';

$heroSettings = {
padding: 1em,
Expand Down
16 changes: 5 additions & 11 deletions bundles/full/_components.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
// Note: registering custom elements by default:
import { registerHeroElement } from '../../components/hero/index';
import { registerRadialChartElement } from '../../components/radial-chart/index';
import { registerScheduleElement } from '../../components/schedule/index';

registerHeroElement();
registerRadialChartElement();
registerScheduleElement();
export { html as svg } from '@redsift/d3-rs-svg';
export * from '@redsift/d3-rs-core';

export {
registerHeroElement,
RedsiftHero
} from '../../components/hero/index.js';
} from '@redsift/ui-rs-hero';

export {
registerRadialChartElement,
RedsiftRadialChart
} from '../../components/radial-chart/index.js';
} from '@redsift/ui-rs-radial-chart';

export {
registerScheduleElement,
RedsiftSchedule
} from '../../components/schedule/index.js';
} from '@redsift/ui-rs-schedule';
1 change: 0 additions & 1 deletion bundles/sdk/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion bundles/sift/_components.import.styl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../components/hero/index.import';
@import '../../node_modules/@redsift/ui-rs-hero/src/index.import';

$heroSettings = {
padding: 1em,
Expand Down
8 changes: 3 additions & 5 deletions bundles/sift/_components.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Note: registering custom elements by default:
import { registerHeroElement } from '../../components/hero/index';

registerHeroElement();
export { html as svg } from '@redsift/d3-rs-svg';
export * from '@redsift/d3-rs-core';

export {
registerHeroElement,
RedsiftHero
} from '../../components/hero/index.js';
} from '@redsift/ui-rs-hero';
11 changes: 5 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@ checkout:

dependencies:
override:
- node node_modules/gulp/bin/gulp.js
- npm run build
- mv ./dist ${CIRCLE_ARTIFACTS}/dist

test:
override:
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/css/core/redsift-light.min.css ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/css/sift/redsift-light.min.css ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/css/full/redsift-light.min.css ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/core/redsift.umd.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/sift/redsift.umd.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/full/redsift.umd.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/crx/redsift.umd.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/sdk/color-tools.umd.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/core/redsift.umd-es2015.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/sift/redsift.umd-es2015.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/full/redsift.umd-es2015.min.js ]"
- /bin/bash -c "[ -s ${CIRCLE_ARTIFACTS}/dist/js/crx/redsift.umd-es2015.min.js ]"

deployment:
production:
Expand Down
3 changes: 0 additions & 3 deletions components/.babelrc

This file was deleted.

66 changes: 0 additions & 66 deletions components/core/index.import.styl

This file was deleted.

12 changes: 0 additions & 12 deletions components/core/index.js

This file was deleted.

Loading

0 comments on commit c649353

Please sign in to comment.