Skip to content

Commit

Permalink
Merge pull request #27 from FACG4/header
Browse files Browse the repository at this point in the history
fix: header front-end refactor code
  • Loading branch information
yahyaHB authored Aug 2, 2018
2 parents 4b73ab1 + 1e4433f commit b99169d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/Header/HeaderTitle/HeaderTitle.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Component } from 'react';
import React from 'react';
import logo from './careandshare.png';

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

const Title = ({ title }) => {
return(
<a href="#">
<a>
{title?<h1>{title}</h1>:<img className="App-header-title" src={logo} alt="logo"/>}
</a>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React , { Component } from 'react';
import React from 'react';

import './style.css';

Expand Down
13 changes: 11 additions & 2 deletions frontend/src/components/Header/Notifications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import './style.css';
class Notifications extends Component {
state = {
show: false,
connectReq: [ //should be fetched from db
{ name: 'ahmed', id:1 },
{ name: 'mohammed', id:2 },
{ name: 'abdSamad', id:3 },
{ name: 'Frah', id:4 },
{ name: 'Ramy', id:5 },
{ name: 'Inass', id:6 },
{ name: 'Isaac', id:7 },
{ name: 'Marwa', id:8 },
]
}

toggleNotification = (e) => {
Expand All @@ -17,8 +27,7 @@ class Notifications extends Component {
}

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

const notifications = connectReq.length? connectReq.map(element => {
return <Notification name={element.name} key={element.id} />
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Header/Notifications/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
background-color: #FC2E2E;
color: #fff;
text-align: center;
font-size: 19px;
padding: auto;
line-height: 20px;
font-size: 14px;
position: absolute;
right: 10px;
top: 8px;
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import './style.css';

class Header extends Component {

// the title should come from the selected nav

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

<a className="menu">
Expand Down

0 comments on commit b99169d

Please sign in to comment.