Skip to content

Topcoder Member Profile UI Fixes and Enhancements - Part 1 #2596

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

Merged
merged 1 commit into from
Jun 9, 2019
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
6 changes: 6 additions & 0 deletions src/assets/images/profile/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/device-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/service-provider-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/software-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/subscription-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
102 changes: 73 additions & 29 deletions src/shared/components/Settings/Profile/Education/List/Item/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* render education Item
*/
import _ from 'lodash';
import React from 'react';
import PT from 'prop-types';
import ReactSVG from 'react-svg';
Expand All @@ -19,47 +20,89 @@ export default function Item(props) {
education,
index,
onDeleteItem,
onEditItem,
} = props;

const hasSecondLine = () => {
if (_.isEmpty(education.timePeriodFrom) && _.isEmpty(education.timePeriodTo)
&& !education.graduated) {
return false;
}

return true;
};

return (
<div styleName="container">
<div styleName="education-info">
<div styleName="education-icon">
<ReactSVG path={assets('./ico-education.svg')} />
</div>
<div styleName="education-parameters">
<div styleName="parameter-first-line">
<div styleName={`education-parameters${hasSecondLine() ? '' : ' single-line'}`}>
<div styleName={`parameter-first-line${hasSecondLine() ? '' : ' single-line'}`}>
{ `${education.schoolCollegeName} ${education.type}` }
</div>
<div styleName="parameter-second-line">
{ `${moment(education.timePeriodFrom).format('YYYY')} - ${moment(education.timePeriodTo).format('YYYY')}${education.graduated ? ' | Graduated' : ''}` }
</div>
<div styleName="parameter-second-line-mobile">
<p>
{`${moment(education.timePeriodFrom).format('YYYY')} - ${moment(education.timePeriodTo).format('YYYY')}`}
</p>
{
education.graduated && (
<p>
Graduated
</p>
)
}
</div>
{
hasSecondLine() && (
<React.Fragment>
<div styleName="parameter-second-line">
{
`${!_.isEmpty(education.timePeriodFrom) && !_.isEmpty(education.timePeriodTo) && !education.graduated ? `${moment(education.timePeriodFrom).format('YYYY')} - ${moment(education.timePeriodTo).format('YYYY')}` : ''}`
}
{
_.isEmpty(education.timePeriodFrom) && _.isEmpty(education.timePeriodTo) && `${education.graduated ? 'Graduated' : ''}`
}
{
!_.isEmpty(education.timePeriodFrom) && !_.isEmpty(education.timePeriodTo) && education.graduated && `${moment(education.timePeriodFrom).format('YYYY')} - ${moment(education.timePeriodTo).format('YYYY')} | Graduated`
}
</div>
<div styleName="parameter-second-line-mobile">
{
!_.isEmpty(education.timePeriodFrom) && !_.isEmpty(education.timePeriodTo) && (
<p>
{`${moment(education.timePeriodFrom).format('YYYY')} - ${moment(education.timePeriodTo).format('YYYY')}`}
</p>
)
}
{
education.graduated && (
<p>
Graduated
</p>
)
}
</div>
</React.Fragment>
)
}
</div>
</div>
<a
styleName="delete"
onKeyPress={() => onDeleteItem(index)}
tabIndex={0}
role="button"
onClick={() => onDeleteItem(index)}
>
<img src={assets('./ico-trash.svg')} alt="delete-icon" />
<p>
Delete
</p>
</a>
<div styleName="operation-container">
<a
styleName="edit"
onKeyPress={() => onEditItem(index)}
tabIndex={0}
role="button"
onClick={() => onEditItem(index)}
>
<img src={assets('./ico-edit.svg')} alt="edit-icon" />
<p>
Edit
</p>
</a>
<a
styleName="delete"
onKeyPress={() => onDeleteItem(index)}
tabIndex={0}
role="button"
onClick={() => onDeleteItem(index)}
>
<img src={assets('./ico-trash.svg')} alt="delete-icon" />
<p>
Delete
</p>
</a>
</div>
</div>
);
}
Expand All @@ -68,4 +111,5 @@ Item.propTypes = {
education: PT.shape().isRequired,
index: PT.number.isRequired,
onDeleteItem: PT.func.isRequired,
onEditItem: PT.func.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
line-height: 20px;
text-transform: capitalize;
padding-right: 20px;

&.single-line {
flex-direction: row;
align-items: center;
}
}

.parameter-first-line {
Expand All @@ -44,6 +49,10 @@
margin-bottom: 10px;
word-break: break-all;

&.single-line {
margin-bottom: 0;
}

@include upto-sm {
margin-bottom: 0;
}
Expand Down Expand Up @@ -74,32 +83,70 @@
}
}

.delete {
.operation-container {
display: flex;
flex-direction: column;
justify-items: center;
justify-content: center;
cursor: pointer;
outline-style: none;
flex-direction: row;
justify-content: space-between;

img {
margin-bottom: 10px;
.delete {
display: flex;
flex-direction: column;
justify-items: center;
justify-content: center;
cursor: pointer;
outline-style: none;
margin-left: 10px;

img {
margin-bottom: 10px;

@include upto-sm {
margin-bottom: 0;
}
}

p {
@include roboto-regular;

@include upto-sm {
margin-bottom: 0;
font-size: 11px;
line-height: 15px;
font-weight: 400;
color: $tc-gray-50;

@include upto-sm {
display: none;
}
}
}

p {
@include roboto-regular;
.edit {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
outline-style: none;
margin-left: 10px;

img {
margin-bottom: 10px;

@include upto-sm {
margin-bottom: 0;
}
}

font-size: 11px;
line-height: 15px;
font-weight: 400;
color: $tc-gray-50;
p {
@include roboto-regular;

font-size: 11px;
line-height: 15px;
font-weight: 400;
color: $tc-gray-50;

@include upto-sm {
display: none;
@include upto-sm {
display: none;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function EducationList(props) {
const {
educationList,
onDeleteItem,
onEditItem,
} = props;

return (
Expand All @@ -19,7 +20,12 @@ export default function EducationList(props) {
{
educationList.items.map((education, index) => (
<li key={`${education.type}${index + 1}`}>
<Item education={education} index={index} onDeleteItem={onDeleteItem} />
<Item
education={education}
index={index}
onDeleteItem={onDeleteItem}
onEditItem={onEditItem}
/>
</li>
))
}
Expand All @@ -31,4 +37,5 @@ export default function EducationList(props) {
EducationList.propTypes = {
educationList: PT.shape().isRequired,
onDeleteItem: PT.func.isRequired,
onEditItem: PT.func.isRequired,
};
Loading