Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
style: add orange button to mdx components
Marc Seitz33f65bd11fd6
diff --git a/components/mdx/components/index.tsx b/components/mdx/components/index.tsxindex 3123118b..fa797e71 100644--- a/components/mdx/components/index.tsx+++ b/components/mdx/components/index.tsx@@ -3,12 +3,15 @@ import { MDXImage } from "./mdx-image";import { MDXComponents } from "mdx/types";import { Code } from "bright";import NextImage from "next/image";+import { cn } from "@/lib/utils";+import { Button } from "@/components/ui/button";export const mdxComponents: MDXComponents = {a: ({ children, ...props }) => {// check if external linkslet isExternal = false;- if (props.href?.startsWith("http")) {+ // if the link is not from papermark.io, it's external+ if (props.href?.startsWith("http") || !props.href?.includes("papermark.io")) {isExternal = true;}@@ -16,8 +19,9 @@ export const mdxComponents: MDXComponents = {// @ts-expect-error legacy refs<Link{...props}+ className={cn(props.className, "text-[#fb7a00] font-semibold no-underline hover:underline")}href={props.href || ""}- target={isExternal ? "_blank" : undefined}+ target="_blank"rel={isExternal ? "noopener noreferrer" : undefined}>{children}@@ -27,5 +31,28 @@ export const mdxComponents: MDXComponents = {img: MDXImage as any,Image: NextImage as any,pre: Code,+ Button: ({ children, ...props }) => {+ // check if external links+ let isExternal = false;+ // if the link is not from papermark.io, it's external+ if (props.href?.startsWith("http") || !props.href?.includes("papermark.io")) {+ isExternal = true;+ }++ return (+ <Link+ href={props.href || ""}+ target="_blank"+ rel={isExternal ? "noopener noreferrer" : undefined}+ >+ <Button+ variant={props.variant || "default"}+ className={props.className}+ >+ {children}+ </Button>+ </Link>+ );+ }// any other components you want to use in your markdown};diff --git a/components/ui/button.tsx b/components/ui/button.tsxindex f8114671..77e6d1d8 100644--- a/components/ui/button.tsx+++ b/components/ui/button.tsx@@ -13,6 +13,7 @@ const buttonVariants = cva(default:"bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",special: "text-white",+ orange: "bg-[#fb7a00] text-black hover:bg-[#fb7a00]/90 transition-colors",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 transition-colors",outline:diff --git a/content/blog/hello-world.mdx b/content/blog/hello-world.mdxindex afd4cd07..7fa6eddf 100644--- a/content/blog/hello-world.mdx+++ b/content/blog/hello-world.mdx@@ -14,8 +14,25 @@ Lorem Ipsum is _simply_ dummy text of the printing and typesetting industry. LorLorem Ipsum is simply dummy **text of the printing** and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.+<Button+ href="/contact"+ variant="outline"+ className="text-base rounded-3xl bg-transparent border-black"+>+ Book a demo+</Button>+++<Button+ href="https://www.google.com"+ variant="orange"+ className="text-base rounded-3xl">+ Start for free+</Button>++[Link to the image](https://www.papermark.com/_static/meta-image.png)```ts