Skip to content

Commit

Permalink
refactor(docs): use onPress event instead
Browse files Browse the repository at this point in the history
  • Loading branch information
wingkwong committed Dec 13, 2024
1 parent c9da5d4 commit dc3c191
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 96 deletions.
2 changes: 1 addition & 1 deletion apps/docs/app/examples/modal/placement/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function Page() {
</p>
</ModalBody>
<ModalFooter>
<Button color="danger" variant="light" onClick={onClose}>
<Button color="danger" variant="light" onPress={onClose}>
Close
</Button>
<Button color="primary" onPress={onClose}>
Expand Down
12 changes: 1 addition & 11 deletions apps/docs/app/examples/navbar/bordered/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
"use client";

import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
Expand Down
5 changes: 1 addition & 4 deletions apps/docs/app/examples/navbar/controlled-menu/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ import {
NavbarMenuItem,
NavbarMenuToggle,
Button,
Link as NextUiLink,
LinkProps,
Link,
} from "@nextui-org/react";
import React from "react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
Expand Down
12 changes: 1 addition & 11 deletions apps/docs/app/examples/navbar/custom-active-item/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
"use client";

import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ import {
NavbarContent,
NavbarItem,
Button,
Link as NextUiLink,
LinkProps,
Link,
NavbarMenu,
NavbarMenuItem,
NavbarMenuToggle,
} from "@nextui-org/react";
import React from "react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
Expand Down
12 changes: 1 addition & 11 deletions apps/docs/app/examples/navbar/disabled-blur/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
"use client";

import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
Expand Down
12 changes: 1 addition & 11 deletions apps/docs/app/examples/navbar/hide-on-scroll/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
"use client";

import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
Expand Down
12 changes: 1 addition & 11 deletions apps/docs/app/examples/navbar/static/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
"use client";

import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
Expand Down
12 changes: 1 addition & 11 deletions apps/docs/app/examples/navbar/usage/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
"use client";

import {
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
Expand Down
5 changes: 1 addition & 4 deletions apps/docs/app/examples/navbar/with-avatar/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import {
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Link,
DropdownItem,
DropdownTrigger,
Dropdown,
DropdownMenu,
Avatar,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
Expand Down
5 changes: 1 addition & 4 deletions apps/docs/app/examples/navbar/with-dropdown-menu/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Link,
Button,
DropdownItem,
DropdownTrigger,
Expand All @@ -15,8 +14,6 @@ import {
} from "@nextui-org/react";
import {ChevronDown, Lock, Activity, Flash, Server, TagUser, Scale} from "@nextui-org/shared-icons";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
Expand Down
5 changes: 1 addition & 4 deletions apps/docs/app/examples/navbar/with-menu/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import {
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Link,
Button,
NavbarMenuToggle,
NavbarMenu,
NavbarMenuItem,
} from "@nextui-org/react";
import React from "react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;

const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path
Expand Down
5 changes: 1 addition & 4 deletions apps/docs/app/examples/navbar/with-search-input/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Link,
Input,
DropdownItem,
DropdownTrigger,
Expand All @@ -15,8 +14,6 @@ import {
Avatar,
} from "@nextui-org/react";

const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;

import {SearchLinearIcon} from "@/components/icons";

const AcmeLogo = () => (
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/components/marketing/install-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const InstallBanner = () => {
href="/docs/guide/installation"
radius="full"
size="md"
onClick={() => {
onPress={() => {
posthog.capture("InstallBanner - Get Started", {
action: "press",
category: "landing-page",
Expand All @@ -91,7 +91,7 @@ export const InstallBanner = () => {
size="md"
startContent={<GithubIcon />}
variant="bordered"
onClick={() => {
onPress={() => {
posthog.capture("InstallBanner - Github", {
action: "press",
category: "landing-page",
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/marketing/sponsor-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const SponsorItem = ({name, href, logo}: Sponsor) => {
isExternal
className="flex flex-col items-center justify-center"
href={href}
onClick={() => {
onPress={() => {
posthog.capture("Hero - Sponsors", {
name,
action: "click",
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const Link = ({href, children}: {href?: string; children?: React.ReactNode}) =>
disableAnimation={true}
href={href}
{...externalProps}
onClick={handleClick}
onPress={handleClick}
>
{children}
</Components.Link>
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/components/sandpack/copy-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const CopyButton = ({code: codeProp}: {code?: string}) => {
content={copied ? "Copied!" : "Copy"}
radius="md"
>
<Button isIconOnly size="sm" title="Copy Code" variant="light" onClick={copyHandler}>
<Button isIconOnly size="sm" title="Copy Code" variant="light" onPress={copyHandler}>
<CopyLinearIcon className="text-white dark:text-zinc-500" height={16} width={16} />
</Button>
</Tooltip>
Expand Down

0 comments on commit dc3c191

Please sign in to comment.