Skip to content

Commit 1b3c916

Browse files
Merge pull request #81 from topcoder-platform/PROD-1069_re-style
PROD-1069 settings page desktop styling - master
2 parents 4da04d1 + a40852a commit 1b3c916

File tree

74 files changed

+669
-509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+669
-509
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"react": "^17.0.2",
1212
"react-dom": "^17.0.2",
1313
"react-gtm-module": "^2.0.11",
14+
"react-responsive-modal": "^6.2.0",
1415
"react-router-dom": "^6.2.1",
1516
"react-scripts": "5.0.0",
1617
"react-toastify": "^8.2.0",

src/config/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const SETTINGS_TITLE: string = 'Profile Settings'

src/config/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
export * from './constants'
12
export * from './environments'

src/header/Header.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@
2828
@include xl {
2929
grid-template-columns: $left-col-width-xl 1fr auto;
3030
}
31+
32+
@include xxl {
33+
grid-template-columns: $left-col-width-xl 1fr auto;
34+
}
3135
}

src/header/utility-selectors/UtilitySelector/ProfileSelector/ProfileSelector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { FC, useContext } from 'react'
22

3+
import { SETTINGS_TITLE } from '../../../../config'
34
import { profileContext, ProfileContextData } from '../../../../lib'
45
import '../../../../lib/styles/index.scss'
56

@@ -23,7 +24,7 @@ const ProfileSelector: FC<{}> = () => {
2324
return (
2425
<div className={styles['profile-selector']}>
2526
{!isLoggedIn && <ProfileNotLoggedIn />}
26-
{isLoggedIn && <ProfileLoggedIn />}
27+
{isLoggedIn && <ProfileLoggedIn settingsTitle={SETTINGS_TITLE} />}
2728
</div>
2829
)
2930
}

src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/ProfileLoggedIn.tsx

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,73 @@ import { Dispatch, FC, SetStateAction, useContext, useState } from 'react'
22

33
import {
44
Avatar,
5+
ComponentVisible,
56
IconOutline,
67
logInfo,
78
profileContext,
89
ProfileContextData,
10+
useHideClickOutside,
911
} from '../../../../../lib'
1012

1113
import { ProfilePanel } from './profile-panel'
1214
import styles from './ProfileLoggedIn.module.scss'
1315

14-
const ProfileLoggedIn: FC<{}> = () => {
16+
interface ProfileLoggedInProps {
17+
settingsTitle: string
18+
}
19+
20+
const ProfileLoggedIn: FC<ProfileLoggedInProps> = (props: ProfileLoggedInProps) => {
1521

1622
const { profile }: ProfileContextData = useContext(profileContext)
1723
const [profilePanelOpen, setProfilePanelOpen]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false)
1824

25+
const {
26+
isComponentVisible,
27+
ref,
28+
setIsComponentVisible,
29+
}: ComponentVisible = useHideClickOutside(false)
30+
1931
if (!profile) {
2032
logInfo('tried to render the logged in profile w/out a profile')
2133
return <></>
2234
}
2335

2436
function toggleProfilePanel(): void {
25-
setProfilePanelOpen(!profilePanelOpen)
37+
const toggleTo: boolean = !profilePanelOpen
38+
setProfilePanelOpen(toggleTo)
39+
setIsComponentVisible(toggleTo)
40+
}
41+
42+
if (!isComponentVisible && profilePanelOpen) {
43+
setProfilePanelOpen(isComponentVisible)
2644
}
2745

2846
return (
2947
<>
30-
<div className={styles['profile-avatar']} onClick={() => toggleProfilePanel()} >
48+
<div
49+
className={styles['profile-avatar']}
50+
onClick={toggleProfilePanel}
51+
>
3152
<Avatar
3253
firstName={profile.firstName}
3354
lastName={profile.lastName}
3455
handle={profile.handle}
3556
photoUrl={profile.photoURL}
57+
size='sm'
3658
/>
3759
{profilePanelOpen && (
3860
<div className={styles.overlay}>
3961
<IconOutline.XIcon />
4062
</div>
4163
)}
4264
</div>
43-
{profilePanelOpen && <ProfilePanel toggleProfilePanel={toggleProfilePanel} />}
65+
{profilePanelOpen && (
66+
<ProfilePanel
67+
refObject={ref}
68+
settingsTitle={props.settingsTitle}
69+
toggleProfilePanel={toggleProfilePanel}
70+
/>
71+
)}
4472
</>
4573
)
4674
}

src/header/utility-selectors/UtilitySelector/ProfileSelector/profile-logged-in/profile-panel/ProfilePanel.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, useContext } from 'react'
1+
import { FC, MutableRefObject, useContext } from 'react'
22
import { Link } from 'react-router-dom'
33

