mattermost-mobile/app/utils/markdown.js
Harrison Healey 22b71797ce RN-109 Added ability to add styles to adjacent paragraphs (#654)
* RN-109 Added ability to add styles to adjacent paragraphs

* Updated yarn.lock
2017-06-19 18:51:14 -04:00

99 lines
2.5 KiB
JavaScript

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {Platform, StyleSheet} from 'react-native';
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
export const getMarkdownTextStyles = makeStyleSheetFromTheme((theme) => {
const codeFont = Platform.OS === 'ios' ? 'Courier New' : 'monospace';
return StyleSheet.create({
emph: {
fontStyle: 'italic'
},
strong: {
fontWeight: 'bold'
},
link: {
color: theme.linkColor
},
heading1: {
fontSize: 17,
fontWeight: '700',
marginTop: 10,
marginBottom: 10
},
heading2: {
fontSize: 17,
fontWeight: '700',
marginTop: 10,
marginBottom: 10
},
heading3: {
fontSize: 17,
fontWeight: '700',
marginTop: 10,
marginBottom: 10
},
heading4: {
fontSize: 17,
fontWeight: '700',
marginTop: 10,
marginBottom: 10
},
heading5: {
fontSize: 17,
fontWeight: '700',
marginTop: 10,
marginBottom: 10
},
heading6: {
fontSize: 17,
fontWeight: '700',
marginTop: 10,
marginBottom: 10
},
code: {
alignSelf: 'center',
backgroundColor: changeOpacity(theme.centerChannelColor, 0.1),
fontFamily: codeFont,
paddingHorizontal: 4,
paddingVertical: 2
},
codeBlock: {
fontFamily: codeFont
},
mention: {
color: theme.linkColor
}
});
});
export const getMarkdownBlockStyles = makeStyleSheetFromTheme((theme) => {
return StyleSheet.create({
adjacentParagraph: {
marginTop: 6
},
codeBlock: {
backgroundColor: changeOpacity(theme.centerChannelColor, 0.1),
borderRadius: 4,
paddingHorizontal: 4,
paddingVertical: 2
},
horizontalRule: {
backgroundColor: theme.centerChannelColor,
height: StyleSheet.hairlineWidth,
flex: 1,
marginVertical: 10
},
quoteBlockIcon: {
color: changeOpacity(theme.centerChannelColor, 0.5),
padding: 5
}
});
});
export default {
getMarkdownBlockStyles,
getMarkdownTextStyles
};