Skip to content

Commit baf3331

Browse files
committed
improve active state UI for write and preview button. make padding consistent in textarea
1 parent e6b175b commit baf3331

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

ui/src/components/MarkdownEditor.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function MarkdownEditor({
102102
if (!textarea) return;
103103

104104
const { selectionStart, value: currentValue } = textarea;
105-
105+
106106
// Get the current line
107107
const beforeCursor = currentValue.substring(0, selectionStart);
108108
const lastNewline = beforeCursor.lastIndexOf("\n");
@@ -138,7 +138,7 @@ export function MarkdownEditor({
138138

139139
if (prefix) {
140140
e.preventDefault();
141-
141+
142142
if (isEmpty) {
143143
// If just the list marker, remove it and exit list
144144
const newValue = currentValue.substring(0, lastNewline + 1) + currentValue.substring(selectionStart);
@@ -197,11 +197,8 @@ export function MarkdownEditor({
197197
sx={{
198198
fontWeight: viewMode === "write" ? "semibold" : "normal",
199199
color: viewMode === "write" ? "fg.default" : "fg.muted",
200-
borderBottomWidth: 2,
201-
borderBottomStyle: "solid",
202-
borderBottomColor:
203-
viewMode === "write" ? "accent.fg" : "transparent",
204-
pb: 1,
200+
bg: viewMode === "write" ? "actionListItem.default.hoverBg" : "transparent",
201+
borderRadius: 2,
205202
"&:hover": {
206203
color: "fg.default",
207204
},
@@ -216,11 +213,8 @@ export function MarkdownEditor({
216213
sx={{
217214
fontWeight: viewMode === "preview" ? "semibold" : "normal",
218215
color: viewMode === "preview" ? "fg.default" : "fg.muted",
219-
borderBottomWidth: 2,
220-
borderBottomStyle: "solid",
221-
borderBottomColor:
222-
viewMode === "preview" ? "accent.fg" : "transparent",
223-
pb: 1,
216+
bg: viewMode === "preview" ? "actionListItem.default.hoverBg" : "transparent",
217+
borderRadius: 2,
224218
"&:hover": {
225219
color: "fg.default",
226220
},
@@ -340,13 +334,15 @@ export function MarkdownEditor({
340334
/>
341335
) : (
342336
<Box
343-
p={3}
344337
bg="canvas.default"
345338
sx={{
339+
padding: "12px",
346340
minHeight,
347341
fontSize: 1,
348-
lineHeight: 1.6,
342+
lineHeight: 1.5,
349343
color: "fg.default",
344+
// Remove top margin from first element so text aligns with write mode
345+
"& > :first-child": { mt: 0 },
350346
// GitHub Flavored Markdown styles
351347
"& h1, & h2, & h3, & h4, & h5, & h6": {
352348
mt: 3,
@@ -417,8 +413,8 @@ export function MarkdownEditor({
417413
borderColor: "border.default",
418414
my: 3,
419415
},
420-
}}
421-
>
416+
}}>
417+
422418
{value ? (
423419
<Markdown remarkPlugins={[remarkGfm]}>{value}</Markdown>
424420
) : (

0 commit comments

Comments
 (0)