Support dark mode

Summary: As reported in https://fb.workplace.com/groups/flippersupport/permalink/1171595499987773/, the SupportForm doesn't support dark mode. Fixed this by fixing theming in some of the underlying deprecated components.

Reviewed By: timur-valiev

Differential Revision: D29694034

fbshipit-source-id: f8b90ecc87f7f16f6e1f9751d22309d37a052d5a
This commit is contained in:
Michel Weststrate
2021-07-15 01:51:58 -07:00
committed by Facebook GitHub Bot
parent ac24bbed3e
commit 7b2afda844
5 changed files with 43 additions and 50 deletions

View File

@@ -16,12 +16,12 @@ import {
Spacer, Spacer,
Checkbox, Checkbox,
Radio, Radio,
colors,
View, View,
Tooltip, Tooltip,
Glyph, Glyph,
} from '../ui'; } from '../ui';
import React, {Component} from 'react'; import React, {Component} from 'react';
import {theme} from 'flipper-plugin';
export type SelectionType = 'multiple' | 'single'; export type SelectionType = 'multiple' | 'single';
@@ -62,7 +62,7 @@ const Container = styled(FlexColumn)({
}); });
const Line = styled(View)({ const Line = styled(View)({
backgroundColor: colors.greyTint2, backgroundColor: theme.dividerColor,
height: 1, height: 1,
width: 'auto', width: 'auto',
flexShrink: 0, flexShrink: 0,
@@ -71,7 +71,7 @@ const Line = styled(View)({
const RowComponentContainer = styled(FlexColumn)({ const RowComponentContainer = styled(FlexColumn)({
overflow: 'scroll', overflow: 'scroll',
height: 'auto', height: 'auto',
backgroundColor: colors.white, backgroundColor: theme.backgroundDefault,
maxHeight: 500, maxHeight: 500,
}); });
@@ -121,12 +121,14 @@ class RowComponent extends Component<RowComponentProps> {
paddingBottom={8} paddingBottom={8}
paddingLeft={leftPadding || 0}> paddingLeft={leftPadding || 0}>
<FlexRow style={{alignItems: 'center'}}> <FlexRow style={{alignItems: 'center'}}>
<Text color={disabled ? colors.light20 : undefined}>{label}</Text> <Text color={disabled ? theme.disabledColor : undefined}>
{label}
</Text>
<Spacer /> <Spacer />
{disabled && ( {disabled && (
<Glyph <Glyph
name="caution-triangle" name="caution-triangle"
color={colors.light20} color={theme.dividerColor}
size={12} size={12}
variant="filled" variant="filled"
style={{marginRight: 5}} style={{marginRight: 5}}

View File

@@ -8,24 +8,7 @@
*/ */
import React from 'react'; import React from 'react';
import styled from '@emotion/styled'; import {Layout, theme} from 'flipper-plugin';
import {colors} from './colors';
import FlexColumn from './FlexColumn';
const Container = styled(FlexColumn)({
height: '100%',
overflow: 'auto',
backgroundColor: colors.light02,
});
Container.displayName = 'CenteredView:Container';
const ContentWrapper = styled.div({
width: 500,
marginLeft: 'auto',
marginRight: 'auto',
padding: '20px 0',
});
ContentWrapper.displayName = 'CenteredView:ContentWrapper';
/** /**
* CenteredView creates a scrollable container with fixed with, centered content. * CenteredView creates a scrollable container with fixed with, centered content.
@@ -33,9 +16,18 @@ ContentWrapper.displayName = 'CenteredView:ContentWrapper';
* @deprecated * @deprecated
*/ */
const CenteredView: React.FC<{}> = ({children}) => ( const CenteredView: React.FC<{}> = ({children}) => (
<Container grow> <Layout.ScrollContainer style={{background: theme.backgroundWash}}>
<ContentWrapper>{children}</ContentWrapper> <Layout.Container
</Container> center
padv={theme.space.huge}
width={500}
style={{
marginLeft: 'auto',
marginRight: 'auto',
}}>
{children}
</Layout.Container>
</Layout.ScrollContainer>
); );
export default CenteredView; export default CenteredView;

View File

@@ -10,8 +10,7 @@
import React, {CSSProperties, ReactNode} from 'react'; import React, {CSSProperties, ReactNode} from 'react';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import ReactMarkdown from 'react-markdown'; import ReactMarkdown from 'react-markdown';
import {colors} from './colors'; import {getFlipperLib, theme} from 'flipper-plugin';
import {getFlipperLib} from 'flipper-plugin';
const Container = styled.div({ const Container = styled.div({
padding: 10, padding: 10,
@@ -25,7 +24,7 @@ const Heading = styled.div({fontSize: 18, marginTop: 10, marginBottom: 10});
const SubHeading = styled.div({ const SubHeading = styled.div({
fontSize: 12, fontSize: 12,
textTransform: 'uppercase', textTransform: 'uppercase',
color: '#90949c', color: theme.textColorSecondary,
marginTop: 10, marginTop: 10,
marginBottom: 10, marginBottom: 10,
fontWeight: 'bold', fontWeight: 'bold',
@@ -37,23 +36,23 @@ const ListItem = styled.li({
}); });
const Strong = styled.span({ const Strong = styled.span({
fontWeight: 'bold', fontWeight: 'bold',
color: '#1d2129', color: theme.textColorPrimary,
}); });
const Emphasis = styled.span({ const Emphasis = styled.span({
fontStyle: 'italic', fontStyle: 'italic',
}); });
const Quote = styled(Row)({ const Quote = styled(Row)({
padding: 10, padding: 10,
backgroundColor: '#f1f2f3', backgroundColor: theme.backgroundWash,
fontSize: 13, fontSize: 13,
}); });
const Code = styled.span({ const Code = styled.span({
fontFamily: '"Courier New", Courier, monospace', fontFamily: '"Courier New", Courier, monospace',
backgroundColor: '#f1f2f3', backgroundColor: theme.backgroundWash,
}); });
const Pre = styled(Row)({ const Pre = styled(Row)({
padding: 10, padding: 10,
backgroundColor: '#f1f2f3', backgroundColor: theme.backgroundWash,
}); });
function CodeBlock(props: { function CodeBlock(props: {
children: ReactNode[]; children: ReactNode[];
@@ -69,7 +68,7 @@ function CodeBlock(props: {
); );
} }
const Link = styled.span({ const Link = styled.span({
color: colors.blue, color: theme.textColorActive,
}); });
function LinkReference(props: {href: string; children: Array<ReactNode>}) { function LinkReference(props: {href: string; children: Array<ReactNode>}) {
return ( return (

View File

@@ -8,20 +8,21 @@
*/ */
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import {colors} from './colors'; import {theme} from 'flipper-plugin';
export const multilineStyle = (props: {valid: boolean}) => ({ export const multilineStyle = (props: {valid: boolean}) => ({
border: `1px solid ${props.valid === false ? colors.red : colors.light15}`, border: `1px solid ${
props.valid === false ? theme.errorColor : theme.dividerColor
}`,
borderRadius: 4, borderRadius: 4,
font: 'inherit', font: 'inherit',
fontSize: '1em', fontSize: '1em',
height: '28px', height: '28px',
lineHeight: '28px', lineHeight: '28px',
marginRight: 5, marginRight: 5,
backgroundColor: theme.backgroundDefault,
'&:disabled': { '&:disabled': {
backgroundColor: '#ddd', backgroundColor: theme.backgroundWash,
borderColor: '#ccc',
cursor: 'not-allowed', cursor: 'not-allowed',
}, },
}); });

View File

@@ -9,24 +9,23 @@
import React from 'react'; import React from 'react';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import {colors} from './colors'; import {theme, Layout} from 'flipper-plugin';
import Heading from './Heading'; import {Typography} from 'antd';
import FlexColumn from './FlexColumn';
const Divider = styled.hr({ const Divider = styled.hr({
margin: '16px -20px 20px -20px', margin: '16px -20px 20px -20px',
border: 'none', border: 'none',
borderTop: `1px solid ${colors.light05}`, borderTop: `1px solid ${theme.dividerColor}`,
}); });
Divider.displayName = 'RoundedSection:Divider'; Divider.displayName = 'RoundedSection:Divider';
const Container = styled.div({ const Container = styled.div({
background: colors.white, background: theme.backgroundDefault,
borderRadius: 10, borderRadius: theme.space.medium,
boxShadow: '0 1px 3px rgba(0,0,0,0.25)', boxShadow: `0 1px 3px ${theme.dividerColor}`,
marginBottom: '20px', marginBottom: theme.space.large,
width: '100%', width: '100%',
padding: 20, padding: theme.space.large,
}); });
Container.displayName = 'RoundedSection:Container'; Container.displayName = 'RoundedSection:Container';
@@ -37,9 +36,9 @@ Container.displayName = 'RoundedSection:Container';
*/ */
const RoundedSection: React.FC<{title: string}> = ({title, children}) => ( const RoundedSection: React.FC<{title: string}> = ({title, children}) => (
<Container> <Container>
<Heading>{title}</Heading> <Typography.Title level={3}>{title}</Typography.Title>
<Divider /> <Divider />
<FlexColumn>{children}</FlexColumn> <Layout.Container>{children}</Layout.Container>
</Container> </Container>
); );