Skip to content

Commit

Permalink
Merge pull request #256 from appnexus/quality/branding
Browse files Browse the repository at this point in the history
Branding refresh and VerticalListMenu tweaks
  • Loading branch information
jondlm committed May 19, 2016
2 parents 76486c7 + dc42229 commit 29eea4b
Show file tree
Hide file tree
Showing 22 changed files with 782 additions and 193 deletions.
45 changes: 19 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,22 @@ A UI component library from AppNexus.

Lucid can be installed with NPM.

```bash
npm install --save lucid-ui
```
npm install --save lucid-ui

## Usage

```javascript
import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from 'lucid-ui';
import React from 'react';
import ReactDOM from 'react-dom';
import { Button } from 'lucid-ui';

ReactDOM.render(
<Button>Hello World<Button/>,
mountNode
);
```
ReactDOM.render(
<Button>Hello World<Button/>,
mountNode
);

You must also include lucid's styles:

```less
@import "node_modules/lucid-ui/src/index.less";
```
@import "node_modules/lucid-ui/src/index.less";

Or use the precompiled CSS file `node_modules/lucid-ui/dist/index.css`.

Expand All @@ -37,16 +31,15 @@ Or use the precompiled CSS file `node_modules/lucid-ui/dist/index.css`.
the consuming application is responsible for declaring a dependency on a
compatible version.

```
package.json
{
"dependencies": {
"lucid-ui": "^0.0.1",
"react": "^0.14.0",
"react-dom": "^0.14.0"
}
}
```
package.json

{
"dependencies": {
"lucid-ui": "^0.0.1",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"react-css-transition-group": "^0.14.0"
}
}

To contribute to lucid, please see `CONTRIBUTING.md`.
2 changes: 1 addition & 1 deletion gulp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
EXAMPLES_GLOB: {
SOURCE: SOURCE_DIR + '/**/examples/*.js*',
},
AUTOPREFIXER_BROWSERS: 'last 2 versions',
AUTOPREFIXER_BROWSERS: 'last 3 versions',
SOURCE_DIR: SOURCE_DIR,
BUILD_DIR: BUILD_DIR,
};
2 changes: 1 addition & 1 deletion gulp/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ module.exports = {

var currentBranch = stdoutBranch.trim().replace(/\//g, '-'); // clean branch and replace forward slashes

var tarStream = gulp.src('dist/docs/*')
var tarStream = gulp.src('dist/docs/**/*')
.pipe(tar(currentBranch + '.tar'))
.pipe(gzip())
.pipe(gulp.dest('/tmp'));
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"url": "https://github.com/appnexus/lucid.git"
},
"scripts": {
"dev": "gulp docs-generate && webpack-dev-server --inline",
"dev": "gulp docs-generate && webpack-dev-server --inline --content-base src/docs/",
"docs-upload-gh": "./scripts/docs-upload-gh.sh",
"docs-upload": "gulp docs-upload",
"preversion": "rm -rf dist && TZ=UTC gulp preversion",
Expand Down Expand Up @@ -43,6 +43,7 @@
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-2": "^6.5.0",
"copy-webpack-plugin": "^3.0.0",
"css-loader": "^0.23.1",
"enzyme": "^2.0.0-rc1",
"eslint-plugin-react": "^3.16.1",
Expand Down Expand Up @@ -72,6 +73,7 @@
"react-addons-test-utils": "^0.14.0",
"react-docgen": "^2.7.0",
"react-dom": "^0.14.0",
"react-motion": "^0.4.3",
"react-router": "^2.0.0",
"sinon": "^2.0.0-pre",
"style-loader": "^0.13.0",
Expand Down
23 changes: 3 additions & 20 deletions src/components/Table/Table.less
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@

// always show marker on first cell
.selectFirstCellOnRow({
.renderLeftMarker(1);
.left-marker(1);
});
}

Expand All @@ -193,13 +193,13 @@

// place hidden marker on first cell
.selectFirstCellOnRow({
.renderLeftMarker(0);
.left-marker(0);
});

// show marker on hover
&:hover {
.selectFirstCellOnRow({
.renderLeftMarker(1);
.left-marker(1);
});
}
}
Expand Down Expand Up @@ -269,20 +269,3 @@
}
}
}

