From ad8b4343d398546fbccd5ee49d8b094bfe1b9e99 Mon Sep 17 00:00:00 2001 From: Maciej Ziarkowski Date: Mon, 11 Oct 2021 11:49:04 +0200 Subject: [PATCH] Add markdown support, add bold to community title --- app/package-lock.json | 5 +++++ app/package.json | 1 + app/src/frontend/building/data-components/data-title.tsx | 5 ++++- app/src/frontend/components/tooltip.tsx | 5 ++++- app/src/frontend/config/data-fields-config.ts | 2 +- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/package-lock.json b/app/package-lock.json index 5bac4f93..b73576de 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -11148,6 +11148,11 @@ "resolved": "https://registry.npmjs.org/mapnik-vector-tile/-/mapnik-vector-tile-3.0.1.tgz", "integrity": "sha512-w3/mKA8RUODR4qeVUyU8MhSqeuHqCLhCPdekqb+FBo+SRPXgxYOvffQBcu8mhEu6EK1n1Syrq26FcNcLfkYLEw==" }, + "markdown-to-jsx": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.1.3.tgz", + "integrity": "sha512-jtQ6VyT7rMT5tPV0g2EJakEnXLiPksnvlYtwQsVVZ611JsWGN8bQ1tVSDX4s6JllfEH6wmsYxNjTUAMrPmNA8w==" + }, "mdn-data": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz", diff --git a/app/package.json b/app/package.json index b971faf8..baf731da 100644 --- a/app/package.json +++ b/app/package.json @@ -30,6 +30,7 @@ "leaflet": "^1.7.1", "lodash": "^4.17.21", "mapnik": "^4.5.8", + "markdown-to-jsx": "^7.1.3", "node-fs": "^0.1.7", "nodemailer": "^6.4.11", "pg-format": "^1.0.4", diff --git a/app/src/frontend/building/data-components/data-title.tsx b/app/src/frontend/building/data-components/data-title.tsx index 5677fd9b..8356f844 100644 --- a/app/src/frontend/building/data-components/data-title.tsx +++ b/app/src/frontend/building/data-components/data-title.tsx @@ -1,3 +1,4 @@ +import Markdown from 'markdown-to-jsx'; import React from 'react'; import Tooltip from '../../components/tooltip'; @@ -34,7 +35,9 @@ const DataTitleCopyable: React.FunctionComponent = (prop
diff --git a/app/src/frontend/components/tooltip.tsx b/app/src/frontend/components/tooltip.tsx index 5ab49bb3..a3512a20 100644 --- a/app/src/frontend/components/tooltip.tsx +++ b/app/src/frontend/components/tooltip.tsx @@ -3,6 +3,7 @@ import React, { Component } from 'react'; import './tooltip.css'; import { InfoIcon } from './icons'; +import Markdown from 'markdown-to-jsx'; interface TooltipProps { text: string; @@ -79,7 +80,9 @@ class Tooltip extends Component {
- {tooltipTextToComponents(this.props.text)} + + {this.props.text} +
) diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index 42765365..8145b683 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -85,7 +85,7 @@ export const buildingUserFields = { community_type_worth_keeping: { perUser: true, category: Category.Community, - title: "Do you think this type of building is generally worth keeping?", + title: "Do you think this **type** of building is generally worth keeping?", example: true, }, community_type_worth_keeping_reasons: {