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

Dark mode #359

Merged
merged 82 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
066e163
feat: Add sun and moon icons
jerelmiller Jun 23, 2020
1aaa856
feat: Add use-dark-mode and gatsby-plugin-use-dark-mode
jerelmiller Jun 23, 2020
670c726
feat: Add dark mode toggle to the header
jerelmiller Jun 23, 2020
296a537
feat: Start working on dark mode variables
jerelmiller Jun 23, 2020
50e2e43
chore: Update global styles to use abstracted css vars
jerelmiller Jun 23, 2020
d0c4376
chore: Remove unused className and make active class easier to use
jerelmiller Jun 23, 2020
fc60ee2
Add secondary hover colors
jerelmiller Jun 23, 2020
7a61a40
feat: Update GlobalHeader to use abstract color vars
jerelmiller Jun 23, 2020
d404bad
feat: Add intro-text class to index page and remove duplicate styles
jerelmiller Jun 23, 2020
341053f
feat: Update background color on section
jerelmiller Jun 23, 2020
c8efa50
feat: Update sidebar links to use abstract css var colors
jerelmiller Jun 23, 2020
3698b55
feat: Add accent text color
jerelmiller Jun 23, 2020
26763ac
feat: Update guide listing description to use accent text color
jerelmiller Jun 23, 2020
e6d1fe3
feat: Change how section backgrounds are rendered
jerelmiller Jun 23, 2020
c064edc
feat: Add surface colors
jerelmiller Jun 23, 2020
7225b80
feat: Change accent color for dark mode
jerelmiller Jun 23, 2020
846d903
chore: Add back class name support for section
jerelmiller Jun 23, 2020
80008d6
feat: Add a tertiary background color. Adjust secondary surface color
jerelmiller Jun 23, 2020
d2091e4
feat: Update GuideTile to use abstract css color vars
jerelmiller Jun 23, 2020
e0eb521
feat: Fix margins on guide listing
jerelmiller Jun 23, 2020
0408e28
feat: Update logo to better handle theme colors
jerelmiller Jun 23, 2020
603df66
feat: Update new relic logo to better handle dark mode
jerelmiller Jun 23, 2020
707d357
feat: Update code snippet bottom bar to use abstract color vars
jerelmiller Jun 23, 2020
26bf15f
feat: Update Step to use abstract color vars
jerelmiller Jun 23, 2020
82c6209
feat: Update markdown and guide templates to use abstract color vars
jerelmiller Jun 23, 2020
6a583fc
refactor: Move neutrals into a new dark variable
jerelmiller Jun 23, 2020
544d01c
feat: Update Callouts to work with dark mode
jerelmiller Jun 23, 2020
c5895d7
feat: Update CodeSnippet to use dark theme
jerelmiller Jun 23, 2020
fcf7d1b
Update component doc code snippets to handle dark theme
jerelmiller Jun 23, 2020
15a1ccb
feat: Update PropList to handle dark mode
jerelmiller Jun 23, 2020
c1efaec
feat: Update CodeDef to handle dark mode
jerelmiller Jun 23, 2020
89345aa
feat: Update ConstantReference to handle dark mode
jerelmiller Jun 23, 2020
df29c40
feat: Update layout components to use dark mode css var
jerelmiller Jun 23, 2020
cbf71b9
feat: Update box shadow in dark mode
jerelmiller Jun 23, 2020
1d617aa
refactor: Move boxshadow variable to light-theme
jerelmiller Jun 23, 2020
737d1dd
chore: Remove unused tile background variable
jerelmiller Jun 23, 2020
d4b1463
feat: Update 404 page for dark mode
jerelmiller Jun 23, 2020
e88e593
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jun 27, 2020
fc823ff
chore: Fix sidebar nav item colors after merge
jerelmiller Jun 27, 2020
9c50895
chore: Fix background on stiped sections and intro text color
jerelmiller Jun 27, 2020
7eefd99
chore: Fix background color on set of 3 tiles
jerelmiller Jun 27, 2020
34ebc39
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jun 29, 2020
f1c0b32
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jun 29, 2020
7557666
feat: Update buttons to handle dark mode
jerelmiller Jun 30, 2020
f31fb6f
chore: fix the border color on guide tile hover state
jerelmiller Jun 30, 2020
e3b72ec
chore: Fix background on inline code snippets
jerelmiller Jun 30, 2020
83f8f85
chore: Change primary text color
jerelmiller Jun 30, 2020
8489c32
feat: Update search input for dark mode
jerelmiller Jun 30, 2020
a48f4b0
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jun 30, 2020
62b5321
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jun 30, 2020
ea2c9fd
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jun 30, 2020
afdc35c
chore: Update primary text color and heading text color
jerelmiller Jun 30, 2020
b27fc78
chore: Update colors for code definitions
jerelmiller Jun 30, 2020
9ec6b23
chore: Add a background behind the component preview
jerelmiller Jun 30, 2020
2f0e1d5
feat: Update icon gallery to work with dark mode
jerelmiller Jun 30, 2020
f0685e5
feat: Update deprecation notice for dark mode
jerelmiller Jun 30, 2020
5d8f4d7
chore: Update yellow colors to match nr1 color palette
jerelmiller Jun 30, 2020
c39153f
feat: Update callouts to handle dark mode
jerelmiller Jun 30, 2020
db48b20
chore: Default logo text color to heading text color
jerelmiller Jun 30, 2020
9d509c3
chore: Fix theme var name for primary background
jerelmiller Jun 30, 2020
bb5b1fd
chore: Remove unused button var declarations
jerelmiller Jun 30, 2020
dc82413
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jul 1, 2020
d154047
chore: Match secondary background to open source site
jerelmiller Jul 1, 2020
2a5861e
chore: Update guide tile based on changes to secondary background color
jerelmiller Jul 1, 2020
2cf836a
chore: Remove unused call to action component
jerelmiller Jul 1, 2020
eb0bef8
chore: Update border on featured guide
jerelmiller Jul 1, 2020
d333ae1
chore: Swap placement of dark mode icon
jerelmiller Jul 1, 2020
0a7f45a
chore: Better color match on global header to open source site
jerelmiller Jul 1, 2020
d2c419a
chore: Update NR logo to use heading text color for dark mode
jerelmiller Jul 1, 2020
233c6d6
chore: Update input styles to match open source site
jerelmiller Jul 1, 2020
2c7b442
chore: Update guide tile to use border hover css var
jerelmiller Jul 1, 2020
6e67e54
chore: Fix vertical alignment of header icons
jerelmiller Jul 1, 2020
c305d9a
chore: Fix inline code snippet background color
jerelmiller Jul 1, 2020
9956fee
chore: Update primary button to match open source site
jerelmiller Jul 1, 2020
afa9d14
chore: Define better hover colors for navigation items in dark mode
jerelmiller Jul 1, 2020
02138eb
chore: Fix margin for tiles on overview page
jerelmiller Jul 1, 2020
6ea0fab
chore: Fix mobile menu styling for dark mode
jerelmiller Jul 1, 2020
2274f01
chore: Fix primary button border color
jerelmiller Jul 1, 2020
c4cb100
Merge branch 'master' into jerel/dark-mode
jerelmiller Jul 1, 2020
b680d0d
chore: Fix code snippet line highlighting in dark mode
jerelmiller Jul 1, 2020
cbae45c
Merge branch 'jerel/dark-mode' of github.com:newrelic/developer-websi…
jerelmiller Jul 1, 2020
0798cc7
Merge remote-tracking branch 'origin/master' into jerel/dark-mode
jerelmiller Jul 1, 2020
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
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module.exports = {
policy: [{ userAgent: '*', allow: '/' }],
},
},
'gatsby-plugin-use-dark-mode',
'gatsby-plugin-sitemap',
'gatsby-plugin-meta-redirect',
{
Expand Down
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"gatsby-plugin-sass": "^2.3.4",
"gatsby-plugin-sharp": "^2.6.14",
"gatsby-plugin-sitemap": "^2.4.5",
"gatsby-plugin-use-dark-mode": "^1.1.2",
"gatsby-remark-images": "^3.3.10",
"gatsby-source-filesystem": "^2.3.11",
"gatsby-transformer-remark": "^2.8.15",
Expand All @@ -36,7 +37,8 @@
"react-live": "^2.2.2",
"react-markdown": "^4.3.1",
"react-middle-ellipsis": "^1.1.0",
"react-shadow": "^18.1.2"
"react-shadow": "^18.1.2",
"use-dark-mode": "^2.3.1"
},
"devDependencies": {
"@newrelic/eslint-plugin-newrelic": "^0.3.0",
Expand Down
18 changes: 17 additions & 1 deletion src/components/Button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,35 @@
}

