Skip to content
This repository was archived by the owner on Apr 7, 2025. It is now read-only.

Commit 7447741

Browse files
authored
fix(icon consistency): update global header icons (#7)
Attempting to unify our selection of icons across the dev and open source site.
1 parent 5a8db97 commit 7447741

File tree

6 files changed

+69
-27
lines changed

6 files changed

+69
-27
lines changed

src/components/DarkModeToggle.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ const DarkModeToggle = ({ darkMode, className }) => {
1010
<Sun
1111
size={15}
1212
color={darkMode.value ? `#CEDEDE` : `#000d0d`}
13-
fill={darkMode.value ? `#CEDEDE` : `#000d0d`}
1413
onClick={darkMode.disable}
1514
/>
1615
) : (
1716
<Moon
1817
size={15}
19-
stroke="rgba(0,0,0, 0)"
20-
fill={darkMode.value ? `#CEDEDE` : `#000d0d`}
18+
color={darkMode.value ? `#CEDEDE` : `#000d0d`}
2119
onClick={darkMode.enable}
2220
/>
2321
)}

src/components/GlobalHeader.js

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import DarkModeToggle from './DarkModeToggle';
4+
import { GitHub, Edit } from 'react-feather';
45

56
import styles from './GlobalHeader.module.scss';
67

