Skip to content

Commit

Permalink
Merge pull request #51 from webgem-xyz/notifcations
Browse files Browse the repository at this point in the history
✨  Added Notifications route
✨  Added Notification Component

❗️ Missing documentation and changes in CHANGELOG
  • Loading branch information
Yannick authored Jan 21, 2018
2 parents 9875695 + aefc166 commit 2c05a16
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import firebase from 'firebase/app';
// Import Routes
import Login from '../routes/login';
import Home from '../components/home';
import Notifications from '../routes/notifications';

// Import Firebase Login
import fireApp from '../base2';
Expand Down Expand Up @@ -88,6 +89,7 @@ export default class App extends Component {
email={this.state.email}
logout={this.logout}
/>
<Notifications path="/notification" />
</Router>
</div>
);
Expand Down
20 changes: 20 additions & 0 deletions src/components/notification/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Component } from 'preact';
import { PropTypes } from 'preact-compat';

import style from './style';

export default class Notification extends Component {
render() {
const details = this.props.details;
return (
<div class={style.notificationWrapper}>
<p>{details.message}</p>
<p>{details.date}</p>
</div>
);
}
}

Notification.propTypes = {
details: PropTypes.object.isRequired,
};
16 changes: 16 additions & 0 deletions src/components/notification/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.notificationWrapper {
align-items: center;
border: 1px solid var(--main-color);
display: flex;
justify-content: space-around;
margin: 5px 0;

p {
display: inline-block;
font-weight: 700;
}

p:nth-child(2) {
font-weight: 400;
}
}
28 changes: 28 additions & 0 deletions src/routes/notifications/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Component } from 'preact';
import style from './style';

import Notification from '../../components/notification/index';
import Header from '../../components/header/';

export default class Notifications extends Component {
constructor(props) {
super(props);

this.state = {
notifications: {
notification1: { message: 'You have 10 uploads this week!', date: '16-01-2018' },
notification2: { message: 'You have 20 uploads this week!', date: '16-01-2018' }
},
};
}
render() {
return (
<div class={style.notifications}>
<Header title="Notification"/>
{Object.keys(this.state.notifications).map(key => (
<Notification key={key} index={key} details={this.state.notifications[key]} />
))}
</div>
);
}
}
4 changes: 4 additions & 0 deletions src/routes/notifications/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.notifications {
display: block;
padding: 16px;
}

0 comments on commit 2c05a16

Please sign in to comment.