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

Update profile page design #365

Merged
merged 7 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from 6 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
30 changes: 25 additions & 5 deletions amundsen_application/static/css/_layouts.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
@import 'variables';
$header-height: 84px;
$resource-header-height: 84px;

.resource-detail-layout {
min-width: 1048px;

.resource-header {
display: flex;
height: $header-height;
height: $resource-header-height;
border-bottom: 2px solid $divider;
padding: 16px 24px 0;

Expand All @@ -27,11 +25,33 @@ $header-height: 84px;
max-width: calc(100% - 100px);
}
}

.header-bullets {
display: inline;
margin: 0;
padding: 0;

li {
display: inline;
&:after { content: "\00A0\2022\00A0"; }
&:last-child:after { content: ""; }
}
}


&.header-links {
flex-shrink: 0;
> * {
margin-right: 16px;
}

.header-link {
display: inline-block;
margin: 13px 16px 0 0;

.avatar-label {
font-weight: $font-weight-body-bold;
}
}
}
&.header-buttons {
Expand All @@ -51,7 +71,7 @@ $header-height: 84px;
// 630 | 414+ Flexible layout
.column-layout-1 {
display: flex;
height: calc(100% - #{$header-height});
height: calc(100% - #{$resource-header-height});

> .left-panel {
> .banner {
Expand Down
3 changes: 2 additions & 1 deletion amundsen_application/static/css/_variables-default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ $icon-bg-dark: $gray60 !default;
$icon-bg-disabled: $gray20 !default;


// Header & Footer
// Header, Body, & Footer
$nav-bar-color: $indigo100;
$nav-bar-height: 60px;
$body-min-width: 1048px;
$footer-height: 60px;


Expand Down
4 changes: 4 additions & 0 deletions amundsen_application/static/css/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

// TODO - Move to separate files
// Layout
#main {
min-width: $body-min-width;
}

#main > .container {
margin: 96px auto 48px;
}
Expand Down
12 changes: 7 additions & 5 deletions amundsen_application/static/js/components/NavBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AppConfig from 'config/config';
import { LinkConfig } from 'config/config-types';
import { GlobalState } from 'ducks/rootReducer';
import { logClick } from 'ducks/utilMethods';
import { Dropdown } from 'react-bootstrap';
import { Dropdown, MenuItem } from 'react-bootstrap';

import { LoggedInUser } from 'interfaces';

Expand Down Expand Up @@ -85,11 +85,13 @@ export class NavBar extends React.Component<NavBarProps> {
<div className='title-2'>{this.props.loggedInUser.display_name}</div>
<div>{this.props.loggedInUser.email}</div>
</div>
<li>
<Link id="nav-bar-avatar-link" to={`/user/${this.props.loggedInUser.user_id}?source=navbar`}>
<MenuItem
componentClass={Link}
id="nav-bar-avatar-link"
to={`/user/${this.props.loggedInUser.user_id}?source=navbar`}
href={`/user/${this.props.loggedInUser.user_id}?source=navbar`}>
My Profile
</Link>
</li>
</MenuItem>
</Dropdown.Menu>
</Dropdown>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Avatar from 'react-avatar';
import * as History from 'history';

import { shallow } from 'enzyme';
import { Dropdown } from 'react-bootstrap';
import { Dropdown, MenuItem } from 'react-bootstrap';

import { Link, NavLink } from 'react-router-dom';
import { NavBar, NavBarProps, mapStateToProps } from '../';
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('NavBar', () => {
});

it('renders My Profile link correctly inside of user dropdown', () => {
element = wrapper.find(Dropdown).find(Dropdown.Menu).find(Link).at(0);
element = wrapper.find(Dropdown).find(Dropdown.Menu).find(MenuItem).at(0);
expect(element.children().text()).toEqual('My Profile');
expect(element.props().to).toEqual('/user/test0?source=navbar');
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const AVATAR_SIZE = 40;

export const BOOKMARKED_LABEL = 'bookmarked';
export const BOOKMARKED_SOURCE = 'profile_bookmark';
export const BOOKMARKED_TAB_KEY = 'bookmark_tab';
Expand Down
139 changes: 71 additions & 68 deletions amundsen_application/static/js/components/ProfilePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { GetBookmarksForUserRequest } from 'ducks/bookmark/types';
import { getBookmarksForUser } from 'ducks/bookmark/reducer';

import {
AVATAR_SIZE,
BOOKMARKED_LABEL,
BOOKMARKED_SOURCE,
BOOKMARKED_TAB_KEY,
Expand Down Expand Up @@ -142,78 +143,80 @@ export class ProfilePage extends React.Component<ProfilePageProps, ProfilePageSt
const user = this.props.user;
return (
<DocumentTitle title={ `${user.display_name} - Amundsen Profile` }>
<div className="container profile-page">
<div className="row">
<div className="col-xs-12 col-md-offset-1 col-md-10">
<div className="resource-detail-layout profile-page">
<header className="resource-header">
<div className="header-section">
<Breadcrumb />
{/* TODO - Consider making this part a separate component */}
<div className="profile-header">
<div id="profile-avatar" className="profile-avatar">
{
// default Avatar looks a bit jarring -- intentionally not rendering if no display_name
user.display_name && user.display_name.length > 0 &&
<Avatar name={user.display_name} size={74} round={true} />
}
</div>
<div className="profile-details">
<div id="profile-title" className="profile-title">
<h1>{ user.display_name }</h1>
{
(!user.is_active) &&
<Flag caseType="sentenceCase" labelStyle="danger" text="Alumni"/>
}
</div>
{
user.role_name && user.team_name &&
<div id="user-role" className="body-2">{ `${user.role_name} on ${user.team_name}` }</div>
}
{/*TODO - delete when 'role_name'/'title' is added to user object in backend */}
{
!user.role_name && user.team_name &&
<div id="user-role" className="body-2">{ `Team: ${user.team_name}` }</div>
}
{
user.manager_fullname &&
<div id="user-manager" className="body-2">{ `Manager: ${user.manager_fullname}` }</div>
}
<div className="profile-icons">
{/*TODO - Implement deep links to open Slack */}
{/*{*/}
{/*user.is_active && user.slack_id &&*/}
{/*<a id="slack-link" href={user.slack_id} className='btn btn-flat-icon' target='_blank'>*/}
{/*<img className='icon icon-dark icon-slack'/>*/}
{/*<span className="body-2">Slack</span>*/}
{/*</a>*/}
{/*}*/}
{
user.is_active &&
<a id="email-link" href={`mailto:${user.email}`} className='btn btn-flat-icon' target='_blank'>
<img className='icon icon-dark icon-mail'/>
<span className="body-2">{ user.email }</span>
</a>
}
{
user.is_active && user.profile_url &&
<a id="profile-link" href={user.profile_url} className='btn btn-flat-icon' target='_blank'>
<img className='icon icon-dark icon-users'/>
<span className="body-2">Employee Profile</span>
</a>
}
{
user.github_username &&
<a id="github-link" href={`https://github.com/${user.github_username}`} className='btn btn-flat-icon' target='_blank'>
<img className='icon icon-dark icon-github'/>
<span className="body-2">Github</span>
</a>
}
</div>
</div>
<div id="profile-avatar" className="profile-avatar">
{
user.display_name && user.display_name.length > 0 &&
<Avatar name={user.display_name} size={AVATAR_SIZE} round={true} />
}
</div>
<div id="profile-tabs" className="profile-tabs">
<Tabs tabs={ this.generateTabInfo() } defaultTab={ BOOKMARKED_TAB_KEY } />
</div>

<div className="header-section header-title">
<h3 className="header-title-text truncated">
{ user.display_name }
{
(!user.is_active) &&
<Flag caseType="sentenceCase" labelStyle="danger" text="Alumni"/>
danwom marked this conversation as resolved.
Show resolved Hide resolved
}
</h3>
<div className="body-3">
<ul className="header-bullets">
{
user.role_name &&
<li id="user-role">{ user.role_name }</li>
}
{
user.team_name &&
<li id="team-name">{ user.team_name }</li>
}
{
user.manager_fullname &&
<li id="user-manager">{ `Manager: ${user.manager_fullname}` }</li>
}
</ul>
</div>
</div>
</div>
<div className="header-section header-links">
{/*{*/}
{/* // TODO - Implement deep links to open Slack *!/*/}
{/* user.is_active && user.slack_id &&*/}
{/* <a id="slack-link" href={user.slack_id} className='btn btn-flat-icon header-link' target='_blank'>*/}
{/* <img className='icon icon-dark icon-slack'/>*/}
{/* <span className="body-2">Slack</span>*/}
{/* </a>*/}
{/*}*/}
{
user.is_active &&
<a id="email-link" href={`mailto:${user.email}`} className='btn btn-flat-icon header-link' target='_blank'>
<img className='icon icon-dark icon-mail'/>
<span className="body-2">{ user.email }</span>
</a>
}
{
user.is_active && user.profile_url &&
<a id="profile-link" href={user.profile_url} className='btn btn-flat-icon header-link' target='_blank'>
<img className='icon icon-dark icon-users'/>
<span className="body-2">Employee Profile</span>
</a>
}
{
user.github_username &&
<a id="github-link" href={`https://github.com/${user.github_username}`} className='btn btn-flat-icon header-link' target='_blank'>
<img className='icon icon-dark icon-github'/>
<span className="body-2">Github</span>
</a>
}
</div>
</header>
<main>
<div className="profile-tabs">
<Tabs tabs={ this.generateTabInfo() } defaultTab={ BOOKMARKED_TAB_KEY } />
</div>
</main>
</div>
</DocumentTitle>
);
Expand Down
56 changes: 14 additions & 42 deletions amundsen_application/static/js/components/ProfilePage/styles.scss
Original file line number Diff line number Diff line change
@@ -1,56 +1,28 @@
@import 'variables';

.profile-page {
.profile-avatar {
display: inline-block;
margin: 6px 16px 0 0;
}

.profile-header {
display: flex;

.profile-avatar {
.header-title-text {
.flag {
margin-left: 8px;
margin-right: 30px;
}
}

.profile-details {
display: flex;
flex-direction: column;

h1 {
margin-bottom: 0;
margin-top: 0;
}

.profile-icons {
margin-top: 12px;

a {
margin-left: 8px;
margin-right: 8px;

&:first-child {
margin-left: 0;
}
&:last-child {
margin-right: 0;
}
}
}

.profile-title {
display: flex;
margin-bottom: 8px;
.profile-tabs {
margin-top: 24px;

.flag {
height: min-content; // TODO: consider moving height into Flag component
font-size: 16px;
margin: auto auto 4px 12px;
}
}
.nav-tabs {
margin-left: 16px;
}

.list-group {
margin-top: 0;
}
}

.profile-tabs {
margin-top: 64px;

// TODO: consider moving logic for empty content into Tab component
.empty-tab-message {
Expand Down
Loading