Skip to content

Commit b5c31fe

Browse files
committed
fix: header styling
1 parent bb8a9c6 commit b5c31fe

File tree

3 files changed

+43
-76
lines changed

3 files changed

+43
-76
lines changed

src/client/Preview.tsx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import {
1414
} from "@/client/diagnostics";
1515
import { useDebouncedValue } from "@/client/hooks/debounce";
1616
import { useStore } from "@/client/store";
17-
import type {
18-
Parameter,
19-
ParserLog,
20-
PreviewOutput,
21-
} from "@/gen/types";
17+
import type { Parameter, ParserLog, PreviewOutput } from "@/gen/types";
2218
import { cn } from "@/utils/cn";
2319
import ReactJsonView from "@microlink/react-json-view";
2420
import * as Dialog from "@radix-ui/react-dialog";
@@ -578,24 +574,26 @@ const Form: FC<FormProps> = ({ parameters }) => {
578574

579575
type FormElementProps = { parameter: Parameter };
580576
const FormElement: FC<FormElementProps> = ({ parameter }) => {
577+
const $form = useStore((state) => state.form);
578+
const $setForm = useStore((state) => state.setFormState);
579+
580+
const value = useMemo(
581+
() => $form[parameter.name] ?? parameter.default_value.value,
582+
[$form, parameter],
583+
);
584+
585+
const onValueChange = (value: string) => {
586+
$setForm(parameter.name, value);
587+
};
588+
581589
return (
582590
<DynamicParameter
583591
parameter={parameter}
592+
value={value}
584593
autofill={false}
585-
onChange={() => null}
594+
onChange={onValueChange}
586595
/>
587596
);
588-
// const $form = useStore((state) => state.form);
589-
// const $setForm = useStore((state) => state.setFormState);
590-
591-
// const value = useMemo(
592-
// () => $form[parameter.name] ?? parameter.default_value.value,
593-
// [$form, parameter],
594-
// );
595-
596-
// const onValueChange = (value: string) => {
597-
// $setForm(parameter.name, value);
598-
// };
599597

600598
// if (parameter.form_type === ParameterFormType.ParameterFormTypeInput) {
601599
// return (

src/client/components/Markdown.tsx

Lines changed: 27 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export const Markdown: FC<MarkdownProps> = (props) => {
4747
const isExternal = href?.startsWith("http");
4848

4949
return (
50-
<a href={href} target={isExternal ? "_blank" : undefined}>
50+
<NavLink to={href ?? ""} target={isExternal ? "_blank" : undefined}>
5151
{children}
52-
</a>
52+
</NavLink>
5353
);
5454
},
5555

@@ -113,6 +113,30 @@ export const Markdown: FC<MarkdownProps> = (props) => {
113113
return <TableCell>{children}</TableCell>;
114114
},
115115

116+
h1: ({ children }) => {
117+
return <h1 className="mt-8 mb-4 font-bold text-lg">{children}</h1>;
118+
},
119+
120+
h2: ({ children }) => {
121+
return <h2 className="mt-8 mb-4">{children}</h2>;
122+
},
123+
124+
h3: ({ children }) => {
125+
return <h3 className="mt-8 mb-4">{children}</h3>;
126+
},
127+
128+
h4: ({ children }) => {
129+
return <h4 className="mt-8 mb-4">{children}</h4>;
130+
},
131+
132+
h5: ({ children }) => {
133+
return <h5 className="mt-8 mb-4">{children}</h5>;
134+
},
135+
136+
h6: ({ children }) => {
137+
return <h6 className="mt-8 mb-4">{children}</h6>;
138+
},
139+
116140
/**
117141
* 2025-02-10 - The RemarkGFM plugin that we use currently doesn't have
118142
* support for special alert messages like this:
@@ -239,7 +263,7 @@ function parseChildrenAsAlertContent(
239263
isValidElement(node),
240264
);
241265
// biome-ignore lint/suspicious/noExplicitAny: In coder/coder this typeis difined as any
242-
let parentChildren = (mainParentNode?.props as any).children;
266+
let parentChildren = (mainParentNode?.props as any).children;
243267
if (typeof parentChildren === "string") {
244268
// Children will only be an array if the parsed text contains other
245269
// content that can be turned into HTML. If there aren't any, you
@@ -356,58 +380,3 @@ const MarkdownGfmAlert: FC<MarkdownGfmAlertProps> = ({
356380
</div>
357381
);
358382
};
359-
360-
// const markdownStyles: Interpolation<Theme> = (theme: Theme) => ({
361-
// fontSize: 16,
362-
// lineHeight: "24px",
363-
364-
// "& h1, & h2, & h3, & h4, & h5, & h6": {
365-
// marginTop: 32,
366-
// marginBottom: 16,
367-
// lineHeight: "1.25",
368-
// },
369-
370-
// "& p": {
371-
// marginTop: 0,
372-
// marginBottom: 16,
373-
// },
374-
375-
// "& p:only-child": {
376-
// marginTop: 0,
377-
// marginBottom: 0,
378-
// },
379-
380-
// "& ul, & ol": {
381-
// display: "flex",
382-
// flexDirection: "column",
383-
// gap: 8,
384-
// marginBottom: 16,
385-
// },
386-
387-
// "& li > ul, & li > ol": {
388-
// marginTop: 16,
389-
// },
390-
391-
// "& li > p": {
392-
// marginBottom: 0,
393-
// },
394-
395-
// "& .prismjs": {
396-
// background: theme.palette.background.paper,
397-
// borderRadius: 8,
398-
// padding: "16px 24px",
399-
// overflowX: "auto",
400-
401-
// "& code": {
402-
// color: theme.palette.text.secondary,
403-
// },
404-
405-
// "& .key, & .property, & .inserted, .keyword": {
406-
// color: colors.teal[300],
407-
// },
408-
409-
// "& .deleted": {
410-
// color: theme.palette.error.light,
411-
// },
412-
// },
413-
// });

tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,5 @@ module.exports = {
8585
},
8686
},
8787
},
88-
plugins: [require("tailwindcss-animate"), ],
88+
plugins: [require("tailwindcss-animate"), require("@tailwindcss/typography")],
8989
};

0 commit comments

Comments
 (0)