44
import {
@@ -12,32 +12,35 @@ import {
1212
import styles from './ProfilePanel.module.scss'
1313

1414
interface ProfilePanelProps {
15+
refObject: MutableRefObject<any>
16+
settingsTitle: string
1517
toggleProfilePanel: () => void
1618
}
1719

1820
const ProfilePanel: FC<ProfilePanelProps> = (props: ProfilePanelProps) => {
1921

2022
const { profile }: ProfileContextData = useContext(profileContext)
21-
const { getPath }: RouteContextData = useContext(routeContext)
23+
const { getPath }: RouteContextData = useContext(routeContext)
2224

2325
if (!profile) {
2426
// this should never happen
2527
return <></>
2628
}
2729

28-
const settingsTitle: string = 'Settings'
29-
3030
return (
31-
<div className={styles['profile-panel']}>
31+
<div
32+
className={styles['profile-panel']}
33+
ref={props.refObject}
34+
>
3235
<div className={styles.handle}>
3336
{profile.handle}
3437
</div>
3538
<Link
3639
className={styles.profile}
3740
onClick={() => props.toggleProfilePanel()}
38-
to={getPath(settingsTitle)}
41+
to={getPath(props.settingsTitle)}
3942
>
40-
{settingsTitle}
43+
{props.settingsTitle}
4144
</Link>
4245
<a href={authUrlLogout} className={styles.logout}>
4346
Log Out

src/lib/avatar/Avatar.module.scss

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
11
@import '../../lib/styles';
22

3-
$avatar-size: 32px;
3+
$avatar-size-sm: 32px;
4+
$border-size-sm: $border;
5+
$avatar-size-xl: 120px;
6+
$border-size-xl: $pad-xs;
47

58
.avatar-container {
69
overflow: hidden;
710
background-color: $tc-white;
811
border-radius: 50%;
9-
height: 36px;
12+
13+
&.sm {
14+
height: calc($avatar-size-sm + 2 * $border-size-sm);
15+
width: calc($avatar-size-sm + 2 * $border-size-sm);
16+
}
17+
18+
&.xl {
19+
height: calc($avatar-size-xl + 2 * $border-size-xl);
20+
width: calc($avatar-size-xl + 2 * $border-size-xl);
21+
}
1022

1123
.avatar {
12-
height: $avatar-size;
13-
width: $avatar-size;
1424
background-color: $tc-white;
1525
border-radius: 50%;
16-
border: 2px solid $tc-white;
26+
border: solid $tc-white;
27+
28+
&.sm {
29+
border-width: $border-size-sm;
30+
height: $avatar-size-sm;
31+
width: $avatar-size-sm;
32+
}
33+
34+
&.xl {
35+
border-width: $border-size-xl;
36+
height: $avatar-size-xl;
37+
width: $avatar-size-xl;
38+
}
1739
}
1840

1941
.avatar-letters {
@@ -24,6 +46,14 @@ $avatar-size: 32px;
2446
color: $tc-white;
2547
background-color: $blue-100;
2648
@include font-weight-medium;
27-
@extend .medium-subtitle;
49+
50+
&.sm {
51+
@extend .medium-subtitle;
52+
}
53+
54+
&.xl {
55+
@extend h1;
56+
padding: 0;
57+
}
2858
}
2959
}

src/lib/avatar/Avatar.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import { FC } from 'react'
44
import styles from './Avatar.module.scss'
55

66
interface AvatarProps {
7+
containerClass?: string
78
firstName?: string
89
handle?: string
910
lastName?: string
1011
photoUrl?: string
12+
size: 'sm' | 'xl'
1113
}
1214

1315
const Avatar: FC<AvatarProps> = (props: AvatarProps) => {
@@ -19,17 +21,21 @@ const Avatar: FC<AvatarProps> = (props: AvatarProps) => {
1921

2022
const avatarElement: JSX.Element = !!props.photoUrl
2123
? (
22-
<img src={props.photoUrl} alt={`${props.handle} avatar`} className={styles.avatar} />
24+
<img
25+
alt={`${props.handle} avatar`}
26+
className={classNames(styles.avatar, styles[props.size])}
27+
src={props.photoUrl}
28+
/>
2329
)
2430
: (
25-
<span className={classNames(styles.avatar, styles['avatar-letters'])}>
31+
<span className={classNames(styles.avatar, styles['avatar-letters'], styles[props.size])}>
2632
{props.firstName?.charAt(0)}
2733
{props.lastName?.charAt(0)}
2834
</span>
2935
)
3036

3137
return (
32-
<div className={styles['avatar-container']}>
38+
<div className={classNames(styles['avatar-container'], styles[props.size], props.containerClass)}>
3339
{avatarElement}
3440
</div>
3541
)

src/lib/button/Button.module.scss

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
line-height: 24px;
1414

1515
&:focus {
16-
outline: 2px solid $turq-140;
16+
outline: $border solid $turq-140;
1717
}
1818

1919
&.button-sm {
@@ -98,6 +98,43 @@
9898
}
9999
}
100100

101+
&.link {
102+
margin: 0;
103+
padding: 0;
104+
display: flex;
105+
align-items: center;
106+
font-size: 16px;
107+
color: $turq-160;
108+
background-color: $tc-white;
109+
border: none;
110+
outline: none;
111+
border-radius: 0;
112+
113+
&:focus {
114+
outline: $border solid $turq-140;
115+
}
116+
117+
&:hover {
118+
color: $turq-120;
119+
}
120+
121+
&:active {
122+
color: $turq-180;
123+
}
124+
125+
&.disabled {
126+
color: $black-60;
127+
background-color: $tc-white;
128+
border-color: $black-5;
129+
}
130+
131+
svg {
132+
margin-left: $pad-xs;
133+
height: $pad-lg;
134+
width: $pad-lg;
135+
}
136+
}
137+
101138
&.text {
102139
border-color: transparent;
103140
}

0 commit comments

Comments
 (0)