7-
const GlobalHeader = ({ hasHeaderBg, className }) => {
8+
const GlobalHeader = ({ hasHeaderBg, className, editLink }) => {
89
return (
910
<div
1011
className={`${styles.globalHeaderContainer} ${
@@ -47,18 +48,36 @@ const GlobalHeader = ({ hasHeaderBg, className }) => {
4748
</div>
4849

4950
<ul className={styles.rightSideButtons}>
50-
<li className={styles.darkModeToggle}>
51-
<DarkModeToggle />
51+
<li
52+
className={`${styles.rightSideButton} ${styles.editPageButton}`}
53+
title="Edit this page"
54+
>
55+
<a
56+
href={editLink}
57+
className={styles.editPageButtonLink}
58+
target="__blank"
59+
>
60+
<Edit color="#000D0D" size={14} className={styles.editIcon} />
61+
</a>
5262
</li>
53-
<li className={`${styles.rightSideButton} ${styles.githubButton}`}>
63+
<li
64+
className={`${styles.rightSideButton} ${styles.githubButton}`}
65+
title="View the GitHub repo for this website"
66+
>
5467
<a
5568
href="https://github.com/newrelic/opensource-website"
5669
className={styles.githubButtonLink}
5770
target="__blank"
5871
>
59-
GitHub
72+
<GitHub color="#000D0D" size={14} className={styles.githubIcon} />
6073
</a>
6174
</li>
75+
<li
76+
className={`styles.darkModeToggle ${styles.rightSideButton}`}
77+
title="Toggle dark mode"
78+
>
79+
<DarkModeToggle />
80+
</li>
6281
</ul>
6382
</div>
6483
</div>
@@ -67,7 +86,8 @@ const GlobalHeader = ({ hasHeaderBg, className }) => {
6786

6887
GlobalHeader.propTypes = {
6988
hasHeaderBg: PropTypes.bool,
70-
className: PropTypes.string
89+
className: PropTypes.string,
90+
editLink: PropTypes.string
7191
};
7292

7393
export default GlobalHeader;

src/components/GlobalHeader.module.scss

+25-13
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,13 @@
8383
.right-side-button {
8484
width: 14px;
8585
height: 14px;
86-
text-indent: 300%;
87-
white-space: nowrap;
88-
overflow: hidden;
86+
border: none;
8987
padding: 0 8px 0;
9088
opacity: .45;
9189
background-repeat: no-repeat;
9290
background-position: center;
9391
transition: opacity .1s var(--ease-out-quad);
92+
transform: translateY(-2px);
9493

9594
&:hover {
9695
cursor: pointer;
@@ -101,6 +100,10 @@
101100
padding-right: 0;
102101
background-position: right;
103102
}
103+
104+
a {
105+
border: none;
106+
}
104107
}
105108

106109
.search-button {
@@ -114,22 +117,18 @@
114117
width: 15px;
115118
height: 15px;
116119
text-indent: 0;
120+
opacity: .45;
117121
}
118122

119123
.github-button-link {
120124
display: block;
121-
background-image: url('../images/icon-github.svg');
122-
text-indent: 100%;
123-
white-space: nowrap;
124-
overflow: hidden;
125125
}
126126

127127
.login-button {
128128
background-image: url('../images/icon-user.svg');
129129
}
130130

131131
.dark-mode-toggle {
132-
margin-right: 4px;
133132
position: relative;
134133
top: 3px;
135134
opacity: .45;
@@ -154,6 +153,15 @@
154153
.global-header-container {
155154
display: none;
156155
}
156+
157+
.edit-icon {
158+
stroke: #CEDEDE;
159+
}
160+
161+
.dark-mode-toggle {
162+
stroke: #CEDEDE;
163+
fill: transparent;
164+
}
157165
}
158166

159167
// ==============================================================
@@ -172,7 +180,7 @@
172180
}
173181

174182
.right-side-button {
175-
opacity: .75;
183+
opacity: .5;
176184

177185
&:hover {
178186
opacity: 1;
@@ -187,10 +195,6 @@
187195
.search-button {
188196
background-image: url('../images/icon-search-small-light.svg');
189197
}
190-
191-
.github-button-link {
192-
background-image: url('../images/icon-github-light.svg');
193-
}
194198

195199
.login-button {
196200
background-image: url('../images/icon-user-light.svg');
@@ -204,4 +208,12 @@
204208
color: var(--color-neutrals-700);
205209
}
206210
}
211+
212+
.github-icon {
213+
stroke: #CEDEDE;
214+
}
215+
216+
.edit-icon {
217+
stroke: #CEDEDE;
218+
}
207219
}

src/components/Header.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import GlobalHeader from './GlobalHeader';
1010

1111
import styles from './Header.module.scss';
1212

13-
const Header = ({ hasHeaderBg }) => {
13+
const Header = ({ hasHeaderBg, editLink }) => {
1414
const [mobileMenuActive, setMobileMenuActive] = useState(false);
1515

1616
const renderNavLinks = () => {
@@ -41,6 +41,7 @@ const Header = ({ hasHeaderBg }) => {
4141
<GlobalHeader
4242
hasHeaderBg={hasHeaderBg}
4343
className={mobileMenuActive ? styles.existsInActiveMobileMenu : ''}
44+
editLink={editLink}
4445
/>
4546
<header
4647
className={`${styles.primaryHeaderContainer} ${
@@ -76,7 +77,8 @@ const Header = ({ hasHeaderBg }) => {
7677
};
7778

7879
Header.propTypes = {
79-
hasHeaderBg: PropTypes.bool
80+
hasHeaderBg: PropTypes.bool,
81+
editLink: PropTypes.string
8082
};
8183

8284
export default Header;

src/components/Header.module.scss

+12-2
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,21 @@ div.exists-in-active-mobile-menu {
216216
margin-top: 59px;
217217
}
218218
}
219-
220219

221220
.has-header-bg:after {
222221
top: -180px;
223222
transform: skewY(-3deg);
224223
}
224+
225+
.mobile-menu-active .header-dark-mode-toggle {
226+
display: block;
227+
transform: scale(1.25);
228+
229+
svg {
230+
fill: transparent;
231+
stroke: var(--color-brand-800);
232+
}
233+
}
225234
}
226235

227236
// ==============================================================
@@ -259,6 +268,7 @@ div.exists-in-active-mobile-menu {
259268
}
260269

261270
.mobile-menu-active .header-dark-mode-toggle svg {
262-
fill: var(--color-neutrals-800);
271+
fill: transparent;
272+
stroke: var(--color-neutrals-800);
263273
}
264274
}

src/components/layout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Layout = ({
2727
<Helmet>
2828
<link rel="icon" href={favicon} />
2929
</Helmet>
30-
<Header hasHeaderBg={hasHeaderBg} />
30+
<Header hasHeaderBg={hasHeaderBg} editLink={editLink} />
3131
<main
3232
className={`layout-container-main ${
3333
fullWidth ? `full-width` : ''

0 commit comments

Comments
 (0)