Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): nextUI pro callout #4391

Merged
merged 4 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions apps/docs/components/docs/nextui-pro-callout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"use client";

import {usePostHog} from "posthog-js/react";
import NextLink from "next/link";

export const NextUIProCallout = () => {
const posthog = usePostHog();

const handleClick = () => {
posthog.capture("NextUI Pro Banner", {
action: "click",
category: "nextui-callout",
});
};

return (
<div className="relative w-full max-w-[12rem] flex flex-col items-center border border-default/60 hover:border-default/90 rounded-xl py-6 px-2 cursor-pointer">
<div>
<p className="leading-[1.025] tracking-tight text-center text-large font-semibold">
Ship&nbsp;
<span className="bg-clip-text text-transparent bg-gradient-to-b from-[#5EA2EF] to-[#0072F5]">
faster
</span>
<br />
with beautiful
<br />
components
</p>
<p className="text-center text-xs mt-2 px-3 font-medium text-default-500 dark:text-default-400 leading-tight">
Discover 210+ stunning components by NextUI
</p>
</div>
<div className="mt-3 w-fit flex group items-center text-foreground hover:shadow-sm relative overflow-hidden rounded-full p-[2px]">
<span className="absolute inset-[-1000%] bg-[conic-gradient(from_90deg_at_50%_50%,#338EF7_0%,#F54180_50%,#338EF7_100%)]" />
<div className="inline-flex h-full w-full cursor-pointer items-center justify-center rounded-full bg-background transition-background p-2.5 text-xs font-medium hover:font-semibold text-foreground backdrop-blur-3xl">
Explore Components
</div>
</div>
<NextLink
className="absolute inset-0 z-[1]"
href="https://nextui.pro/components?utm_source=nextui.org&utm_medium=callout"
onClick={handleClick}
/>
</div>
);
};
116 changes: 59 additions & 57 deletions apps/docs/components/docs/toc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {Divider, Spacer} from "@nextui-org/react";
import {ChevronCircleTopLinearIcon} from "@nextui-org/shared-icons";
import scrollIntoView from "scroll-into-view-if-needed";

import {NextUIProCallout} from "./nextui-pro-callout";

import {Heading} from "@/libs/docs/utils";
import {useScrollSpy} from "@/hooks/use-scroll-spy";
import {useScrollPosition} from "@/hooks/use-scroll-position";
Expand Down Expand Up @@ -65,64 +67,64 @@ export const DocsToc: FC<DocsTocProps> = ({headings}) => {
}, []);

return (
<div
ref={tocRef}
className={clsx(
"fixed w-full max-w-[12rem] flex flex-col gap-4 text-left pb-28 h-[calc(100vh-121px)] scrollbar-hide overflow-y-scroll",
isProBannerVisible ? "top-32" : "top-20",
)}
style={{
WebkitMaskImage: `linear-gradient(to top, transparent 0%, #000 100px, #000 ${
scrollPosition > 30 ? "90%" : "100%"
}, transparent 100%)`,
}}
>
<p className="text-sm font-medium">On this page</p>
<ul className="scrollbar-hide flex flex-col gap-2">
{headings.map(
(heading, i) =>
heading.level > 1 && (
<li
key={i}
className={clsx(
"transition-colors",
"font-normal",
"flex items-center text-tiny font-normal text-default-500 dark:text-default-300",
"data-[active=true]:text-foreground",
"dark:data-[active=true]:text-foreground",
"before:content-['']",
"before:opacity-0",
"data-[active=true]:before:opacity-100",
"before:transition-opacity",
"before:-ml-3",
"before:absolute",
"before:bg-default-400",
"before:w-1",
"before:h-1",
"before:rounded-full",
paddingLeftByLevel[heading.level],
)}
data-active={activeId == heading.id}
>
<a href={`#${heading.id}`}>{heading.text}</a>
</li>
),
)}
<li
className="mt-2 opacity-0 data-[visible=true]:opacity-100 transition-opacity"
data-visible={activeIndex >= 2}
>
<Divider />
<Spacer y={2} />
<a
className="flex gap-2 items-center text-tiny text-default-500 dark:text-foreground/30 hover:text-foreground/80 pl-4 transition-opacity"
href={`#${firstId}`}
<div className={clsx("fixed", isProBannerVisible ? "top-32" : "top-20")}>
<div
ref={tocRef}
className="w-full max-w-[12rem] max-h-[calc(100vh-500px)] flex flex-col gap-4 text-left pb-16 scrollbar-hide overflow-y-scroll"
style={{
WebkitMaskImage: `linear-gradient(to top, transparent 0%, #000 100px, #000 ${
scrollPosition > 30 ? "90%" : "100%"
}, transparent 100%)`,
}}
>
<p className="text-sm font-medium">On this page</p>
<ul className="scrollbar-hide flex flex-col gap-2">
{headings.map(
(heading, i) =>
heading.level > 1 && (
<li
key={i}
className={clsx(
"transition-colors",
"font-normal",
"flex items-center text-tiny font-normal text-default-500 dark:text-default-300",
"data-[active=true]:text-foreground",
"dark:data-[active=true]:text-foreground",
"before:content-['']",
"before:opacity-0",
"data-[active=true]:before:opacity-100",
"before:transition-opacity",
"before:-ml-3",
"before:absolute",
"before:bg-default-400",
"before:w-1",
"before:h-1",
"before:rounded-full",
paddingLeftByLevel[heading.level],
)}
data-active={activeId == heading.id}
>
<a href={`#${heading.id}`}>{heading.text}</a>
</li>
),
)}
<li
className="mt-2 opacity-0 data-[visible=true]:opacity-100 transition-opacity"
data-visible={activeIndex >= 2}
>
Back to top
<ChevronCircleTopLinearIcon />
</a>
</li>
</ul>
<Divider />
<Spacer y={2} />
<a
className="flex gap-2 items-center text-tiny text-default-500 dark:text-foreground/30 hover:text-foreground/80 pl-4 transition-opacity"
href={`#${firstId}`}
>
Back to top
<ChevronCircleTopLinearIcon />
</a>
</li>
</ul>
</div>
<NextUIProCallout />
</div>
);
};