Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions frontend/js/components/environments/Category.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class Category extends Component {
const categories = this.props.category.categories;

return (
<CategoryList
categories={categories.sort((catA, catB) => {
return catA.rank - catB.rank;
})} />
);
<CategoryList
categories={categories.sort((catA, catB) => {
return catA.rank - catB.rank;
})} />
);
}
}

Expand Down
14 changes: 6 additions & 8 deletions frontend/js/components/molecules/IconButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ import React, { PropTypes, Component } from 'react';
import Icon from './../atoms/Icon';

class IconButton extends Component {

render() {
return (
<button
onClick={this.props.onClick}
className="icon-button">
<Icon class="big padded">{this.props.icon}</Icon>
</button>
);
<button
onClick={this.props.onClick}
className="icon-button">
<Icon class="big padded">{this.props.icon}</Icon>
</button>
);
}

}

IconButton.propTypes = {
Expand Down
39 changes: 39 additions & 0 deletions frontend/js/components/organisms/Alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { Component, PropTypes } from 'react';
import IconButton from './../molecules/IconButton';

const alertLevels = [
'success',
'warning',
'danger'
];

class Alert extends Component {
render() {
let levelClass = 'info';
if (alertLevels.includes(this.props.level)) {
levelClass = this.props.level;
}

Copy link
Member

@qwo qwo Jun 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let levelClass = alertLevels[this.props.level] || 'info'; be cleaner or harder to understand?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after talking to blaine its fine left as is.

we dont want css class 🥔 after all.

return (
<div className={`alert ${levelClass}`}>
<div className="alert-message">
{ this.props.message }
</div>
{
this.props.onDismiss &&
<IconButton
onClick={this.props.onDismiss}
icon="close" />
}
</div>
);
}
}

Alert.propTypes = {
level: PropTypes.string,
message: PropTypes.string,
onDismiss: PropTypes.func
};

export default Alert;
30 changes: 30 additions & 0 deletions frontend/styles/alert.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@import 'colors';

.alert {
display: flex;
justify-content: space-between;
align-items: center;
padding: .5em 1em;
border-radius: 4px;

&.info {
background: $blue;
color: darken($blue, 50%);
}

&.danger {
background: $red;
color: darken($red, 50%);
}

&.warning {
background: $yellow;
color: darken($yellow, 50%);
}

&.success {
background: $green;
color: darken($green, 50%);
}

}
4 changes: 2 additions & 2 deletions frontend/styles/colors.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
$red: #F33535;
$lightBlue: #D8E9F0;
$darkBlue: #33425B;
$black: #29252C;
Expand All @@ -8,7 +7,8 @@ $lightGray: #E1E1E1;
$darkGray: #666666;
$darkerGray: #999999;

// threshold colors
$blue: #D9EDF7;
$green: #84ba71;
$yellow: #e0cc47;
$orange: #e89f31;
$red: #F33535;
3 changes: 2 additions & 1 deletion frontend/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ This file exists only to import other stylesheets.
@import 'survey';
@import 'survey-card';
@import 'results';
@import 'agreement-selector';
@import 'agreement-selector';
@import 'alert';