Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion src/components/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ function Layout({
settings,
}) {
return (
<div className="flex flex-col h-screen">
<div
className={[
'flex flex-col h-screen',
settings.darkMode && 'bg-gray-900',
].join(' ')}
>
<div className="mb-8 flex-none">
<Header
gistId={gistId}
Expand Down
11 changes: 7 additions & 4 deletions src/components/Playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import usePlayground from '../hooks/usePlayground';
import Layout from './Layout';
import Loader from './Loader';

function Paper({ children }) {
function Paper({ children, settings }) {
return (
<div className="editor p-4 gap-4 md:gap-8 md:h-56 flex-auto grid-cols-1 md:grid-cols-2">
<div
style={settings.darkMode ? { background: 'black' } : null}
className="editor p-4 gap-4 md:gap-8 md:h-56 flex-auto grid-cols-1 md:grid-cols-2"
>
{children}
</div>
);
Expand Down Expand Up @@ -39,7 +42,7 @@ function Playground() {
isLoading ? 'opacity-0' : 'opacity-100',
].join(' ')}
>
<Paper>
<Paper settings={settings}>
<div className="flex-auto relative h-56 md:h-full">
<MarkupEditor markup={markup} dispatch={dispatch} />
</div>
Expand All @@ -56,7 +59,7 @@ function Playground() {

<div className="flex-none h-8" />

<Paper>
<Paper settings={settings}>
<div className="flex-auto relative h-56 md:h-full">
<Query query={query} result={result} dispatch={dispatch} />
</div>
Expand Down
18 changes: 17 additions & 1 deletion src/components/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function Settings({ settings, dispatch }) {
};

const showBehavior = typeof settings.autoRun !== 'undefined';
const showDarkMode = typeof settings.darkMode !== 'undefined';
const showTestingLibrary = typeof settings.testIdAttribute !== 'undefined';

return (
Expand All @@ -40,7 +41,22 @@ function Settings({ settings, dispatch }) {
</div>
)}

{showBehavior && showTestingLibrary && <Divider />}
{showBehavior && showDarkMode && <Divider />}

{showDarkMode && (
<div>
<h3 className="text-sm font-bold mb-2">Dark Mode</h3>
<label className="flex space-x-4 items-center">
<Toggle
icons={false}
defaultChecked={settings.darkMode}
name="darkMode"
/>
</label>
</div>
)}

{showDarkMode && showTestingLibrary && <Divider />}

{showTestingLibrary && (
<div>
Expand Down
8 changes: 8 additions & 0 deletions src/styles/app.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,18 @@ div[data-reach-menu-popover] {
@apply bg-white rounded shadow grid relative;
}

.editor-dark {
@apply bg-black rounded shadow grid relative;
}

.editor > .h-full-within {
height: calc(100% - 2rem);
}

.editor-dark > .h-full-within {
height: calc(100% - 2rem);
}

.h-half {
height: 50%;
}
Expand Down