-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,20 @@ | ||
import clsx from "classnames"; | ||
import { ReactNode } from "react"; | ||
|
||
export function Prose<T extends React.ElementType = "div">({ | ||
as, | ||
className, | ||
...props | ||
}: React.ComponentPropsWithoutRef<T> & { | ||
as?: T; | ||
}) { | ||
let Component = as ?? "div"; | ||
interface Props { | ||
children: ReactNode; | ||
className?: string; | ||
} | ||
|
||
export const Prose: React.FC<Props> = ({ children, className }) => { | ||
return ( | ||
<Component | ||
<div | ||
className={clsx( | ||
className, | ||
"dark:white prose max-w-none leading-normal dark:prose-invert", | ||
// headings | ||
"prose-headings:mb-2.5 prose-headings:text-2xl prose-h2:mt-10", | ||
// lead | ||
"prose-lead:text-slate-500 dark:prose-lead:text-white", | ||
// links | ||
"prose-a:font-normal dark:prose-a:text-pink", | ||
// link underline | ||
"prose-a:font-normal prose-a:no-underline hover:prose-a:font-normal hover:prose-a:underline ", | ||
// pre | ||
"prose-pre:rounded-xl prose-pre:bg-slate-900 prose-pre:shadow-lg dark:prose-pre:bg-slate-800/60 dark:prose-pre:shadow-none dark:prose-pre:ring-1 dark:prose-pre:ring-slate-300/10", | ||
// hr | ||
"dark:prose-hr:border-slate-800", | ||
//paragraph | ||
"prose-p:my-2.5", | ||
//list | ||
"prose-ul:my-2.5 prose-li:my-0 prose-li:px-0", | ||
//img | ||
"prose-img:my-10", | ||
//code | ||
"prose-code:text-base prose-code:font-normal", | ||
"dark:white prose max-w-none leading-normal dark:prose-invert prose-li:px-0", | ||
)} | ||
{...props} | ||
/> | ||
> | ||
{children} | ||
</div> | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters