Skip to content

Commit 81875c9

Browse files
committed
refactor: Simplify audio device selector and markdown components styling
1 parent c53a897 commit 81875c9

3 files changed

Lines changed: 34 additions & 54 deletions

File tree

apps/desktop/src/components/AudioDeviceSelector.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ export function AudioDeviceSelector({
3636
>
3737
{label}
3838
</label>
39-
<NativeSelectRoot>
39+
<NativeSelectRoot disabled={loading || disabled}>
4040
<NativeSelectField
4141
value={value}
4242
onChange={(e) => onChange(e.target.value)}
43-
disabled={loading || disabled}
4443
>
4544
{loading ? (
4645
<option>Loading devices...</option>

apps/desktop/src/components/MarkdownContent.tsx

Lines changed: 32 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -20,58 +20,39 @@ export function MarkdownContent({ content }: MarkdownContentProps) {
2020
<ReactMarkdown
2121
components={{
2222
// Style for paragraphs
23-
p: ({ children, node }) => {
24-
// Paragraphs inside list items should have no margin
25-
// ReactMarkdown wraps list item text in <p> tags
26-
const parent = node?.parent;
27-
const isInListItem = parent?.type === 'listItem';
28-
29-
return (
30-
<p style={{
31-
margin: isInListItem ? '0' : '0 0 6px 0',
32-
lineHeight: '1.5',
33-
whiteSpace: 'pre-wrap',
34-
wordWrap: 'break-word'
35-
}}>
36-
{children}
37-
</p>
38-
);
39-
},
23+
p: ({ children }) => (
24+
<p style={{
25+
margin: '0 0 6px 0',
26+
lineHeight: '1.5',
27+
whiteSpace: 'pre-wrap',
28+
wordWrap: 'break-word'
29+
}}>
30+
{children}
31+
</p>
32+
),
4033
// Style for lists
41-
ul: ({ children, node }) => {
42-
// Check if this list is nested inside another list
43-
const parent = node?.parent;
44-
const isNested = parent?.type === 'listItem';
45-
46-
return (
47-
<ul style={{
48-
margin: isNested ? '0' : '0 0 6px 0',
49-
paddingLeft: '28px',
50-
lineHeight: '1.5',
51-
listStyleType: 'disc',
52-
listStylePosition: 'outside'
53-
}}>
54-
{children}
55-
</ul>
56-
);
57-
},
58-
ol: ({ children, node }) => {
59-
// Check if this list is nested inside another list
60-
const parent = node?.parent;
61-
const isNested = parent?.type === 'listItem';
62-
63-
return (
64-
<ol style={{
65-
margin: isNested ? '0' : '0 0 6px 0',
66-
paddingLeft: '28px',
67-
lineHeight: '1.5',
68-
listStyleType: 'decimal',
69-
listStylePosition: 'outside'
70-
}}>
71-
{children}
72-
</ol>
73-
);
74-
},
34+
ul: ({ children }) => (
35+
<ul style={{
36+
margin: '0 0 6px 0',
37+
paddingLeft: '28px',
38+
lineHeight: '1.5',
39+
listStyleType: 'disc',
40+
listStylePosition: 'outside'
41+
}}>
42+
{children}
43+
</ul>
44+
),
45+
ol: ({ children }) => (
46+
<ol style={{
47+
margin: '0 0 6px 0',
48+
paddingLeft: '28px',
49+
lineHeight: '1.5',
50+
listStyleType: 'decimal',
51+
listStylePosition: 'outside'
52+
}}>
53+
{children}
54+
</ol>
55+
),
7556
// Style for list items
7657
li: ({ children }) => (
7758
<li style={{

apps/desktop/src/components/MarkdownEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from 'react';
22
import { MarkdownContent } from './MarkdownContent';
3-
import { Button, HStack, Box, Tabs } from '@chakra-ui/react';
3+
import { Button, HStack, Box } from '@chakra-ui/react';
44

55
interface MarkdownEditorProps {
66
initialContent: string;

0 commit comments

Comments
 (0)