Skip to content

Commit

Permalink
Merge pull request #18 from FACG4/header
Browse files Browse the repository at this point in the history
Header "front-end"
  • Loading branch information
yahyaHB authored Jul 31, 2018
2 parents e78248c + 40e0f14 commit 4b73ab1
Show file tree
Hide file tree
Showing 10 changed files with 231 additions and 0 deletions.
Empty file.
14 changes: 14 additions & 0 deletions frontend/src/components/Header/HeaderTitle/HeaderTitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React, { Component } from 'react';
import logo from './careandshare.png';

import ('../style.css');

const Title = ({ title }) => {
return(
<a href="#">
{title?<h1>{title}</h1>:<img className="App-header-title" src={logo} alt="logo"/>}
</a>
);
}

export default Title;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React , { Component } from 'react';

import './style.css';

const Notification = ({name}) => {
return (
<div className="notification-wrapper">
<p>{name} wants to connect with you!</p>
<div>
<button>Accept</button>
<button>Decline</button>
</div>
</div>
);
}

export default Notification;
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.notification-wrapper {
background-color: rgba(255, 255, 255, 0.8);
width: 300px;
height: 110px;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
margin-top: 7px;
}

.notification-wrapper div {
display: flex;
width: 80%;
justify-content: space-evenly;
}

.notification-wrapper p {
width: 80%;
text-align: center;
}

.notification-wrapper button {
cursor: pointer;
width: 90px;
height: 35px;
text-align: center;
border-radius: 18px;
background-color: #48A1AF;
border: none;
}

.notification-wrapper button:hover {
box-shadow: 0 2px 5px -2px #000;
}

.notification-wrapper button:nth-child(2) {
background-color: #848484;
}
Empty file.
43 changes: 43 additions & 0 deletions frontend/src/components/Header/Notifications/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React, { Component } from 'react';
import FontAwesomeIcon from 'react-fontawesome'

import Notification from './Notification/Notification';

import './style.css';

class Notifications extends Component {
state = {
show: false,
}

toggleNotification = (e) => {
this.setState(prevState => ({
show: !prevState.show
}));
}

render () {
const { connectReq } = this.props;
const { show } = this.state;

const notifications = connectReq.length? connectReq.map(element => {
return <Notification name={element.name} key={element.id} />
}):<p>You have no notifications</p>;

return(
<React.Fragment>
<a onClick={this.toggleNotification} className="notification">
<div>
{(connectReq.length && !show)?<span className="num">{connectReq.length}</span>:''}
<FontAwesomeIcon name="bell-o" />
</div>
</a>
<div className={`notifications ${show?'': "hidden"}`}>
{notifications}
</div>
</React.Fragment>
);
}
}

export default Notifications;
33 changes: 33 additions & 0 deletions frontend/src/components/Header/Notifications/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.notification .num {
display: block;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #FC2E2E;
color: #fff;
text-align: center;
font-size: 19px;
position: absolute;
right: 10px;
top: 8px;
}

.notifications {
width: 320px;
min-height: 100px;
background-color: #DFE2DB;
padding: 10px;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
position: absolute;
top: 30px;
z-index: 1;
transition: all 0.5s ease;
}

.hidden {
transform: translate(50%, -50%) scale(0);
transition: all 0.5s ease;
}
28 changes: 28 additions & 0 deletions frontend/src/components/Header/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React, { Component } from 'react';
import FontAwesomeIcon from 'react-fontawesome'

import HeaderTitle from './HeaderTitle/HeaderTitle';
import Notifications from './Notifications';

import './style.css';

class Header extends Component {

render(){
return(
<header className="App-header">
<Notifications connectReq={this.props.connectReq}/>
<HeaderTitle title={this.props.title} />

<a className="menu">
<FontAwesomeIcon name="bars" />
</a>
<a className="angle-left">
<FontAwesomeIcon name="angle-left" />
</a>
</header>
);
}
}

export default Header;
57 changes: 57 additions & 0 deletions frontend/src/components/Header/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

#root {
width: 375px;
height: 667px;
max-width: 375px;
max-height: 667px;
margin: 0 auto;
}

.App-header {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 120px;
background-color: #48A1AF;
box-shadow: 0px 4px 10px -6px #000;
}

.App-header a {
position: absolute;
font-size: 24px;
margin: 5px;
cursor: pointer;
text-decoration: none;
color: #000;
}

.App-header h1 {
font-size: 30px;
}

.App-header .menu {
left: 0;
top: 0;
}

.App-header .angle-left {
left: 0;
bottom: 0;
}

.App-header .notification {
font-size: 18px;
right: 0;
top: 0;
}

.App-header-title {
width: 200px;
}

0 comments on commit 4b73ab1

Please sign in to comment.