Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
89710482
Commit
89710482
authored
2 years ago
by
Shawna Monero
Browse files
Options
Download
Email Patches
Plain Diff
open source reactmarkdown thingy
parent
d15414c8
openSourceReactMarkdownPane
No related merge requests found
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
frontend/packages/core/jest.config.js
+4
-0
frontend/packages/core/jest.config.js
frontend/packages/core/package.json
+4
-0
frontend/packages/core/package.json
frontend/packages/core/src/MarkdownPane/index.tsx
+5
-0
frontend/packages/core/src/MarkdownPane/index.tsx
frontend/packages/core/src/MarkdownPane/markdown-pane.tsx
+41
-0
frontend/packages/core/src/MarkdownPane/markdown-pane.tsx
frontend/packages/core/src/MarkdownPane/tests/markdown-pane.test.tsx
+21
-0
...ckages/core/src/MarkdownPane/tests/markdown-pane.test.tsx
frontend/packages/core/src/index.tsx
+1
-0
frontend/packages/core/src/index.tsx
frontend/packages/core/src/stories/linearTimeline.stories.tsx
+0
-1
...tend/packages/core/src/stories/linearTimeline.stories.tsx
with
76 additions
and
1 deletion
+76
-1
frontend/packages/core/jest.config.js
+
4
-
0
View file @
89710482
...
...
@@ -8,4 +8,8 @@ module.exports = {
statements
:
"
47
"
,
},
},
moduleNameMapper
:
{
...
baseConfig
.
moduleNameMapper
,
"
react-markdown
"
:
"
<rootDir>/node_modules/react-markdown/react-markdown.min.js
"
,
}
};
This diff is collapsed.
Click to expand it.
frontend/packages/core/package.json
+
4
-
0
View file @
89710482
...
...
@@ -47,11 +47,15 @@
"react-dom"
:
"^17.0.2"
,
"react-hook-form"
:
"^7.25.3"
,
"react-is"
:
"^17.0.2"
,
"react-markdown"
:
"^8.0.3"
,
"remark-gfm"
:
"^3.0.1"
,
"react-router"
:
"^6.0.0-beta"
,
"react-router-dom"
:
"^6.0.0-beta"
,
"react-test-renderer"
:
"^17.0.2"
,
"recharts"
:
"^2.1.9"
,
"superstruct"
:
"~0.15.0"
,
"@testing-library/jest-dom"
:
"^5.16.4"
,
"@testing-library/react"
:
"^12.0.0"
,
"uuid"
:
"^8.3.2"
,
"yup"
:
"^0.32.8"
},
...
...
This diff is collapsed.
Click to expand it.
frontend/packages/core/src/MarkdownPane/index.tsx
0 → 100644
+
5
-
0
View file @
89710482
export
{
default
as
MarkdownPane
}
from
"
./markdown-pane
"
;
export
type
{
MarkdownPaneProps
}
from
"
./markdown-pane
"
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
frontend/packages/core/src/MarkdownPane/markdown-pane.tsx
0 → 100644
+
41
-
0
View file @
89710482
import
React
from
"
react
"
;
import
{
Button
}
from
"
../button
"
import
{
Typography
}
from
"
../typography
"
import
{
Divider
,
Paper
}
from
"
@material-ui/core
"
;
import
ReactMarkdown
from
"
react-markdown
"
;
import
remarkGfm
from
"
remark-gfm
"
;
export
interface
MarkdownPaneProps
{
/** the function that will be called when clicking the X button */
onClose
:
()
=>
void
;
/** The title that will be displayed at the top */
title
:
string
;
/** The actual markdown text content that will be displayed */
markdownText
:
string
;
/** whether or not to use gfm, defaults to true */
useGithubFlavor
?:
boolean
;
//** width of the content, defaults to 950px */
width
?:
string
}
// TODO(smonero): wrap this in a Mui Drawer
// TODO(smonero): give it a storybook with controls
// This is designed to be used within a Mui <Drawer>
const
MarkdownPane
=
({
onClose
,
title
,
markdownText
,
useGithubFlavor
=
true
,
width
=
"
950px
"
}:
MarkdownPaneProps
)
=>
{
return
(
<
span
style
=
{
{
width
:
width
}
}
>
<
Paper
>
<
span
style
=
{
{
display
:
"
flex
"
,
justifyContent
:
"
space-between
"
,
padding
:
"
32px 0px 32px 0px
"
}
}
>
<
Typography
variant
=
"h1"
>
{
title
}
</
Typography
>
<
Button
text
=
"x"
onClick
=
{
onClose
}
/>
</
span
>
<
Divider
/>
<
ReactMarkdown
remarkPlugins
=
{
useGithubFlavor
?
[
remarkGfm
]
:
[]
}
>
{
markdownText
}
</
ReactMarkdown
>
</
Paper
>
</
span
>
);
};
export
default
MarkdownPane
;
This diff is collapsed.
Click to expand it.
frontend/packages/core/src/MarkdownPane/tests/markdown-pane.test.tsx
0 → 100644
+
21
-
0
View file @
89710482
import
React
from
"
react
"
;
import
{
render
,
screen
}
from
"
@testing-library/react
"
;
import
"
@testing-library/jest-dom/extend-expect
"
;
import
"
@testing-library/jest-dom
"
;
import
MarkdownPane
from
"
../markdown-pane
"
;
const
mdContent
=
`
## A subtitle
- Meow meow meow
- a bulleted line of text
`
test
(
"
Renders a title and content
"
,
()
=>
{
const
wrapper
=
render
(<
MarkdownPane
onClose
=
{
()
=>
{}
}
title
=
{
"
The Title
"
}
markdownText
=
{
mdContent
}
/>)
// expect the dashes to be converted, so they won't be found
expect
(
screen
.
getByText
(
"
-
"
)).
toBeNull
();
expect
(
screen
.
getByText
(
"
The Title
"
)).
toBeInTheDocument
();
expect
(
screen
.
getByText
(
"
Meow meow meow
"
)).
toBeInTheDocument
();
})
This diff is collapsed.
Click to expand it.
frontend/packages/core/src/index.tsx
+
1
-
0
View file @
89710482
...
...
@@ -45,6 +45,7 @@ export * from "./NPS";
export
*
from
"
./chip
"
;
export
*
from
"
./Charts
"
;
export
*
from
"
./Assets/icons
"
;
export
*
from
"
./MarkdownPane
"
;
export
{
default
as
ClutchApp
}
from
"
./AppProvider
"
;
...
...
This diff is collapsed.
Click to expand it.
frontend/packages/core/src/stories/linearTimeline.stories.tsx
+
0
-
1
View file @
89710482
...
...
@@ -4,7 +4,6 @@ import type { Meta } from "@storybook/react";
import
LinearTimeline
from
"
../Charts/linearTimeline
"
;
import
type
{
LinearTimelineData
}
from
"
../Charts/types
"
;
export
default
{
title
:
"
Core/Charts/LinearTimeline
"
,
component
:
LinearTimeline
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help