// Place a styled box on the left edge of the current element with the given scale and width
.renderLeftMarker(@scale:1; @width: 4px) {
position: relative;
&::before {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: @width;
background-color: @color-primary;
content: '';
transform-origin: 0 0;
transform: scaleX(@scale);
transition: transform 100ms;
}
}
7 changes: 5 additions & 2 deletions src/components/VerticalListMenu/VerticalListMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const VerticalListMenu = createClass({
hasExpander: bool,
isExpanded: bool,
isSelected: bool,
isActionable: bool,
onSelect: func,
onToggle: func,
}
Expand Down Expand Up @@ -122,6 +123,7 @@ const VerticalListMenu = createClass({
{_.map(itemChildProps, (itemChildProp, index) => {
const {
hasExpander = false,
isActionable = true,
} = itemChildProp;

const itemChildrenAsArray = React.Children.toArray(itemChildProp.children);
Expand Down Expand Up @@ -150,12 +152,13 @@ const VerticalListMenu = createClass({
<div
className={cx('&-Item-content', {
'&-Item-content-is-selected': actualIsSelected,
'&-Item-content-is-actionable': isActionable,
})}
onClick={_.partial(this.handleClickItem, index, itemChildProp)}
>
<span className={cx('&-Item-content-text')}>
<div className={cx('&-Item-content-text')}>
{otherChildren}
</span>
</div>
{hasExpander ?
<div
className={cx('&-Item-expander')}
Expand Down
23 changes: 9 additions & 14 deletions src/components/VerticalListMenu/VerticalListMenu.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@VerticalListMenu-levels: 8;

@VerticalListMenu-size-itemHeight: 29px;
@VerticalListMenu-size-border: 4px;
@VerticalListMenu-size-icon: 20px;
@VerticalListMenu-size-childSpacer: 6px;
@VerticalListMenu-size-childPadding: 15px;
Expand Down Expand Up @@ -38,11 +37,11 @@
height: @VerticalListMenu-size-icon;
width: @VerticalListMenu-size-icon;
margin: 4px;
margin-left: auto; // allows the expander to be flush on the right side
}

&-content {
.is-selectable();
.left-marker(0);
min-height: @VerticalListMenu-size-itemHeight;
display: flex;
font-size: 12px;
Expand All @@ -55,29 +54,25 @@
padding-left: 15px;

&-text {
width: 100%;
padding: @VerticalListMenu-size-childSpacer 0;
}

// Selected and hover state are the same for items
&&-is-selected,
&&-is-selected:hover {
.hardstop-gradient(
to right,
@color-primary,
@featured-color-primary-backgroundColor,
@VerticalListMenu-size-border
);
.left-marker(1);
color: @color-darkGray;
}

// Only show the left marker if the item is actionable
&&-is-actionable:hover,
&&-is-actionable:focus {
.left-marker(1);
}

&:hover,
&:focus {
.hardstop-gradient(
to right,
@color-primary,
@color-lightGray,
@VerticalListMenu-size-border
);
color: @color-darkGray;

// Style the expander button when the user hovers on the item content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';

import { lucidClassNames } from '../../util/style-helpers';

const cx = lucidClassNames.bind('&-ColorPalette');
const cx = lucidClassNames.bind('ColorPalette');

const colorList = [
{
Expand All @@ -13,28 +13,22 @@ const colorList = [
variables: [
'color-white',
'color-black',
'color-backgroundColor',
'color-pageBackgroundColor',
'color-borderColor',
]
},
{
category: 'Primary',
description: 'Primary Colors come in three states primary, primaryMedium and primaryLight',
description: 'The primary color is the most prominent color used throughout lucid. It\'s great for drawing the user\'s eye to particular components.',
variables: [
'color-primary',
'color-primaryMedium',
'color-primaryLight',
]
},
{
category: 'Container Colors',
description: 'Colors used to define colors of containers within components.',
variables: [
'color-backgroundColor',
'color-borderColor',
]
},
{
category: 'Text Colors',
description: 'Used to define the color of text within a component.',
variables: [
'color-textColor',
'color-disabledText',
Expand All @@ -44,8 +38,7 @@ const colorList = [
},
{
category: 'Grays',
description: 'Defined gray colors to be used with a component. Do not use ' +
'if a variable has been created that is more descriptive.',
description: 'Grays play an important role in lucid, and this set of grays forms the foundation for all the other variants. More prescriptive colors should be favored over these general grays when available.',
variables: [
'color-lightGray',
'color-gray',
Expand All @@ -55,7 +48,6 @@ const colorList = [
},
{
category: 'Transparent Grays',
description: 'Gray with an opacity.',
variables: [
'color-gray-5',
'color-gray-10',
Expand All @@ -65,10 +57,7 @@ const colorList = [
},
{
category: 'Featured Colors',
description: 'A featured color should only be used for a component that has ' +
'multiple states like banners or buttons or button like components ' +
'(single select). Featured colors should not be consumed by most components ' +
'instead use the color variables defined above.',
description: 'A featured color should only be used for a component that has multiple states like banners, buttons, or button like components (e.g. SingleSelect).',
variables: [
'featured-color-default',
'featured-color-primary',
Expand Down Expand Up @@ -139,6 +128,7 @@ const colorList = [
},
{
category: 'Chart 0',
description: 'Chart colors are used for data visualizations and were designed to be used in a particular order.',
variables: [
'color-chart-0-lightest',
'color-chart-0-light',
Expand Down Expand Up @@ -224,20 +214,22 @@ const colorList = [
const ColorPalette = React.createClass({
render() {
return (
<div >
<div className={cx('&')}>
<h2>Color Palette</h2>

<p>A list of all colors used. Colors are listed by group type.</p>
<p></p>

{_.map(colorList, (group, i) => (
<div key={i} style={{display: 'flex', flexWrap: 'wrap'}}>
<h3 style={{flex: '1 0 100%'}}>{group.category}</h3>
<div key={i}>
<h3>{group.category}</h3>

{group.description ?
<p style={{flex: '1 0 100%'}}>{group.description}</p>
<p>{group.description}</p>
: null}

{_.map(group.variables, (variable, j) => (
<div key={j} className={classNames(cx('&'))}>
<div className={cx(`&-${variable}`)}></div>
<p><code>{`@${variable};`}</code></p>
<div key={j} className={classNames(cx('&-item', `&-${variable}`))}>
{`@${variable};`}
</div>
))}
</div>
Expand Down
Loading

0 comments on commit 29eea4b

Please sign in to comment.