Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: header front-end refactor code #27

Merged
merged 2 commits into from
Aug 2, 2018
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
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