fix: restore preview background to white (#36714)

This commit is contained in:
Ahmad Abdolsaheb
2019-08-29 18:45:32 +03:00
committed by GitHub
parent f03147fcc5
commit a59b8636cb
5 changed files with 5 additions and 30 deletions

View File

@ -5,6 +5,7 @@
padding: 0;
margin: 0;
border: none;
background-color: white;
}
.enable-iframe {

View File

@ -9,7 +9,6 @@ import {
} from 'lodash';
import { compileHeadTail, setExt, transformContents } from '../utils/polyvinyl';
import { nightThemeStyle } from './displayStyle.js';
const htmlCatch = '\n<!--fcc-->\n';
const jsCatch = '\n;/*fcc*/\n';
@ -57,15 +56,8 @@ export const cssToHtml = cond([
[stubTrue, identity]
]);
export function concatHtml({
required = [],
template,
files = [],
theme = 'night'
} = {}) {
theme = theme === '' ? 'night' : theme;
export function concatHtml({ required = [], template, files = [] } = {}) {
const createBody = template ? _template(template) : defaultTemplate;
const displayTheme = theme === 'night' ? nightThemeStyle : ` `;
const head = required
.map(({ link, src }) => {
if (link && src) {
@ -81,7 +73,7 @@ A required file can not have both a src and a link: src = ${src}, link = ${link}
}
return '';
})
.reduce((head, element) => head.concat(element), displayTheme);
.reduce((head, element) => head.concat(element));
const source = files.reduce(
(source, file) => source.concat(file.contents, htmlCatch),

View File

@ -1,10 +0,0 @@
export const nightThemeStyle = `
<style>
html{
color: white;
}
a {
color: #99c9ff;
}
</style>
`;

View File

@ -15,7 +15,6 @@ import { createIdToNameMapSaga } from './id-to-name-map-saga';
import { createExecuteChallengeSaga } from './execute-challenge-saga';
import { createCurrentChallengeSaga } from './current-challenge-saga';
import { challengeTypes } from '../../../../utils/challengeTypes';
import { userSelector } from '../../../redux';
export const ns = 'challenge';
export const backendNS = 'backendChallenge';
@ -183,7 +182,6 @@ export const projectFormValuesSelector = state =>
state[ns].projectFormValues || {};
export const challengeDataSelector = state => {
const { theme } = userSelector(state);
const { challengeType } = challengeMetaSelector(state);
let challengeData = { challengeType };
if (
@ -225,7 +223,6 @@ export const challengeDataSelector = state => {
template
};
}
challengeData.theme = theme;
return challengeData;
};

View File

@ -108,12 +108,7 @@ async function getDOMTestRunner(buildData, proxyLogger, document) {
runTestInTestFrame(document, testString, testTimeout);
}
export function buildDOMChallenge({
files,
required = [],
template = '',
theme = ``
}) {
export function buildDOMChallenge({ files, required = [], template = '' }) {
const finalRequires = [...globalRequires, ...required, ...frameRunner];
const loadEnzyme = Object.keys(files).some(key => files[key].ext === 'jsx');
const toHtml = [jsToHtml, cssToHtml];
@ -125,7 +120,7 @@ export function buildDOMChallenge({
.then(checkFilesErrors)
.then(files => ({
challengeType: challengeTypes.html,
build: concatHtml({ required: finalRequires, template, files, theme }),
build: concatHtml({ required: finalRequires, template, files }),
sources: buildSourceMap(files),
loadEnzyme
}));