Fix dark mode support for Changelog

Summary:
Fix changelog display in dark mode, as reported in https://github.com/facebook/flipper/issues/2379#issuecomment-851059786

Changelog: Fix dark mode support in changelog dialog.

Reviewed By: timur-valiev

Differential Revision: D29801181

fbshipit-source-id: ffbbd012c99dee897c4fd67653b4f6375294d668
This commit is contained in:
Michel Weststrate
2021-07-21 01:41:26 -07:00
committed by Facebook GitHub Bot
parent 9cb90cd749
commit 3f7e3c0441

View File

@@ -7,12 +7,14 @@
* @format * @format
*/ */
import {FlexColumn, styled, Text, FlexRow, Button, Markdown} from '../ui'; import {Markdown} from '../ui';
import {readFileSync} from 'fs'; import {readFileSync} from 'fs';
import React, {Component} from 'react'; import React, {Component} from 'react';
import path from 'path'; import path from 'path';
import {reportUsage} from '../utils/metrics'; import {reportUsage} from '../utils/metrics';
import {getChangelogPath} from '../utils/pathUtils'; import {getChangelogPath} from '../utils/pathUtils';
import {Modal} from 'antd';
import {theme} from 'flipper-plugin';
const changelogKey = 'FlipperChangelogStatus'; const changelogKey = 'FlipperChangelogStatus';
@@ -30,24 +32,12 @@ let getChangelogFromDisk = (): string => {
return changelogFromDisk; return changelogFromDisk;
}; };
const Container = styled(FlexColumn)({
padding: 20,
width: 600,
});
const Title = styled(Text)({
marginBottom: 18,
marginRight: 10,
fontWeight: 100,
fontSize: '40px',
});
const changelogSectionStyle = { const changelogSectionStyle = {
padding: 10, padding: 10,
maxHeight: '60vh', maxHeight: '60vh',
overflow: 'scroll', overflow: 'scroll',
marginBottom: 10, marginBottom: 10,
background: 'white', background: theme.backgroundDefault,
borderRadius: 4, borderRadius: 4,
width: '100%', width: '100%',
}; };
@@ -76,27 +66,20 @@ export default class ChangelogSheet extends Component<Props, {}> {
render() { render() {
return ( return (
<Container> <Modal
<Title>Changelog</Title> visible
<FlexRow> title="Changelog"
onCancel={this.props.onHide}
footer={null}>
<Markdown <Markdown
source={ source={
this.props.recent this.props.recent
? getRecentChangelog( ? getRecentChangelog(window.localStorage, getChangelogFromDisk())
window.localStorage,
getChangelogFromDisk(),
)
: getChangelogFromDisk() : getChangelogFromDisk()
} }
style={changelogSectionStyle} style={changelogSectionStyle}
/> />
</FlexRow> </Modal>
<FlexRow>
<Button type="primary" compact padded onClick={this.props.onHide}>
Close
</Button>
</FlexRow>
</Container>
); );
} }
} }