.primary {
color: #fff;
color: var(--color-white);
border-color: var(--color-brand-800);
background-color: var(--color-brand-800);

:global(.dark-mode) & {
color: var(--primary-background-color);
background-color: var(--color-brand-400);
border-color: var(--color-brand-400);
}
}

.normal {
color: var(--color-neutrals-800);
border-color: var(--color-neutrals-100);
background-color: var(--color-neutrals-100);

:global(.dark-mode) & {
color: var(--color-white);
border-color: var(--color-dark-100);
background-color: var(--color-dark-100);
}
}

.plain {
color: var(--color-brand-800);
border-color: transparent;
background-color: transparent;

:global(.dark-mode) & {
color: var(--color-brand-400);
}
}
19 changes: 0 additions & 19 deletions src/components/CallToAction.js

This file was deleted.

88 changes: 0 additions & 88 deletions src/components/CallToAction.module.scss

This file was deleted.

19 changes: 16 additions & 3 deletions src/components/Callouts.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,35 @@
.tip {
padding: 1.25rem 0.3rem 1.25rem 1.25rem;
margin: 1.55rem 3rem 1.55rem 1.25rem;
color: var(--primary-text-color);

h4 {
margin-top: 0.1rem !important;
font-size: 0.8rem !important;
font-size: 0.75rem !important;
text-transform: uppercase;
color: var(--color-neutrals-800) !important;
color: var(--heading-text-color);
}
}
.caution {
border-left: 4px solid var(--color-red-400);
background: var(--color-red-100);

:global(.dark-mode) & {
background: var(--color-red-900);
}
}
.important {
border-left: 4px solid var(--color-yellow-400);
background: var(--color-yellow-100);

:global(.dark-mode) & {
background: var(--color-yellow-900);
}
}
.tip {
border-left: 4px solid var(--color-green-400);
background: var(--color-green-100);

:global(.dark-mode) & {
background: var(--color-green-900);
}
}
21 changes: 21 additions & 0 deletions src/components/CodeDef/CodeDef.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@

