Skip to content

Commit

Permalink
Merge pull request #3 from smollweide/develop
Browse files Browse the repository at this point in the history
v0.1.2
  • Loading branch information
smollweide committed Nov 28, 2016
2 parents b8b388a + 6cc78a3 commit 5bffc71
Show file tree
Hide file tree
Showing 13 changed files with 803 additions and 521 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ language: node_js
node_js:
- "6"
- "5"
- "4"
- "4"
script:
- npm run test:coverage
after_success:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

# react-speed-dial

[![npm version](https://badge.fury.io/js/react-speed-dial.svg)](https://badge.fury.io/js/react-speed-dial)
[![Build Status](https://img.shields.io/travis/smollweide/react-speed-dial/master.svg)](https://travis-ci.org/smollweide/react-speed-dial)
[![Coverage Status](https://coveralls.io/repos/github/smollweide/react-speed-dial/badge.svg?branch=master)](https://coveralls.io/github/smollweide/react-speed-dial?branch=master)
[![Dependencies](https://img.shields.io/david/smollweide/react-speed-dial/master.svg)](https://david-dm.org/smollweide/react-speed-dial)
[![npm](https://img.shields.io/npm/v/react-speed-dial.svg)](https://www.npmjs.com/package/react-speed-dial)
[![npm](https://img.shields.io/npm/dt/react-speed-dial.svg)](https://www.npmjs.com/package/react-speed-dial)
[![Codestyle](https://img.shields.io/badge/codestyle-namics-green.svg)](https://github.com/namics/eslint-config-namics)

> React Component that implements a speed dial using [Material-UI](http://www.material-ui.com).
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
"scripts": {
"clean:build": "rimraf build",
"clean:publish": "rimraf publish",
"clean:coverage": "rimraf coverage",
"preinstall": "npm install -g pushstate-server",
"clear-install": "rm -rf node_modules && npm install",
"start": "react-scripts start",
"prebuild": "npm run lint",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"pretest:coverage": "npm run clean:coverage",
"test:coverage": "npm test -- --coverage",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.jsx src/**/*.js",
Expand Down Expand Up @@ -68,20 +70,22 @@
"babel-polyfill": "^6.7.4",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.11.1",
"coveralls": "^2.11.15",
"enzyme": "^2.6.0",
"gh-pages": "^0.12.0",
"nms-core-utils": "^1.0.0",
"react-addons-test-utils": "^15.4.0",
"react-scripts": "0.7.0",
"rimraf": "^2.5.4",
"sinon": "^1.17.6",
"webpack": "^1.13.3"
},
"dependencies": {
"babel-runtime": "^6.18.0",
"material-ui": "^0.16.4",
"react": "^15.4.0",
"react-dom": "^15.4.0",
"react-router": "^2.7.0",
"react-router": "^3.0.0",
"react-tap-event-plugin": "^2.0.1",
"simple-assign": "^0.1.0"
}
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<title>React speed dial (Material UI)</title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js" type="text/javascript" async=""></script>
<script src="https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js" type="text/javascript" async=""></script>
<script>
var WebFontConfig = {
google: { families: [ 'Roboto:400,300,500:latin' ] }
Expand Down
55 changes: 16 additions & 39 deletions src/components/bubble-list-item/bubble-list-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class BubbleListItem extends React.Component {
};

this.styles = getStyles(muiTheme);
this.getVerticalStyleMain = this.getVerticalStyleMain.bind(this);
this.getStylesMain = this.getStylesMain.bind(this);
this.getStylesText = this.getStylesText.bind(this);
this.getStylesFocus = this.getStylesFocus.bind(this);
Expand Down Expand Up @@ -75,40 +74,26 @@ class BubbleListItem extends React.Component {
/**
* @returns {Object} vertical styles for root element
*/
getVerticalStyleMain() {

const { isOpen, positionV } = this.props;
const styles = this.styles;

if (isOpen) {
return positionV === 'bottom' ? styles.mainBottom : styles.mainTop;
}

return positionV === 'bottom' ? styles.mainInvisibleBottom : styles.mainInvisibleTop;
}

/**
* @returns {Object} styles for root element
*/
getStylesMain() {

const { isOpen, leftAvatar } = this.props;
const { isOpen, positionV, leftAvatar } = this.props;
const positionH = Boolean(leftAvatar) ? 'left' : 'right';
const styles = this.styles;
const baseStyle = isOpen ? styles.main : styles.mainInvisible;
const verticalStyle = this.getVerticalStyleMain();

if (leftAvatar) {
if (isOpen) {
return Object.assign(
baseStyle,
styles.mainLeft,
verticalStyle
{},
styles.root.main,
styles.root[positionV],
styles.root[positionH]
);
}

return Object.assign(
baseStyle,
styles.mainRight,
verticalStyle
{},
styles.rootInvisible.main,
styles.rootInvisible[positionV],
styles.rootInvisible[positionH]
);
}

Expand All @@ -132,21 +117,13 @@ class BubbleListItem extends React.Component {
getStylesText() {

const { leftAvatar } = this.props;
const positionH = Boolean(leftAvatar) ? 'left' : 'right';
const styles = this.styles;

if (leftAvatar) {
return Object.assign(
{},
styles.text,
styles.textLeft,
this.getStylesFocus('text')
);
}

return Object.assign(
{},
styles.text,
styles.textRight,
styles.text.main,
styles.text[positionH],
this.getStylesFocus('text')
);
}
Expand Down Expand Up @@ -198,7 +175,7 @@ class BubbleListItem extends React.Component {
<a
href={href}
ref="link"
style={styles.wrap}
style={styles.wrap.main}
tabIndex={isOpen ? tabIndex : -1}
onBlur={this.handleBlur}
onFocus={this.handleFocus}
Expand All @@ -211,7 +188,7 @@ class BubbleListItem extends React.Component {
return (
<a
ref="link"
style={styles.wrap}
style={styles.wrap.main}
tabIndex={isOpen ? tabIndex : -1}
onBlur={this.handleBlur}
onFocus={this.handleFocus}
Expand Down

0 comments on commit 5bffc71

Please sign in to comment.