mattermost-mobile/app/components/markdown/markdown_table_cell/markdown_table_cell.js
Harrison Healey ede4d22f75 ICU-624 Added markdown tables (#1434)
* ICU-624 Added initial table rendering support

* ICU-624 Added full table view

* Added proper pluralization to +X more lines in code blocks

* ICU-624 Added support for images in tables

* Stopped using injectIntl for tables

* ICU-624 Updated commonmark-react-renderer

* ICU-624 Hid scroll indicator in collapsed table view

* Addressed feedback
2018-02-16 19:31:14 -03:00

46 lines
1.2 KiB
JavaScript

// Copyright (c) 2018-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import PropTypes from 'prop-types';
import React from 'react';
import {Text, View} from 'react-native';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
export default class MarkdownTableCell extends React.PureComponent {
static propTypes = {
children: PropTypes.node,
isHeading: PropTypes.bool.isRequired,
theme: PropTypes.object.isRequired
};
render() {
const style = getStyleSheet(this.props.theme);
const cellStyle = [style.cell];
if (this.props.isHeading) {
cellStyle.push(style.heading);
}
return (
<View style={cellStyle}>
<Text>
{this.props.children}
</Text>
</View>
);
}
}
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
cell: {
borderColor: changeOpacity(theme.centerChannelColor, 0.2),
borderRightWidth: 1,
flex: 1,
justifyContent: 'flex-start',
paddingHorizontal: 13,
paddingVertical: 6
}
};
});