From fb917d01a97833c7a89276d69376e4b1c77e8035 Mon Sep 17 00:00:00 2001 From: Michael Fix Date: Wed, 20 May 2020 19:12:06 -0700 Subject: [PATCH] Fix a11y dark embed (#1019) * fix a11y-dark embed bug Closes #1018 * extract global highlights into a component --- components/Themes/GlobalHighlights.js | 75 +++++++++++++++++++++++++++ components/Themes/index.js | 67 +----------------------- pages/embed/index.js | 6 ++- 3 files changed, 82 insertions(+), 66 deletions(-) create mode 100644 components/Themes/GlobalHighlights.js diff --git a/components/Themes/GlobalHighlights.js b/components/Themes/GlobalHighlights.js new file mode 100644 index 0000000..536f042 --- /dev/null +++ b/components/Themes/GlobalHighlights.js @@ -0,0 +1,75 @@ +// Theirs +import React from 'react' + +export default function GlobalHighlights({ highlights }) { + return ( + + ) +} diff --git a/components/Themes/index.js b/components/Themes/index.js index 3630cf0..9a16386 100644 --- a/components/Themes/index.js +++ b/components/Themes/index.js @@ -1,6 +1,7 @@ import React from 'react' import dynamic from 'next/dynamic' +import GlobalHighlights from './GlobalHighlights' import Dropdown from '../Dropdown' import { managePopout } from '../Popout' import ThemeIcon from '../svg/Theme' @@ -124,76 +125,12 @@ class Themes extends React.PureComponent { onInputChange={e => this.setState({ name: e.target.value })} /> )} + diff --git a/pages/embed/index.js b/pages/embed/index.js index 94a458f..15d0b2a 100644 --- a/pages/embed/index.js +++ b/pages/embed/index.js @@ -8,7 +8,8 @@ import ApiContext from '../../components/ApiContext' import { StylesheetLink, CodeMirrorLink, MetaTags } from '../../components/Meta' import Font from '../../components/style/Font' import Carbon from '../../components/Carbon' -import { DEFAULT_CODE, DEFAULT_SETTINGS } from '../../lib/constants' +import GlobalHighlights from '../../components/Themes/GlobalHighlights' +import { DEFAULT_CODE, DEFAULT_SETTINGS, THEMES_HASH } from '../../lib/constants' import { getRouteState } from '../../lib/routing' const Page = props => ( @@ -21,6 +22,9 @@ const Page = props => ( {props.children} + {props.theme === 'a11y-dark' && ( + + )}