Skip to content

Commit d9a55d0

Browse files
authored
refactor(docs): use onPress event instead (#4353)
1 parent 00fc0a0 commit d9a55d0

File tree

17 files changed

+18
-96
lines changed

17 files changed

+18
-96
lines changed

apps/docs/app/examples/modal/placement/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function Page() {
5858
</p>
5959
</ModalBody>
6060
<ModalFooter>
61-
<Button color="danger" variant="light" onClick={onClose}>
61+
<Button color="danger" variant="light" onPress={onClose}>
6262
Close
6363
</Button>
6464
<Button color="primary" onPress={onClose}>

apps/docs/app/examples/navbar/bordered/page.tsx

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
"use client";
22

3-
import {
4-
Navbar,
5-
NavbarBrand,
6-
NavbarContent,
7-
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
10-
Button,
11-
} from "@nextui-org/react";
12-
13-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
3+
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
144

155
const AcmeLogo = () => (
166
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">

apps/docs/app/examples/navbar/controlled-menu/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ import {
99
NavbarMenuItem,
1010
NavbarMenuToggle,
1111
Button,
12-
Link as NextUiLink,
13-
LinkProps,
12+
Link,
1413
} from "@nextui-org/react";
1514
import React from "react";
1615

17-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
18-
1916
const AcmeLogo = () => (
2017
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
2118
<path

apps/docs/app/examples/navbar/custom-active-item/page.tsx

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
"use client";
22

3-
import {
4-
Navbar,
5-
NavbarBrand,
6-
NavbarContent,
7-
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
10-
Button,
11-
} from "@nextui-org/react";
12-
13-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
3+
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
144

155
const AcmeLogo = () => (
166
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">

apps/docs/app/examples/navbar/disable-menu-animation/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@ import {
66
NavbarContent,
77
NavbarItem,
88
Button,
9-
Link as NextUiLink,
10-
LinkProps,
9+
Link,
1110
NavbarMenu,
1211
NavbarMenuItem,
1312
NavbarMenuToggle,
1413
} from "@nextui-org/react";
1514
import React from "react";
1615

17-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
18-
1916
const AcmeLogo = () => (
2017
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
2118
<path

apps/docs/app/examples/navbar/disabled-blur/page.tsx

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
"use client";
22

3-
import {
4-
Navbar,
5-
NavbarBrand,
6-
NavbarContent,
7-
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
10-
Button,
11-
} from "@nextui-org/react";
12-
13-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
3+
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
144

155
const AcmeLogo = () => (
166
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">

apps/docs/app/examples/navbar/hide-on-scroll/page.tsx

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
"use client";
22

3-
import {
4-
Navbar,
5-
NavbarBrand,
6-
NavbarContent,
7-
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
10-
Button,
11-
} from "@nextui-org/react";
12-
13-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
3+
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
144

155
const AcmeLogo = () => (
166
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">

apps/docs/app/examples/navbar/static/page.tsx

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
"use client";
22

3-
import {
4-
Navbar,
5-
NavbarBrand,
6-
NavbarContent,
7-
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
10-
Button,
11-
} from "@nextui-org/react";
12-
13-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
3+
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
144

155
const AcmeLogo = () => (
166
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">

apps/docs/app/examples/navbar/usage/page.tsx

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
"use client";
22

3-
import {
4-
Navbar,
5-
NavbarBrand,
6-
NavbarContent,
7-
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
10-
Button,
11-
} from "@nextui-org/react";
12-
13-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
3+
import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
144

155
const AcmeLogo = () => (
166
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">

apps/docs/app/examples/navbar/with-avatar/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ import {
55
NavbarBrand,
66
NavbarContent,
77
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
8+
Link,
109
DropdownItem,
1110
DropdownTrigger,
1211
Dropdown,
1312
DropdownMenu,
1413
Avatar,
1514
} from "@nextui-org/react";
1615

17-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
18-
1916
const AcmeLogo = () => (
2017
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
2118
<path

apps/docs/app/examples/navbar/with-dropdown-menu/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
NavbarBrand,
66
NavbarContent,
77
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
8+
Link,
109
Button,
1110
DropdownItem,
1211
DropdownTrigger,
@@ -15,8 +14,6 @@ import {
1514
} from "@nextui-org/react";
1615
import {ChevronDown, Lock, Activity, Flash, Server, TagUser, Scale} from "@nextui-org/shared-icons";
1716

18-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
19-
2017
const AcmeLogo = () => (
2118
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
2219
<path

apps/docs/app/examples/navbar/with-menu/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@ import {
55
NavbarBrand,
66
NavbarContent,
77
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
8+
Link,
109
Button,
1110
NavbarMenuToggle,
1211
NavbarMenu,
1312
NavbarMenuItem,
1413
} from "@nextui-org/react";
1514
import React from "react";
1615

17-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
18-
1916
const AcmeLogo = () => (
2017
<svg fill="none" height="36" viewBox="0 0 32 32" width="36">
2118
<path

apps/docs/app/examples/navbar/with-search-input/page.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {
55
NavbarBrand,
66
NavbarContent,
77
NavbarItem,
8-
Link as NextUiLink,
9-
LinkProps,
8+
Link,
109
Input,
1110
DropdownItem,
1211
DropdownTrigger,
@@ -15,8 +14,6 @@ import {
1514
Avatar,
1615
} from "@nextui-org/react";
1716

18-
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
19-
2017
import {SearchLinearIcon} from "@/components/icons";
2118

2219
const AcmeLogo = () => (

apps/docs/components/marketing/install-banner.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const InstallBanner = () => {
7272
href="/docs/guide/installation"
7373
radius="full"
7474
size="md"
75-
onClick={() => {
75+
onPress={() => {
7676
posthog.capture("InstallBanner - Get Started", {
7777
action: "press",
7878
category: "landing-page",
@@ -91,7 +91,7 @@ export const InstallBanner = () => {
9191
size="md"
9292
startContent={<GithubIcon />}
9393
variant="bordered"
94-
onClick={() => {
94+
onPress={() => {
9595
posthog.capture("InstallBanner - Github", {
9696
action: "press",
9797
category: "landing-page",

apps/docs/components/marketing/sponsor-item.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const SponsorItem = ({name, href, logo}: Sponsor) => {
1717
isExternal
1818
className="flex flex-col items-center justify-center"
1919
href={href}
20-
onClick={() => {
20+
onPress={() => {
2121
posthog.capture("Hero - Sponsors", {
2222
name,
2323
action: "click",

apps/docs/components/mdx-components.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ const Link = ({href, children}: {href?: string; children?: React.ReactNode}) =>
198198
disableAnimation={true}
199199
href={href}
200200
{...externalProps}
201-
onClick={handleClick}
201+
onPress={handleClick}
202202
>
203203
{children}
204204
</Components.Link>

apps/docs/components/sandpack/copy-button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const CopyButton = ({code: codeProp}: {code?: string}) => {
2323
content={copied ? "Copied!" : "Copy"}
2424
radius="md"
2525
>
26-
<Button isIconOnly size="sm" title="Copy Code" variant="light" onClick={copyHandler}>
26+
<Button isIconOnly size="sm" title="Copy Code" variant="light" onPress={copyHandler}>
2727
<CopyLinearIcon className="text-white dark:text-zinc-500" height={16} width={16} />
2828
</Button>
2929
</Tooltip>

0 commit comments

Comments
 (0)