Skip to content

Feature/adding query md experimental support #923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,574 changes: 1,511 additions & 63 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@
"react-icons": "^5.1.0",
"react-intersection-observer": "^9.8.1",
"react-json-view-lite": "^1.4.0",
"react-markdown": "^10.1.0",
"react-virtuoso": "^4.10.4",
"react-visjs-timeline": "^1.6.0",
"remark-gfm": "^4.0.1",
"server-only": "^0.0.1",
"styletron-engine-monolithic": "^1.0.0",
"styletron-react": "^6.1.1",
Expand Down
217 changes: 217 additions & 0 deletions src/components/markdown/markdown.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
import { styled as createStyled } from 'baseui';

export const styled = {
ViewContainer: createStyled('div', ({ $theme }) => ({
display: 'flex',
flexDirection: 'column',
wordBreak: 'break-word',
overflow: 'hidden',
lineHeight: $theme.typography.ParagraphMedium.lineHeight,

// Headings
'& h1': {
...$theme.typography.HeadingXXLarge,
marginTop: $theme.sizing.scale800,
marginBottom: $theme.sizing.scale600,
borderBottom: `1px solid ${$theme.colors.backgroundTertiary}`,
paddingBottom: $theme.sizing.scale300,
},
'& h2': {
...$theme.typography.HeadingXLarge,
marginTop: $theme.sizing.scale700,
marginBottom: $theme.sizing.scale500,
borderBottom: `1px solid ${$theme.colors.backgroundTertiary}`,
paddingBottom: $theme.sizing.scale200,
},
'& h3': {
...$theme.typography.HeadingLarge,
marginTop: $theme.sizing.scale600,
marginBottom: $theme.sizing.scale400,
},
'& h4': {
...$theme.typography.HeadingMedium,
marginTop: $theme.sizing.scale500,
marginBottom: $theme.sizing.scale300,
},
'& h5': {
...$theme.typography.HeadingSmall,
marginTop: $theme.sizing.scale400,
marginBottom: $theme.sizing.scale300,
},
'& h6': {
...$theme.typography.HeadingXSmall,
marginTop: $theme.sizing.scale400,
marginBottom: $theme.sizing.scale300,
},

// Paragraphs
'& p': {
...$theme.typography.ParagraphMedium,
marginBottom: $theme.sizing.scale500,
marginTop: $theme.sizing.scale300,
'&:first-child': {
marginTop: 0,
},
'&:last-child': {
marginBottom: 0,
},
},

// Lists
'& ul, & ol': {
marginBottom: $theme.sizing.scale500,
marginTop: $theme.sizing.scale300,
paddingLeft: $theme.sizing.scale700,
'&:first-child': {
marginTop: 0,
},
'&:last-child': {
marginBottom: 0,
},
},
'& ul': {
listStyleType: 'disc',
},
'& ol': {
listStyleType: 'decimal',
},
'& li': {
...$theme.typography.ParagraphMedium,
marginBottom: $theme.sizing.scale200,
'&:last-child': {
marginBottom: 0,
},
'& > p': {
marginTop: 0,
marginBottom: $theme.sizing.scale200,
'&:last-child': {
marginBottom: 0,
},
},
},
'& ul ul, & ol ol, & ul ol, & ol ul': {
marginTop: $theme.sizing.scale200,
marginBottom: $theme.sizing.scale200,
},

// Links
'& a': {
color: $theme.colors.linkText,
textDecoration: 'underline',
':hover': {
color: $theme.colors.linkHover,
textDecoration: 'none',
},
':visited': {
color: $theme.colors.linkVisited,
},
},

// Emphasis
'& strong': {
fontWeight: 'bold',
},
'& em': {
fontStyle: 'italic',
},

// Code
'& code': {
...$theme.typography.MonoLabelSmall,
backgroundColor: $theme.colors.backgroundTertiary,
padding: `${$theme.sizing.scale100} ${$theme.sizing.scale200}`,
borderRadius: $theme.borders.radius200,
border: `1px solid ${$theme.colors.backgroundTertiary}`,
fontSize: '0.875em',
},
'& pre': {
marginBottom: $theme.sizing.scale600,
marginTop: $theme.sizing.scale600,
backgroundColor: $theme.colors.backgroundTertiary,
padding: $theme.sizing.scale500,
borderRadius: $theme.borders.radius300,
border: `1px solid ${$theme.colors.backgroundTertiary}`,
overflow: 'auto',
'& code': {
...$theme.typography.MonoLabelMedium,
backgroundColor: 'transparent',
padding: 0,
border: 'none',
fontSize: 'inherit',
},
},

// Blockquotes
'& blockquote': {
margin: `${$theme.sizing.scale600} 0`,
padding: `${$theme.sizing.scale400} ${$theme.sizing.scale600}`,
borderLeft: `4px solid ${$theme.colors.borderAccent}`,
backgroundColor: $theme.colors.backgroundAccentLight,
borderRadius: $theme.borders.radius200,
'& > p': {
marginTop: 0,
marginBottom: $theme.sizing.scale300,
'&:last-child': {
marginBottom: 0,
},
},
'& > p:first-child': {
fontStyle: 'italic',
color: $theme.colors.contentSecondary,
},
},

// Horizontal Rules
'& hr': {
border: 'none',
borderTop: `2px solid ${$theme.colors.backgroundTertiary}`,
margin: `${$theme.sizing.scale700} 0`,
width: '100%',
},

// Images
'& img': {
maxWidth: '100%',
height: 'auto',
marginTop: $theme.sizing.scale400,
marginBottom: $theme.sizing.scale400,
borderRadius: $theme.borders.radius200,
border: `1px solid ${$theme.colors.backgroundTertiary}`,
},

// Tables
'& table': {
width: '100%',
borderCollapse: 'collapse',
marginTop: $theme.sizing.scale600,
marginBottom: $theme.sizing.scale600,
borderRadius: $theme.borders.radius200,
overflow: 'auto',
},
'& th, & td': {
...$theme.typography.ParagraphSmall,
padding: $theme.sizing.scale400,
textAlign: 'left',
border: `1px solid ${$theme.colors.backgroundTertiary}`,
},
'& th': {
...$theme.typography.LabelMedium,
fontWeight: 'bold',
color: $theme.colors.contentPrimary,
},
// Task Lists (if supported)
'& input[type="checkbox"]': {
marginRight: $theme.sizing.scale300,
cursor: 'pointer',
},
'& li.task-list-item': {
listStyleType: 'none',
},

// Delete
'& del': {
textDecoration: 'line-through',
color: $theme.colors.contentTertiary,
},
})),
};
14 changes: 14 additions & 0 deletions src/components/markdown/markdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use client';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';

import { styled } from './markdown.styles';
import type { Props } from './markdown.types';

export default function Markdown({ markdown }: Props) {
return (
<styled.ViewContainer>
<ReactMarkdown remarkPlugins={[remarkGfm]}>{markdown}</ReactMarkdown>
</styled.ViewContainer>
);
}
3 changes: 3 additions & 0 deletions src/components/markdown/markdown.types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type Props = {
markdown: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jest.mock('../workflow-queries-tile/workflow-queries-tile', () =>
))
);

jest.mock('../workflow-queries-result-json/workflow-queries-result-json', () =>
jest.mock('../workflow-queries-result/workflow-queries-result', () =>
jest.fn(({ data }) => (
<div>
<div>Mock JSON</div>
Expand Down

This file was deleted.

This file was deleted.

Loading