mattermost-mobile/app/components/markdown/markdown_list_item.js
Jesse Hallam 58b72302d6 update eslint's comma-dangle rule to always-multiline (#1457)
* update eslint's `comma-dangle` rule to `always-multiline`

* add check and fix scripts to package.json

* Invoke `yarn fix` to adopt the updated eslint rules. No other changes are included.
2018-02-23 09:06:02 -05:00

61 lines
1.6 KiB
JavaScript

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
StyleSheet,
Text,
View,
} from 'react-native';
import CustomPropTypes from 'app/constants/custom_prop_types';
export default class MarkdownListItem extends PureComponent {
static propTypes = {
children: CustomPropTypes.Children.isRequired,
ordered: PropTypes.bool.isRequired,
continue: PropTypes.bool,
index: PropTypes.number.isRequired,
bulletWidth: PropTypes.number,
bulletStyle: CustomPropTypes.Style,
level: PropTypes.number,
};
render() {
let bullet;
if (this.props.continue) {
bullet = '';
} else if (this.props.ordered) {
bullet = this.props.index + '.';
} else if (this.props.level % 2 === 0) {
bullet = '◦';
} else {
bullet = '•';
}
return (
<View style={style.container}>
<View style={[{width: this.props.bulletWidth}, style.bullet]}>
<Text style={this.props.bulletStyle}>
{bullet}
</Text>
</View>
<View>
{this.props.children}
</View>
</View>
);
}
}
const style = StyleSheet.create({
bullet: {
alignItems: 'flex-end',
marginRight: 5,
},
container: {
flexDirection: 'row',
alignItems: 'flex-start',
},
});