refactor(docs): use onPress event instead (#4353)

This commit is contained in:
աӄա 2024-12-17 22:17:11 +08:00 committed by GitHub
parent 00fc0a0f85
commit d9a55d0360
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 18 additions and 96 deletions

View File

@ -58,7 +58,7 @@ export default function Page() {
</p> </p>
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button color="danger" variant="light" onClick={onClose}> <Button color="danger" variant="light" onPress={onClose}>
Close Close
</Button> </Button>
<Button color="primary" onPress={onClose}> <Button color="primary" onPress={onClose}>

View File

@ -1,16 +1,6 @@
"use client"; "use client";
import { import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">

View File

@ -9,13 +9,10 @@ import {
NavbarMenuItem, NavbarMenuItem,
NavbarMenuToggle, NavbarMenuToggle,
Button, Button,
Link as NextUiLink, Link,
LinkProps,
} from "@nextui-org/react"; } from "@nextui-org/react";
import React from "react"; import React from "react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path <path

View File

@ -1,16 +1,6 @@
"use client"; "use client";
import { import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">

View File

@ -6,16 +6,13 @@ import {
NavbarContent, NavbarContent,
NavbarItem, NavbarItem,
Button, Button,
Link as NextUiLink, Link,
LinkProps,
NavbarMenu, NavbarMenu,
NavbarMenuItem, NavbarMenuItem,
NavbarMenuToggle, NavbarMenuToggle,
} from "@nextui-org/react"; } from "@nextui-org/react";
import React from "react"; import React from "react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path <path

View File

@ -1,16 +1,6 @@
"use client"; "use client";
import { import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">

View File

@ -1,16 +1,6 @@
"use client"; "use client";
import { import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">

View File

@ -1,16 +1,6 @@
"use client"; "use client";
import { import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">

View File

@ -1,16 +1,6 @@
"use client"; "use client";
import { import {Navbar, NavbarBrand, NavbarContent, NavbarItem, Link, Button} from "@nextui-org/react";
Navbar,
NavbarBrand,
NavbarContent,
NavbarItem,
Link as NextUiLink,
LinkProps,
Button,
} from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">

View File

@ -5,8 +5,7 @@ import {
NavbarBrand, NavbarBrand,
NavbarContent, NavbarContent,
NavbarItem, NavbarItem,
Link as NextUiLink, Link,
LinkProps,
DropdownItem, DropdownItem,
DropdownTrigger, DropdownTrigger,
Dropdown, Dropdown,
@ -14,8 +13,6 @@ import {
Avatar, Avatar,
} from "@nextui-org/react"; } from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path <path

View File

@ -5,8 +5,7 @@ import {
NavbarBrand, NavbarBrand,
NavbarContent, NavbarContent,
NavbarItem, NavbarItem,
Link as NextUiLink, Link,
LinkProps,
Button, Button,
DropdownItem, DropdownItem,
DropdownTrigger, DropdownTrigger,
@ -15,8 +14,6 @@ import {
} from "@nextui-org/react"; } from "@nextui-org/react";
import {ChevronDown, Lock, Activity, Flash, Server, TagUser, Scale} from "@nextui-org/shared-icons"; 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 = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path <path

View File

@ -5,8 +5,7 @@ import {
NavbarBrand, NavbarBrand,
NavbarContent, NavbarContent,
NavbarItem, NavbarItem,
Link as NextUiLink, Link,
LinkProps,
Button, Button,
NavbarMenuToggle, NavbarMenuToggle,
NavbarMenu, NavbarMenu,
@ -14,8 +13,6 @@ import {
} from "@nextui-org/react"; } from "@nextui-org/react";
import React from "react"; import React from "react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
const AcmeLogo = () => ( const AcmeLogo = () => (
<svg fill="none" height="36" viewBox="0 0 32 32" width="36"> <svg fill="none" height="36" viewBox="0 0 32 32" width="36">
<path <path

View File

@ -5,8 +5,7 @@ import {
NavbarBrand, NavbarBrand,
NavbarContent, NavbarContent,
NavbarItem, NavbarItem,
Link as NextUiLink, Link,
LinkProps,
Input, Input,
DropdownItem, DropdownItem,
DropdownTrigger, DropdownTrigger,
@ -15,8 +14,6 @@ import {
Avatar, Avatar,
} from "@nextui-org/react"; } from "@nextui-org/react";
const Link = (props: LinkProps) => <NextUiLink {...props} onClick={(e) => e.preventDefault()} />;
import {SearchLinearIcon} from "@/components/icons"; import {SearchLinearIcon} from "@/components/icons";
const AcmeLogo = () => ( const AcmeLogo = () => (

View File

@ -72,7 +72,7 @@ export const InstallBanner = () => {
href="/docs/guide/installation" href="/docs/guide/installation"
radius="full" radius="full"
size="md" size="md"
onClick={() => { onPress={() => {
posthog.capture("InstallBanner - Get Started", { posthog.capture("InstallBanner - Get Started", {
action: "press", action: "press",
category: "landing-page", category: "landing-page",
@ -91,7 +91,7 @@ export const InstallBanner = () => {
size="md" size="md"
startContent={<GithubIcon />} startContent={<GithubIcon />}
variant="bordered" variant="bordered"
onClick={() => { onPress={() => {
posthog.capture("InstallBanner - Github", { posthog.capture("InstallBanner - Github", {
action: "press", action: "press",
category: "landing-page", category: "landing-page",

View File

@ -17,7 +17,7 @@ export const SponsorItem = ({name, href, logo}: Sponsor) => {
isExternal isExternal
className="flex flex-col items-center justify-center" className="flex flex-col items-center justify-center"
href={href} href={href}
onClick={() => { onPress={() => {
posthog.capture("Hero - Sponsors", { posthog.capture("Hero - Sponsors", {
name, name,
action: "click", action: "click",

View File

@ -198,7 +198,7 @@ const Link = ({href, children}: {href?: string; children?: React.ReactNode}) =>
disableAnimation={true} disableAnimation={true}
href={href} href={href}
{...externalProps} {...externalProps}
onClick={handleClick} onPress={handleClick}
> >
{children} {children}
</Components.Link> </Components.Link>

View File

@ -23,7 +23,7 @@ export const CopyButton = ({code: codeProp}: {code?: string}) => {
content={copied ? "Copied!" : "Copy"} content={copied ? "Copied!" : "Copy"}
radius="md" 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} /> <CopyLinearIcon className="text-white dark:text-zinc-500" height={16} width={16} />
</Button> </Button>
</Tooltip> </Tooltip>