From c16ae16582fcbe2e26c868dad5886f699328eabd Mon Sep 17 00:00:00 2001 From: Ahmed Shatat Date: Wed, 1 Aug 2018 15:20:19 +0300 Subject: [PATCH 1/2] fix: header front-end refactor code --- .../components/Header/HeaderTitle/HeaderTitle.js | 4 ++-- .../Notifications/Notification/Notification.js | 2 +- .../src/components/Header/Notifications/index.js | 13 +++++++++++-- .../src/components/Header/Notifications/style.css | 4 +++- frontend/src/components/Header/index.js | 4 +++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/Header/HeaderTitle/HeaderTitle.js b/frontend/src/components/Header/HeaderTitle/HeaderTitle.js index 693a58b..3e2fb3a 100644 --- a/frontend/src/components/Header/HeaderTitle/HeaderTitle.js +++ b/frontend/src/components/Header/HeaderTitle/HeaderTitle.js @@ -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( - + {title?

{title}

:logo}
); diff --git a/frontend/src/components/Header/Notifications/Notification/Notification.js b/frontend/src/components/Header/Notifications/Notification/Notification.js index 0aa5fe2..fa1f38a 100644 --- a/frontend/src/components/Header/Notifications/Notification/Notification.js +++ b/frontend/src/components/Header/Notifications/Notification/Notification.js @@ -1,4 +1,4 @@ -import React , { Component } from 'react'; +import React from 'react'; import './style.css'; diff --git a/frontend/src/components/Header/Notifications/index.js b/frontend/src/components/Header/Notifications/index.js index 478a554..e30cb96 100644 --- a/frontend/src/components/Header/Notifications/index.js +++ b/frontend/src/components/Header/Notifications/index.js @@ -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) => { @@ -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 diff --git a/frontend/src/components/Header/Notifications/style.css b/frontend/src/components/Header/Notifications/style.css index fe808f5..c0443e8 100644 --- a/frontend/src/components/Header/Notifications/style.css +++ b/frontend/src/components/Header/Notifications/style.css @@ -6,7 +6,9 @@ background-color: #FC2E2E; color: #fff; text-align: center; - font-size: 19px; + padding: auto; + line-height: 20px; /*to center it vertically*/ + font-size: 14px; /*change it to fit two digits*/ position: absolute; right: 10px; top: 8px; diff --git a/frontend/src/components/Header/index.js b/frontend/src/components/Header/index.js index 19e7529..79c483f 100644 --- a/frontend/src/components/Header/index.js +++ b/frontend/src/components/Header/index.js @@ -8,10 +8,12 @@ import './style.css'; class Header extends Component { + // the title should come from the selected nav + render(){ return(
- + From 1e4433fbe480459b909d03e1733599c61472f04b Mon Sep 17 00:00:00 2001 From: Ahmed Shatat Date: Wed, 1 Aug 2018 16:35:32 +0300 Subject: [PATCH 2/2] remove unnessesary comments --- frontend/src/components/Header/Notifications/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Header/Notifications/style.css b/frontend/src/components/Header/Notifications/style.css index c0443e8..d52b9c9 100644 --- a/frontend/src/components/Header/Notifications/style.css +++ b/frontend/src/components/Header/Notifications/style.css @@ -7,8 +7,8 @@ color: #fff; text-align: center; padding: auto; - line-height: 20px; /*to center it vertically*/ - font-size: 14px; /*change it to fit two digits*/ + line-height: 20px; + font-size: 14px; position: absolute; right: 10px; top: 8px;