Unverified Commit 276ff528 authored by Tamika Tannis's avatar Tamika Tannis Committed by GitHub

feat: Support markdown for dashboard descriptions (#506)

* Support markdown for dashboard descriptions

* Code cleanup

* Fix test for build to pass; Need to re-write so this doesn't keep happening

* Fix test for build to pass; Need to re-write so this doesn't keep happening
parent 98ed705d
......@@ -119,10 +119,6 @@ $aside-separation-space: 40px;
.editable-text {
font-size: 16px;
.markdown-wrapper {
font-size: 16px;
}
}
.avatar-label-component {
......@@ -130,6 +126,13 @@ $aside-separation-space: 40px;
color: $text-primary;
}
}
.markdown-wrapper {
font-size: 16px;
> p {
margin: 0;
}
}
}
> .right-panel {
......
import * as React from 'react';
import * as ReactMarkdown from 'react-markdown';
import * as History from 'history';
import { shallow } from 'enzyme';
......@@ -182,6 +183,14 @@ describe('DashboardPage', () => {
});
describe('renders description', () => {
it('using a ReactMarkdown component', () => {
const markdown = wrapper.find(ReactMarkdown);
expect(markdown.exists()).toBe(true);
expect(markdown.props()).toMatchObject({
source: props.dashboard.description,
});
});
it('with link to add description if none exists', () => {
const { wrapper } = setup({
dashboard: {
......
......@@ -5,6 +5,8 @@ import { Link } from 'react-router-dom';
import { RouteComponentProps } from 'react-router';
import * as qs from 'simple-query-string';
import * as ReactMarkdown from 'react-markdown';
import AvatarLabel from 'components/common/AvatarLabel';
import Breadcrumb from 'components/common/Breadcrumb';
import BookmarkIcon from 'components/common/Bookmark/BookmarkIcon';
......@@ -212,8 +214,8 @@ export class DashboardPage extends React.Component<
)}`}
>
{hasDescription && (
<div className="body-2 and text-primary">
{dashboard.description}
<div className="markdown-wrapper">
<ReactMarkdown source={dashboard.description} />
</div>
)}
{!hasDescription && (
......
......@@ -61,6 +61,7 @@ class MetadataTest(unittest.TestCase):
'schema': 'test_schema',
'name': 'test_table',
'description': 'This is a test',
'resource_reports': [],
'programmatic_descriptions': [
{'source': 'c_1', 'text': 'description c'},
{'source': 'a_1', 'text': 'description a'},
......@@ -136,6 +137,7 @@ class MetadataTest(unittest.TestCase):
'text': 'description c'
},
],
'resource_reports': [],
'table_writer': {
'application_url': 'https://test-test.test.test',
'name': 'test_name',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment