Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffibm committed Nov 24, 2023
1 parent 74be2d3 commit 62b1b40
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/javascript/components/miq-structured-list/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const InputTypes = {
COMPONENT: 'component',
DROPDOWN: 'dropdown',
CODEMIRROR: 'code_mirror',
MARKDOWN: 'markdown',
};

export const DynamicReactComponents = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Checkbox, TextArea, Dropdown } from 'carbon-components-react';
import { Controlled as CodeMirror } from 'react-codemirror2';
import ReactMarkdown from 'react-markdown';
import { DynamicReactComponents, InputTypes } from '../../helpers';

/** Component to render textarea / checkbox / react components */
Expand Down Expand Up @@ -50,6 +51,15 @@ const MiqStructuredListInputs = ({ value, action }) => {
value={payload}
/>
);
/** Function to render the MarkDown component.
* eg: Service / Catalogs / Catalog Items / [Item] / Details tab.
*/
const renderMarkdown = ({ props: { content } }) => (
<ReactMarkdown className="miq-react-markdown">
{content}
</ReactMarkdown>
);

switch (value.input) {
case InputTypes.TEXTAREA:
return renderTextArea(value);
Expand All @@ -61,6 +71,8 @@ const MiqStructuredListInputs = ({ value, action }) => {
return renderDropDownComponent(value);
case InputTypes.CODEMIRROR:
return renderCodeMirrorComponent(value);
case InputTypes.MARKDOWN:
return renderMarkdown(value);
default:
return null;
}
Expand Down

0 comments on commit 62b1b40

Please sign in to comment.