Skip to content

Commit

Permalink
Better default in channel component
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Mustonen committed Jul 10, 2016
1 parent 73d5f2e commit adeba64
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.node-version
.env
.DS_Store
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mozaik-ext-slack",
"version": "0.1.0",
"version": "0.2.0-beta.1",
"description": "Slack widgets to Mozaik dashboard",
"main": "./components.js",
"scripts": {
Expand All @@ -21,6 +21,7 @@
"babelify": "7.2.0",
"bluebird": "3.3.5",
"chalk": "1.1.3",
"classnames": "^2.2.5",
"convict": "^0.6.1",
"d3": "^4.1.0",
"d3-ease": "^1.0.0",
Expand Down
10 changes: 8 additions & 2 deletions src/components/Channel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import reactMixin from 'react-mixin';
import { ListenerMixin } from 'reflux';
import Mozaik from 'mozaik/browser';
import classNames from 'classnames';

class Channel extends Component {
constructor(props) {
Expand Down Expand Up @@ -44,26 +45,31 @@ class Channel extends Component {
render() {
const { message } = this.state;
let content = {
empty: true,
title: this.props.title || (this.props.channel ? `Slack ${this.props.channel}` : 'Slack'),
text: '--',
text: 'Send msg in Slack',
avatar: ''
};

// Override actual content
if (message) {
content.empty = false;
content.text = message.text;
content.author = message.user.real_name;
content.avatar = message.user.profile.image_48;
}

// Construct classes
content.class = classNames('slack-channel__message--value', { 'slack-channel__message--empty': content.empty });

return (<div>
<div className="widget__header">
<span className="widget__header__subject">{content.title}</span>
<i className="fa fa-comment-o" />
</div>
<div className="widget__body">
<div className="slack-channel__message">
<div className="slack-channel__message--value">{content.text}</div>
<div className={content.class}>{content.text}</div>
</div>
<div className="slack-channel__footer">
<div className="slack-channel__footer--avatar"><img src={content.avatar} /></div>
Expand Down
4 changes: 4 additions & 0 deletions styl/_slack.styl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
color white
margin: 0 1.6vmin

.slack-channel__message--empty
color: lighten($widget-bg-color, 20);
text-shadow: 0 2px 0 $label-bg-color;

.slack-channel__footer
position absolute
bottom 0
Expand Down

0 comments on commit adeba64

Please sign in to comment.