Connect, collaborate, and grow with a community of TypeScript developers
style overrides for the wysiwyg to match our theme (#162)
PickleNikf4a06bae2e0b
diff --git a/src/app/create/page.tsx b/src/app/create/page.tsxindex 2f1ccd15..db58968d 100644--- a/src/app/create/page.tsx+++ b/src/app/create/page.tsx@@ -145,44 +145,37 @@ export default function CreateChallenge() {<Markdown>{description}</Markdown></div>) : (- <>- <MDEditor- height="100%"- className="flex-1"- value={description}- // non-split-screen by default- preview="edit"- // removes resize handle on bottom right- visibleDragbar={false}- // @ts-ignore- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument- onChange={(ev) => setDescription(ev)}- // TODO: customize toolbar GH #131- // components={{- // toolbar: (command, disabled, executeCommand) => {- // if (command.keyCommand === 'code') {- // return (- // <button- // aria-label="Insert code"- // disabled={disabled}- // onClick={(evn) => {- // evn.stopPropagation();- // executeCommand(command, command.groupName);- // }}- // >- // Code- // </button>- // );- // }- // },- // }}- />- {/* <Textarea- className="flex-1 resize-none border-none bg-zinc-100 dark:bg-zinc-900"- value={description}- onChange={(ev) => setDescription(ev.currentTarget.value)}- /> */}- </>+ <MDEditor+ height="100%"+ className="flex-1"+ value={description}+ // non-split-screen by default+ preview="edit"+ // removes resize handle on bottom right+ visibleDragbar={false}+ // @ts-ignore+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument+ onChange={(ev) => setDescription(ev)}+ // TODO: customize toolbar GH #131+ // components={{+ // toolbar: (command, disabled, executeCommand) => {+ // if (command.keyCommand === 'code') {+ // return (+ // <button+ // aria-label="Insert code"+ // disabled={disabled}+ // onClick={(evn) => {+ // evn.stopPropagation();+ // executeCommand(command, command.groupName);+ // }}+ // >+ // Code+ // </button>+ // );+ // }+ // },+ // }}+ />)}</TabsContent></Tabs>diff --git a/src/components/create/explore-card-inputs.tsx b/src/components/create/explore-card-inputs.tsxindex 09be5ee1..686dd3e4 100644--- a/src/components/create/explore-card-inputs.tsx+++ b/src/components/create/explore-card-inputs.tsx@@ -55,7 +55,7 @@ const ExploreCardInputs = ({{/* TODO: add background shapes grid pattern */}<CardHeader className="relative grid items-start gap-4"><div className="flex flex-col items-start">- <h1 className="text-sm text-white/70">Challenge Difficulty Level:</h1>+ <h1 className="text-sm text-black/50 dark:text-white/70">Challenge Difficulty Level:</h1><Select onValueChange={(value: Difficulty) => setDifficulty(value)} value={difficulty}><SelectTrigger className="h-8 max-w-fit border-0 p-0 focus:ring-0 focus:ring-offset-0 focus-visible:border-0 focus-visible:ring-0 focus-visible:ring-offset-0"><DifficultyBadge difficulty={difficulty || 'BEGINNER'} />@@ -68,10 +68,10 @@ const ExploreCardInputs = ({<SelectItem value="EXTREME">EXTREME</SelectItem></SelectContent></Select>- <h1 className="pt-3 text-sm text-white/70">Challenge Title:</h1>- <CardTitle className="pb-4 pt-0 text-4xl text-white">+ <h1 className="pt-3 text-sm text-black/50 dark:text-white/70">Challenge Title:</h1>+ <CardTitle className="pb-4 pt-0 text-4xl dark:text-white"><input- className="bg-transparent placeholder-white/70 focus:outline-none"+ className="bg-transparent placeholder-black/50 focus:outline-none dark:placeholder-white/70"style={{ textShadow: '0 0 0.5rem #0003' }}value={name}placeholder="Enter Challenge Title"@@ -86,7 +86,7 @@ const ExploreCardInputs = ({</div><div className="mb-1 flex items-center justify-between pr-1">- <h1 className="text-sm text-white/70">Short Description:</h1>+ <h1 className="text-sm text-black/70 dark:text-white/70">Short Description:</h1><LabelhtmlFor="preview"@@ -109,7 +109,7 @@ const ExploreCardInputs = ({<Markdown>{shortDescription}</Markdown>) : (<textarea- className="w-full resize-none bg-transparent text-white placeholder-white/70 focus:outline-none"+ className="w-full resize-none bg-transparent placeholder-black/70 focus:outline-none dark:text-white dark:placeholder-white/70"value={shortDescription}placeholder="Enter Short Description"onChange={(ev) => setShortDescription(ev.currentTarget.value)}diff --git a/src/components/ui/markdown.tsx b/src/components/ui/markdown.tsxindex 7f9c2535..4305ada3 100644--- a/src/components/ui/markdown.tsx+++ b/src/components/ui/markdown.tsx@@ -12,10 +12,7 @@ export function Markdown({ children }: { children: string }) {remarkPlugins={[remarkGfm]}components={{h1: ({ className, ...props }) => (- <h1- className={clsx(className, 'mb-2 border-b border-zinc-500 pb-2 text-3xl font-bold')}- {...props}- />+ <h1 className={clsx(className, 'mb-2 pb-2 text-3xl font-bold')} {...props} />),p: ({ className, ...props }) => <p className={clsx(className, 'mb-4')} {...props} />,code({ inline, className, children, style: _, ...props }) {diff --git a/src/styles/globals.css b/src/styles/globals.cssindex 442f5e24..76058f4f 100644--- a/src/styles/globals.css+++ b/src/styles/globals.css@@ -85,3 +85,55 @@ body,main {height: 100%;}+.w-md-editor-content {+ @apply bg-background dark:bg-muted;+}++.w-md-editor-toolbar {+ @apply flex w-full gap-2;+ /* border-b border-b-zinc-300 */+ border-bottom: 1px solid rgb(212 212 216) !important;+ /* bg-background (in light mode) */+ background: #fff !important;+}++/* dark:border-b-zinc-300 dark:bg-muted */+.dark .w-md-editor-toolbar {+ border-bottom: 1px solid rgb(63 63 70) !important;+ background: hsl(240 3.7% 15.9%) !important;+}++.w-md-editor-toolbar-divider {+ @apply bg-zinc-300 dark:bg-zinc-700;+ height: 1.5rem !important;+}+.w-md-editor-toolbar ul {+ @apply flex items-center;+}+.w-md-editor-toolbar ul li.active button {+ @apply text-black dark:text-white;+}+.w-md-editor-toolbar ul li button {+ @apply flex h-8 w-8 items-center justify-center rounded-md p-1 text-neutral-500 hover:bg-neutral-200 hover:text-black dark:hover:bg-zinc-700 dark:hover:text-white;+}+.w-md-editor-toolbar ul li button[disabled] {+ @apply cursor-default text-neutral-700 hover:bg-transparent hover:text-neutral-700;+}+.w-md-editor-toolbar ul li button svg {+ @apply h-4 w-4;+}+.w-md-editor {+ background: var(--muted) !important;+}++.w-md-editor-preview {+ padding: 0.5rem 1rem !important;+ box-shadow: inset 1px 0 0 0 rgb(212 212 216) !important;+}+.dark .w-md-editor-preview {+ box-shadow: inset 1px 0 0 0 rgb(63 63 70) !important;+}++.w-md-editor-preview .wmde-markdown {+ @apply bg-muted;+}