From 17968f79bda048589209b0f9316b2545c96e4368 Mon Sep 17 00:00:00 2001 From: Harsh <29hj29@gmail.com> Date: Wed, 8 May 2019 11:02:38 +0530 Subject: [PATCH] Make the UI of Skills similar to skill types in Admin in mobile view --- src/components/Admin/Admin.css | 10 ++++ src/components/Admin/Admin.js | 101 ++++++++++++++++++++++++--------- 2 files changed, 84 insertions(+), 27 deletions(-) diff --git a/src/components/Admin/Admin.css b/src/components/Admin/Admin.css index ade4b7b1..a73482ab 100644 --- a/src/components/Admin/Admin.css +++ b/src/components/Admin/Admin.css @@ -62,8 +62,18 @@ line-height: 2; } +.skillCountMobileView{ + display: none; +} + @media screen and (max-width: 520px) { .flexCard { width: 310px; } + .skillCount { + display: none; + } + .skillCountMobileView { + display: inline; + } } diff --git a/src/components/Admin/Admin.js b/src/components/Admin/Admin.js index 202e4b81..5a53f0e4 100644 --- a/src/components/Admin/Admin.js +++ b/src/components/Admin/Admin.js @@ -93,13 +93,34 @@ class Admin extends Component { }; render() { - const tabStyle = { - width: '100%', - animated: false, - textAlign: 'left', - display: 'inline-block', + const styles = { + tabStyle: { + width: '100%', + animated: false, + textAlign: 'left', + display: 'inline-block', + }, + skillCountStyle: { + display: 'flex', + justifyContent: 'space-between', + marginTop: '50px', + }, + skillCountMobileViewStyle: { + width: '300px', + height: '210px', + marginBottom: '20px', + fontSize: '18px', + fontWeight: 'bold', + lineHeight: '2', + }, }; - + const { skillStats } = this.state; + const { totalSkills, reviewedSkills, nonReviewedSkills } = skillStats; + const totalSkillsCount = skillStats && totalSkills ? totalSkills : 0; + const reviewedSkillsCount = + skillStats && reviewedSkills ? reviewedSkills : 0; + const nonReviewedSkillsCount = + skillStats && nonReviewedSkills ? nonReviewedSkills : 0; return (
{cookies.get('showAdmin') === 'true' ? ( @@ -109,7 +130,7 @@ class Admin extends Component {

Admin Panel

- + } + style={ + window.innerWidth <= 520 + ? styles.skillCountMobileViewStyle + : null + } > -

Total

+

+ Total + : + + {totalSkillsCount} + +

- {this.state.skillStats && - this.state.skillStats.totalSkills - ? this.state.skillStats.totalSkills - : 0} + {totalSkillsCount}
-

Reviewed

+

+ Reviewed + : + + {reviewedSkillsCount} + +

- {this.state.skillStats && - this.state.skillStats.reviewedSkills - ? this.state.skillStats.reviewedSkills - : 0} + {reviewedSkillsCount}
-

Not Reviewed

+

+ Not Reviewed + : + + {nonReviewedSkillsCount} + +

{' '} - {this.state.skillStats && - this.state.skillStats.nonReviewedSkills - ? this.state.skillStats.nonReviewedSkills - : 0} + {nonReviewedSkillsCount}