From 22b71797ce85aae58152991d5f8b22a212769218 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 19 Jun 2017 18:51:14 -0400 Subject: [PATCH] RN-109 Added ability to add styles to adjacent paragraphs (#654) * RN-109 Added ability to add styles to adjacent paragraphs * Updated yarn.lock --- app/components/markdown/index.js | 9 +++++++-- app/utils/markdown.js | 3 +++ package.json | 2 +- yarn.lock | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/components/markdown/index.js b/app/components/markdown/index.js index 954a62bff..9890a413d 100644 --- a/app/components/markdown/index.js +++ b/app/components/markdown/index.js @@ -167,9 +167,14 @@ export default class Markdown extends React.PureComponent { ); } - renderParagraph = ({children}) => { + renderParagraph = ({children, first}) => { + const blockStyle = [style.block]; + if (!first) { + blockStyle.push(this.props.blockStyles.adjacentParagraph); + } + return ( - + {children} diff --git a/app/utils/markdown.js b/app/utils/markdown.js index 7fcb88452..8d425e824 100644 --- a/app/utils/markdown.js +++ b/app/utils/markdown.js @@ -71,6 +71,9 @@ export const getMarkdownTextStyles = makeStyleSheetFromTheme((theme) => { export const getMarkdownBlockStyles = makeStyleSheetFromTheme((theme) => { return StyleSheet.create({ + adjacentParagraph: { + marginTop: 6 + }, codeBlock: { backgroundColor: changeOpacity(theme.centerChannelColor, 0.1), borderRadius: 4, diff --git a/package.json b/package.json index 9eb9b5d1e..699a77614 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "dependencies": { "babel-polyfill": "6.23.0", "commonmark": "hmhealey/commonmark.js#10bc18c0c8054088c0ec4737a8766c6b5794a323", - "commonmark-react-renderer": "hmhealey/commonmark-react-renderer#7be9f10cdb3408a64366a20e60975edff0b5c710", + "commonmark-react-renderer": "hmhealey/commonmark-react-renderer#11bf3a089900eda6f3e951f8b8c80663cff4d6a3", "deep-equal": "1.0.1", "intl": "1.2.5", "mattermost-redux": "mattermost/mattermost-redux#master", diff --git a/yarn.lock b/yarn.lock index d9ef40ed7..bb478bf6d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1512,9 +1512,9 @@ commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" -commonmark-react-renderer@hmhealey/commonmark-react-renderer#7be9f10cdb3408a64366a20e60975edff0b5c710: +commonmark-react-renderer@hmhealey/commonmark-react-renderer#11bf3a089900eda6f3e951f8b8c80663cff4d6a3: version "4.3.2" - resolved "https://codeload.github.com/hmhealey/commonmark-react-renderer/tar.gz/7be9f10cdb3408a64366a20e60975edff0b5c710" + resolved "https://codeload.github.com/hmhealey/commonmark-react-renderer/tar.gz/11bf3a089900eda6f3e951f8b8c80663cff4d6a3" dependencies: in-publish "^2.0.0" lodash.assign "^4.2.0"