Skip to content
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
23 changes: 11 additions & 12 deletions ui/desktop/src/components/MarkdownContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import { oneLight } from 'react-syntax-highlighter/dist/cjs/styles/prism';
import { Check, Copy } from './icons';
import { visit } from 'unist-util-visit';

const UrlTransform = {
a: ({ node, ...props }) => <a {...props} target="_blank" rel="noopener noreferrer" />,
};

function rehypeinlineCodeProperty() {
return function (tree) {
if (!tree) return;
Expand Down Expand Up @@ -86,35 +82,38 @@ export default function MarkdownContent({ content, className = '' }: MarkdownCon
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeinlineCodeProperty, rehypeRaw]}
className={`prose prose-xs dark:prose-invert w-full max-w-full word-break
className={`prose prose-sm text-textStandard dark:prose-invert w-full max-w-full word-break
prose-pre:p-0 prose-pre:m-0 !p-0
prose-code:break-all prose-code:whitespace-pre-wrap
prose-table:table prose-table:w-full
prose-blockquote:text-inherit
prose-td:border prose-td:border-borderSubtle prose-td:p-2
prose-th:border prose-th:border-borderSubtle prose-th:p-2
prose-thead:bg-bgSubtle
prose-h1:text-2xl prose-h1:font-medium prose-h1:mb-5 prose-h1:mt-5
prose-h2:text-xl prose-h2:font-medium prose-h2:mb-4 prose-h2:mt-4
prose-h3:text-lg prose-h3:font-medium prose-h3:mb-3 prose-h3:mt-3
prose-p:mt-0 prose-p:mb-2
prose-ol:my-2
prose-ul:mt-0 prose-ul:mb-3
prose-li:m-0

${className}`}
components={{
...UrlTransform,
a: ({ node, ...props }) => <a {...props} target="_blank" rel="noopener noreferrer" />,
code({ node, className, children, inlinecode, ...props }) {
const match = /language-(\w+)/.exec(className || 'language-text');
return inlinecode == 'false' && match ? (
<CodeBlock language={match[1]}>{String(children).replace(/\n$/, '')}</CodeBlock>
) : (
<code
{...props}
className={`${className} break-all bg-inline-code dark:bg-inline-code-dark whitespace-pre-wrap`}
className={`break-all bg-inline-code dark:bg-inline-code-dark whitespace-pre-wrap`}
>
{children}
</code>
);
},
// h3: 'div',
h3(props) {
const { node, ...rest } = props;
return <div className="text-textStandard text-sm" {...rest} />;
},
}}
>
{content}
Expand Down
5 changes: 4 additions & 1 deletion ui/desktop/src/components/UserMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export default function UserMessage({ message }: UserMessageProps) {
<div className="flex flex-col group">
<div className="flex bg-slate text-white rounded-xl rounded-br-none py-2 px-3">
<div ref={contentRef}>
<MarkdownContent content={textContent} className="text-white prose-a:text-white" />
<MarkdownContent
content={textContent}
className="text-white prose-a:text-white user-message"
/>
</div>
</div>
<div className="flex justify-end">
Expand Down
47 changes: 25 additions & 22 deletions ui/desktop/src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@
/* Cash Sans */

@font-face {
font-family: Cash Sans;
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Regular.woff2)
format('woff2');
font-family: 'Cash Sans';
src:
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Regular.woff2)
format('woff2'),
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff/CashSans-Regular.woff)
format('woff');
font-weight: 400;
font-style: normal;
}

@font-face {
font-family: Cash Sans;
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Medium.woff2)
format('woff2');
font-family: 'Cash Sans';
src:
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Medium.woff2)
format('woff2'),
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff/CashSans-Medium.woff) format('woff');
font-weight: 500;
font-style: normal;
}

@font-face {
font-family: Cash Sans;
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Semibold.woff2)
format('woff2');
font-weight: 600;
font-style: normal;
}

@font-face {
font-family: Cash Sans;
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Bold.woff2)
format('woff2');
font-weight: 700;
font-family: 'Cash Sans Mono';
src:
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSansMono-Regular.woff2)
format('woff2'),
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff/CashSansMono-Regular.woff)
format('woff');
font-weight: 400;
font-style: normal;
}

Expand Down Expand Up @@ -245,6 +245,7 @@
word-wrap: break-word;
word-break: break-word;
}

.titlebar-drag-region {
-webkit-app-region: drag;
height: 32px;
Expand All @@ -261,8 +262,10 @@

.bg-inline-code {
border-radius: 4px;
color: rgba(255, 130, 130, 0.85);
font-family: 'Square Sans Mono';
color: rgb(255 119 43);
background-color: var(--background-app);
border: 1px solid var(--border-subtle);
font-family: 'Cash Sans Mono', monospace;
font-size: 12px;
font-style: normal;
font-weight: 400;
Expand All @@ -286,7 +289,7 @@
content: '';
}

.dark .bg-inline-code {
color: rgba(248, 155, 89, 0.7);
.user-message p {
margin-bottom: 0 !important;
}
}
8 changes: 8 additions & 0 deletions ui/desktop/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default {
extend: {
fontFamily: {
sans: ['Cash Sans', 'sans-serif'],
mono: ['Cash Sans Mono', 'monospace'],
},
keyframes: {
shimmer: {
Expand Down Expand Up @@ -73,6 +74,13 @@ export default {
blockTeal: 'var(--block-teal)',
blockOrange: 'var(--block-orange)',
},
typography: {
DEFAULT: {
css: {
color: 'var(--text-standard)',
},
},
},
},
},
};
Loading