add reference to the custom css documentation

This commit is contained in:
Athou
2025-05-12 08:30:47 +02:00
parent e3b6be0cd0
commit 168bcd3a37
33 changed files with 155 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import { useMobile } from "hooks/useMobile"
import type { ReactNode } from "react"
interface CodeEditorProps {
label?: ReactNode
description?: ReactNode
language: "css" | "javascript"
value?: string
@@ -19,7 +20,8 @@ export function CodeEditor(props: CodeEditorProps) {
autosize
minRows={4}
maxRows={15}
label={props.description}
label={props.label}
description={props.description}
styles={{
input: {
fontFamily: "monospace",
@@ -29,7 +31,7 @@ export function CodeEditor(props: CodeEditorProps) {
onChange={e => props.onChange(e.currentTarget.value)}
/>
) : (
<Input.Wrapper label={props.description}>
<Input.Wrapper label={props.label} description={props.description}>
<RichCodeEditor height="30vh" language={props.language} value={props.value} onChange={props.onChange} />
</Input.Wrapper>
)

View File

@@ -1,7 +1,8 @@
import { Trans } from "@lingui/react/macro"
import { Box, Button, Group, Stack } from "@mantine/core"
import { Anchor, Box, Button, Group, Stack } from "@mantine/core"
import { useForm } from "@mantine/form"
import { client, errorToStrings } from "app/client"
import { Constants } from "app/constants"
import { redirectToSelectedSource } from "app/redirect/thunks"
import { useAppDispatch, useAppSelector } from "app/store"
import { Alert } from "components/Alert"
@@ -57,13 +58,27 @@ export function CustomCodeSettings() {
<form onSubmit={form.onSubmit(saveCustomCode.execute)}>
<Stack>
<CodeEditor
description={<Trans>Custom CSS rules that will be applied</Trans>}
label={<Trans>Custom CSS rules that will be applied</Trans>}
description={
<Trans>
<span>See </span>
<Anchor
href={Constants.customCssDocumentationUrl}
target="_blank"
rel="noreferrer"
style={{ fontSize: "inherit" }}
>
here
</Anchor>
<span> for more information.</span>
</Trans>
}
language="css"
{...form.getInputProps("customCss")}
/>
<CodeEditor
description={<Trans>Custom JS code that will be executed on page load</Trans>}
label={<Trans>Custom JS code that will be executed on page load</Trans>}
language="javascript"
{...form.getInputProps("customJs")}
/>