.identifier {
color: var(--color-neutrals-700);

:global(.dark-mode) & {
color: var(--color-dark-700);
}
}

.type {
padding: 0.125rem;
border-radius: 0.125rem;
color: var(--color-green-500);
background: var(--color-green-050);

:global(.dark-mode) & {
color: var(--color-green-600);
background: var(--color-green-100);
}
}

.comment {
Expand All @@ -20,12 +29,20 @@
> p {
display: inline;
}

:global(.dark-mode) & {
color: var(--color-dark-600);
}
}

.keyword,
.bracket,
.operator {
color: var(--color-neutrals-600);

:global(.dark-mode) & {
color: var(--color-dark-600);
}
}

.block {
Expand All @@ -34,6 +51,10 @@

.string {
color: var(--color-green-500);

:global(.dark-mode) & {
color: var(--color-green-200);
}
}

.number {
Expand Down
7 changes: 5 additions & 2 deletions src/components/CodeSnippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import React from 'react';
import PropTypes from 'prop-types';
import Button from './Button';
import Highlight, { defaultProps } from 'prism-react-renderer';
import github from 'prism-react-renderer/themes/github';
import lightTheme from 'prism-react-renderer/themes/github';
import darkTheme from 'prism-react-renderer/themes/nightOwl';
import MiddleEllipsis from 'react-middle-ellipsis';
import FeatherIcon from './FeatherIcon';
import styles from './CodeSnippet.module.scss';
import useClipboard from '../hooks/useClipboard';
import useFormattedCode from '../hooks/useFormattedCode';
import Prism from 'prism-react-renderer/prism';
import useDarkMode from 'use-dark-mode';
import cx from 'classnames';

(typeof global !== 'undefined' ? global : window).Prism = Prism;
Expand All @@ -26,6 +28,7 @@ const CodeSnippet = ({
const language = className.replace('language-', '');
const formattedCode = useFormattedCode(children ?? '');
const [copied, copyCode] = useClipboard();
const darkMode = useDarkMode();
const linesToHighlight =
lineHighlight && captureLinesToHighlight(lineHighlight);

Expand All @@ -34,7 +37,7 @@ const CodeSnippet = ({
<div className={styles.container}>
<Highlight
{...defaultProps}
theme={github}
theme={darkMode.value ? darkTheme : lightTheme}
code={formattedCode.trim()}
language={language}
>
Expand Down
9 changes: 5 additions & 4 deletions src/components/CodeSnippet.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@

.highlight {
background: var(--color-neutrals-300);

:global(.dark-mode) & {
background: var(--color-dark-100);
}
}

.bottomBar {
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
background: var(--color-neutrals-200);
background: var(--tertiary-background-color);
padding: 0 1rem;
}

Expand All @@ -51,9 +55,6 @@

.copyButton {
font-size: 0.75rem;
color: var(--color-brand-800);
background: none;
border: none;
outline: none;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ConstantReference.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.container {
color: var(--color-neutrals-600);
color: var(--secondary-text-color);
font-size: 0.875rem;

&:not(:last-child) {
Expand Down
Loading