diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/ErrorDetails/index.tsx b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/ErrorDetails/index.tsx index d4df83394fa..f3bd04948e9 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/ErrorDetails/index.tsx +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/ErrorDetails/index.tsx @@ -12,14 +12,11 @@ const Container = styled.div` font-size: 0.875rem; line-height: 1.6; - color: rgba(255, 255, 255, 0.8); - - background-color: rgba(0, 0, 0, 0.5); - + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; + background-color: ${props => props.theme['sideBar.background']}; white-space: pre-wrap; - border-bottom: 1px solid rgba(0, 0, 0, 0.5); - &:last-child { border-bottom: none; } @@ -34,24 +31,20 @@ function escapeHtml(unsafe) { .replace(/'/g, '''); } -const white = 'rgba(255, 255, 255, 0.8)'; - const formatDiffMessage = (error: TestError, path: string) => { let finalMessage: string = ''; if (error.matcherResult) { - finalMessage = `${escapeHtml( - error.message - ) + finalMessage = `${escapeHtml(error.message) .replace(/(expected)/m, `$1`) .replace(/(received)/m, `$1`) - .replace(/(Difference:)/m, `$1`) + .replace(/(Difference:)/m, `$1`) .replace( /(Expected.*\n)(.*)/m, - `$1$2` + `$1$2` ) .replace( /(Received.*\n)(.*)/m, - `$1$2` + `$1$2` ) .replace(/^(-.*)/gm, `$1`) .replace( @@ -94,11 +87,7 @@ const formatDiffMessage = (error: TestError, path: string) => { } finalMessage += - `
` + + `
` + (code.highlight ? `> ` : '') + diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/TestName/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/TestName/elements.ts index 7d5ba25f9bd..3f6abbf8d23 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/TestName/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/TestName/elements.ts @@ -1,13 +1,13 @@ import styled from 'styled-components'; export const Block = styled.div<{ last: boolean }>` - transition: 0.3s ease color; display: flex; padding: 0.5rem 0.4rem; padding-left: 0.5rem; position: relative; margin-right: ${props => (props.last ? 0 : 12)}px; - color: rgba(255, 255, 255, 0.5); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'}; white-space: nowrap; @@ -15,28 +15,25 @@ export const Block = styled.div<{ last: boolean }>` content: ''; position: absolute; margin: auto; - top: 5px; + top: 13px; right: -10px; - width: 24px; - height: 24px; + width: 8px; + height: 8px; transform: rotate(45deg); - -webkit-transform: rotate(45deg); - -moz-transform: rotate(45deg); - -o-transform: rotate(45deg); - -ms-transform: rotate(45deg); - border-right: 1px solid rgba(0, 0, 0, ${props => (props.last ? 0.3 : 0.4)}); - border-top: 1px solid rgba(0, 0, 0, ${props => (props.last ? 0.3 : 0.4)}); - background-color: #181b1d; + border-right: 1px solid ${props => + props.theme.light ? `rgba(0, 0, 0, ${(props.last ? 0.3 : 0.4)})` : `rgba(255, 255, 255, ${(props.last ? 0.3 : 0.4)})`}; + border-top: 1px solid ${props => + props.theme.light ? `rgba(0, 0, 0, ${(props.last ? 0.3 : 0.4)})` : `rgba(255, 255, 255, ${(props.last ? 0.3 : 0.4)})`}; + background-color: rgba(0, 0, 0, 0.01); z-index: 1; } `; export const TestName = styled.div` - transition: 0.3s ease background-color; padding: 0.4rem; padding-left: 20px; - background-color: ${props => props.theme.background2}; - color: rgba(255, 255, 255, 0.8); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; flex: auto; white-space: nowrap; `; diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/elements.ts index c44c9c8df10..d3ba0e0dd95 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/TestBlock/elements.ts @@ -1,18 +1,22 @@ import styled from 'styled-components'; +import Color from 'color' export const BlockHeader = styled.div` display: flex; align-items: center; width: 100%; box-sizing: border-box; - padding: 0 0.5rem; - padding-right: 2px; - background-color: #191c1d; + padding: 0rem 1rem; + overflow: hidden; + background-color: ${props => Color(props.theme['sideBar.background']) + .darken(props.theme.light ? 0.1 : 0.3) + .rgbString()}; `; + export const Container = styled.div` - margin-bottom: 1rem; + margin-bottom: 0.75rem; overflow: hidden; border-radius: 2px; @@ -22,19 +26,22 @@ export const Actions = styled.div` display: flex; align-items: center; padding: 7px; - background-color: ${props => props.theme.background2}; + padding-right: 0; font-size: 0.875rem; - color: rgba(255, 255, 255, 0.5); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'}; + svg { - transition: 0.3s ease color; + transition: 0.3s ease opacity; margin-right: 1rem; font-size: 1.125rem; cursor: pointer; - + color: ${props => props.theme['button.hoverBackground']}; + opacity: 0.8; &:hover { - color: white; + opacity: 1; } } `; diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/elements.ts index 3480a03e6d9..0f2093cb4d3 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestDetails/elements.ts @@ -18,6 +18,10 @@ export const Action = styled.div` opacity: 0.7; cursor: pointer; + svg { + color: ${props => props.theme['button.hoverBackground']}; + } + &:hover { opacity: 1; } @@ -28,14 +32,15 @@ export const Action = styled.div` `; export const ErrorNotice = styled.div` - color: rgba(255, 255, 255, 0.5); + opacity: 0.5; + color:${props => props.theme['sideBar.foreground']}; font-weight: 500; `; export const TestName = styled.span` font-weight: 400; font-size: 1rem; - color: white; + color:${props => props.theme['sideBar.foreground']}; margin: 0; margin-top: 0; margin-bottom: 0; @@ -44,5 +49,6 @@ export const TestName = styled.span` export const Blocks = styled.span` font-size: 1rem; font-weight: 300; - color: rgba(255, 255, 255, 0.7); + opacity: 0.7; + color:${props => props.theme['sideBar.foreground']} `; diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestElement/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestElement/elements.ts index 5987a3070eb..05dda690662 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestElement/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestElement/elements.ts @@ -6,26 +6,27 @@ export const Actions = styled.div` opacity: 0; font-size: 1.125rem; - color: white; + color: ${props => + props.theme.light ? 'rgb(0, 0, 0)' : 'rgb(255, 255, 255)'}; svg { margin-left: 0.5rem; - transition: 0.3s ease color; - - color: rgba(255, 255, 255, 0.6); + transition: 0.3s ease opacity; + opacity: 0.6; + color: ${props => props.theme['button.hoverBackground']}; &:hover { - color: rgba(255, 255, 255, 1); + opacity: 1; } } `; export const TestName = styled.div` - transition: 0.3s ease background-color; padding: 0.25rem; padding-left: 20px; - background-color: ${props => props.theme.background2}; - color: rgba(255, 255, 255, 0.8); + background-color: ${props => props.theme['sideBar.background']}; + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; flex: auto; white-space: nowrap; `; @@ -36,43 +37,37 @@ export const Test = styled.div<{ status: Status }>` padding-left: 1rem; cursor: pointer; - background-color: #181b1d; - ${props => props.status === 'idle' && css` - color: rgba(255, 255, 255, 0.4); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.4)' : 'rgba(255, 255, 255, 0.4)'}; `}; `; export const Block = styled.div<{ last: boolean }>` - transition: 0.3s ease color; display: flex; padding: 0.25rem 0.4rem; padding-left: 0.5rem; position: relative; margin-right: ${props => (props.last ? 0 : 12)}px; - color: rgba(255, 255, 255, 0.5); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'}; white-space: nowrap; &::after { content: ''; position: absolute; - margin: auto; - top: 3px; + top: 8px; right: -10px; - width: 17px; - height: 17px; + width: 10px; + height: 10px; transform: rotate(45deg); - -webkit-transform: rotate(45deg); - -moz-transform: rotate(45deg); - -o-transform: rotate(45deg); - -ms-transform: rotate(45deg); - border-right: 2px solid rgba(0, 0, 0, 0.2); - border-top: 2px solid rgba(0, 0, 0, 0.2); - background-color: #181b1d; - z-index: 1; + border-right: 1px solid ${props => + props.theme.light ? `rgba(0, 0, 0, ${(props.last ? 0.3 : 0.4)})` : `rgba(255, 255, 255, ${(props.last ? 0.3 : 0.4)})`}; + border-top: 1px solid ${props => + props.theme.light ? `rgba(0, 0, 0, ${(props.last ? 0.3 : 0.4)})` : `rgba(255, 255, 255, ${(props.last ? 0.3 : 0.4)})`}; } `; @@ -86,18 +81,21 @@ export const FileData = styled.div` `; export const Path = styled.span` - color: rgba(255, 255, 255, 0.6); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.6)' : 'rgba(255, 255, 255, 0.6)'}; `; export const FileName = styled.span` - color: rgba(255, 255, 255, 0.8); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; flex: 1; `; export const Tests = styled.div` font-weight: 400; - color: rgba(255, 255, 255, 0.7); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.7)' : 'rgba(255, 255, 255, 0.7)'}; overflow-x: auto; &::-webkit-scrollbar { @@ -113,7 +111,10 @@ export const Container = styled.div<{ selected: boolean }>` border-left: 2px solid transparent; &:hover { - background-color: rgba(0, 0, 0, 0.2); + background-color: ${props => + !props.theme.light ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)'}; + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 1)' : 'rgba(255, 255, 255, 1)'}; border-left-color: ${props => props.theme.secondary.clearer(0.5)}; ${Actions} { @@ -122,11 +123,11 @@ export const Container = styled.div<{ selected: boolean }>` ${Test} { ${TestName} { - background-color: rgba(0, 0, 0, 0.05); } ${Block} { - color: rgba(255, 255, 255, 0.8); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 1)' : 'rgba(255, 255, 255, 1)'}; } } } @@ -135,21 +136,33 @@ export const Container = styled.div<{ selected: boolean }>` props.selected && css` border-left-color: ${props.theme.secondary}; - background-color: rgba(0, 0, 0, 0.3); + background-color: ${props => + !props.theme.light ? 'rgba(0, 0, 0, 0.2)' : 'rgba(255, 255, 255, 0.2)'}; + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 1)' : 'rgba(255, 255, 255, 1)'}; ${Test} { ${TestName} { - background-color: rgba(0, 0, 0, 0.05); + background-color: ${props => + !props.theme.light + ? 'rgba(0, 0, 0, 0.2)' + : 'rgba(255, 255, 255, 0.2)'}; + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 1)' : 'rgba(255, 255, 255, 1)'}; } ${Block} { - color: rgba(255, 255, 255, 0.8); + background-color: ${props => + !props.theme.light + ? 'rgba(0, 0, 0, 0.2)' + : 'rgba(255, 255, 255, 0.2)'}; + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 1)' : 'rgba(255, 255, 255, 1)'}; } } &:hover { border-left-color: ${props.theme.secondary}; - background-color: rgba(0, 0, 0, 0.3); } `}; `; diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestOverview/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestOverview/elements.ts index 6ae8b809872..f373939a643 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestOverview/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestOverview/elements.ts @@ -3,6 +3,7 @@ import styled from 'styled-components'; export const Container = styled.div` position: relative; height: 100%; + border-top: 2px solid ${props => props.theme['panel.border']} `; export const Item = styled.div` @@ -16,7 +17,8 @@ export const Item = styled.div` export const ItemTitle = styled.div` font-size: 1rem; font-weight: 500; - color: rgba(255, 255, 255, 0.5); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'}; `; export const TestStatus = styled.div` diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestProgressBar/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestProgressBar/elements.ts index 9258bf88961..3b469622206 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestProgressBar/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestProgressBar/elements.ts @@ -11,12 +11,10 @@ export const ProgressBar = styled.div` `; const BaseBar = styled.div<{ count: number }>` - transition: 0.3s ease all; border-radius: 1px; height: 3px; flex: ${props => props.count}; margin: 0 ${props => (props.count !== 0 ? 3 : 0)}px; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); `; export const SuccessBar = styled(BaseBar)` @@ -28,5 +26,6 @@ export const FailedBar = styled(BaseBar)` `; export const IdleBar = styled(BaseBar)` - background-color: rgba(255, 255, 255, 0.5); + background-color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'}; `; diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/elements.ts index 338de439669..ec491b54064 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/elements.ts @@ -1,5 +1,6 @@ -import styled from 'styled-components'; +import styled, { css } from 'styled-components'; +import SyncIcon from 'react-icons/lib/go/sync'; export const Container = styled.div` display: flex; @@ -10,7 +11,8 @@ export const Title = styled.div` align-items: center; font-weight: 600; font-size: 1rem; - color: rgba(255, 255, 255, 0.4); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.4)' : 'rgba(255, 255, 255, 0.4)'}; width: 100%; `; @@ -18,11 +20,11 @@ export const Progress = styled.div` display: flex; width: 100%; height: 2px; - background-color: rgba(0, 0, 0, 0.3); + background-color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.3)' : 'rgba(255, 255, 255, 0.3)'}; `; const Bar = styled.div<{ count: number }>` - transition: 0.3s ease all; flex: ${props => props.count}; width: 100%; height: 100%; @@ -37,7 +39,9 @@ export const FailBar = styled(Bar)` `; export const IdleBar = styled(Bar)` - background-color: rgba(255, 255, 255, 0.5); + background-color: ${props => + !props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'}; + opacity: 0.6; `; export const TestData = styled.div` @@ -45,6 +49,14 @@ export const TestData = styled.div` font-size: 0.875rem; `; +export const SyncIconStyled = styled(SyncIcon) <{ watching: boolean }>` + opacity: 0.7; + color: ${props => props.theme['button.hoverBackground']}; + ${props => props.watching && css` + opacity: 1; + `} +` + export const Actions = styled.div` display: flex; align-items: center; @@ -52,13 +64,15 @@ export const Actions = styled.div` font-size: 1.125rem; svg { - transition: 0.3s ease color; + transition: 0.3s ease opacity; cursor: pointer; + opacity: 0.8; + color: ${props => props.theme['button.hoverBackground']}; margin-left: 0.5rem; &:hover { - color: white; + opacity: 1; } } `; diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/index.tsx b/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/index.tsx index 5c1e9bd1c0f..bde48de5cab 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/index.tsx +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestSummary/index.tsx @@ -1,8 +1,6 @@ // @flow import * as React from 'react'; import PlayIcon from 'react-icons/lib/go/playback-play'; -import SyncIcon from 'react-icons/lib/go/sync'; - import Tooltip from '@codesandbox/common/lib/components/Tooltip'; import { File, Test, Status } from '../'; @@ -16,6 +14,7 @@ import { TestData, IdleBar, Actions, + SyncIconStyled, } from './elements'; import TestSummaryText from '../TestSummaryText'; @@ -69,10 +68,7 @@ export default ({ {totalTestCount !== 0 && `${totalDuration}ms`}
- + diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/TestSummaryText/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/TestSummaryText/elements.ts index fdc134c1a48..b81f75d2d20 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/TestSummaryText/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/TestSummaryText/elements.ts @@ -27,7 +27,8 @@ export const FailedTests = styled.div` export const TotalTests = styled.div` ${baseTestStyles}; - color: rgba(255, 255, 255, 0.5); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)'}; `; export const RightSide = styled.div` diff --git a/packages/app/src/app/components/Preview/DevTools/Tests/elements.ts b/packages/app/src/app/components/Preview/DevTools/Tests/elements.ts index 96ad4f7a5ad..e81206dd490 100644 --- a/packages/app/src/app/components/Preview/DevTools/Tests/elements.ts +++ b/packages/app/src/app/components/Preview/DevTools/Tests/elements.ts @@ -10,8 +10,9 @@ export const Container = styled.div` width: 100%; height: 100%; - background-color: ${props => props.theme.background4}; - color: rgba(255, 255, 255, 0.8); + background-color: ${props => props.theme['sideBar.background']}; + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.8)' : 'rgba(255, 255, 255, 0.8)'}; `; export const Navigation = styled.div` @@ -23,13 +24,13 @@ export const Navigation = styled.div` `; export const TestContainer = styled(Navigation)` - background-color: ${props => props.theme.background2}; + background-color: ${props => props.theme['sideBar.background']}; height: 100%; `; export const TestDetails = styled.div` flex: 3; - background-color: ${props => props.theme.background}; + background-color: ${props => props.theme['sideBar.background']}; height: 100%; `; @@ -56,7 +57,8 @@ export const Fail = styled(Cross)` export const Dot = styled(DotIcon)` ${iconStyles}; - color: rgba(255, 255, 255, 0.3); + color: ${props => + props.theme.light ? 'rgba(0, 0, 0, 0.3)' : 'rgba(255, 255, 255, 0.3)'}; `; export const StatusElements = { diff --git a/packages/app/src/sandbox/eval/tests/jest-lite.ts b/packages/app/src/sandbox/eval/tests/jest-lite.ts index 843531cceb8..8b85f3b750d 100644 --- a/packages/app/src/sandbox/eval/tests/jest-lite.ts +++ b/packages/app/src/sandbox/eval/tests/jest-lite.ts @@ -423,4 +423,4 @@ export default class TestRunner { // We stub this, because old versions of CodeSandbox still needs this reportError = () => {}; -} +} \ No newline at end of file