Skip to content
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
26 changes: 26 additions & 0 deletions apps/docs/content/components/link/block.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {Link} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-2">
<Link isBlock showAnchorIcon color="foreground" href="#">
Foreground
</Link>
<Link isBlock showAnchorIcon color="primary" href="#">
Primary
</Link>
<Link isBlock showAnchorIcon color="secondary" href="#">
Secondary
</Link>
<Link isBlock showAnchorIcon color="success" href="#">
Success
</Link>
<Link isBlock showAnchorIcon color="warning" href="#">
Warning
</Link>
<Link isBlock showAnchorIcon color="danger" href="#">
Danger
</Link>
</div>
);
}
27 changes: 1 addition & 26 deletions apps/docs/content/components/link/block.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,4 @@
const App = `import {Link} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-2">
<Link isBlock showAnchorIcon href="#" color="foreground">
Foreground
</Link>
<Link isBlock showAnchorIcon href="#" color="primary">
Primary
</Link>
<Link isBlock showAnchorIcon href="#" color="secondary">
Secondary
</Link>
<Link isBlock showAnchorIcon href="#" color="success">
Success
</Link>
<Link isBlock showAnchorIcon href="#" color="warning">
Warning
</Link>
<Link isBlock showAnchorIcon href="#" color="danger">
Danger
</Link>
</div>
);
}`;
import App from "./block.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
26 changes: 26 additions & 0 deletions apps/docs/content/components/link/colors.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {Link} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-4">
<Link color="foreground" href="#">
Foreground
</Link>
<Link color="primary" href="#">
Primary
</Link>
<Link color="secondary" href="#">
Secondary
</Link>
<Link color="success" href="#">
Success
</Link>
<Link color="warning" href="#">
Warning
</Link>
<Link color="danger" href="#">
Danger
</Link>
</div>
);
}
15 changes: 1 addition & 14 deletions apps/docs/content/components/link/colors.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
const App = `import {Link} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-4">
<Link href="#" color="foreground">Foreground</Link>
<Link href="#" color="primary">Primary</Link>
<Link href="#" color="secondary">Secondary</Link>
<Link href="#" color="success">Success</Link>
<Link href="#" color="warning">Warning</Link>
<Link href="#" color="danger">Danger</Link>
</div>
);
}`;
import App from "./colors.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
35 changes: 35 additions & 0 deletions apps/docs/content/components/link/custom-anchor-icon.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {Link} from "@nextui-org/react";

export const AnchorIcon = (props) => (
<svg
aria-hidden="true"
focusable="false"
height="24"
role="presentation"
viewBox="0 0 24 24"
width="24"
{...props}
>
<path
d="M8.465,11.293c1.133-1.133,3.109-1.133,4.242,0L13.414,12l1.414-1.414l-0.707-0.707c-0.943-0.944-2.199-1.465-3.535-1.465 S7.994,8.935,7.051,9.879L4.929,12c-1.948,1.949-1.948,5.122,0,7.071c0.975,0.975,2.255,1.462,3.535,1.462 c1.281,0,2.562-0.487,3.536-1.462l0.707-0.707l-1.414-1.414l-0.707,0.707c-1.17,1.167-3.073,1.169-4.243,0 c-1.169-1.17-1.169-3.073,0-4.243L8.465,11.293z"
fill="currentColor"
/>
<path
d="M12,4.929l-0.707,0.707l1.414,1.414l0.707-0.707c1.169-1.167,3.072-1.169,4.243,0c1.169,1.17,1.169,3.073,0,4.243 l-2.122,2.121c-1.133,1.133-3.109,1.133-4.242,0L10.586,12l-1.414,1.414l0.707,0.707c0.943,0.944,2.199,1.465,3.535,1.465 s2.592-0.521,3.535-1.465L19.071,12c1.948-1.949,1.948-5.122,0-7.071C17.121,2.979,13.948,2.98,12,4.929z"
fill="currentColor"
/>
</svg>
);

export default function App() {
return (
<Link
isExternal
showAnchorIcon
anchorIcon={<AnchorIcon />}
href="https://github.com/nextui-org/nextui"
>
Custom Icon
</Link>
);
}
38 changes: 1 addition & 37 deletions apps/docs/content/components/link/custom-anchor-icon.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,7 @@
const AnchorIcon = `export const AnchorIcon = (props) => (
<svg
aria-hidden="true"
focusable="false"
height="24"
role="presentation"
viewBox="0 0 24 24"
width="24"
{...props}
>
<path
d="M8.465,11.293c1.133-1.133,3.109-1.133,4.242,0L13.414,12l1.414-1.414l-0.707-0.707c-0.943-0.944-2.199-1.465-3.535-1.465 S7.994,8.935,7.051,9.879L4.929,12c-1.948,1.949-1.948,5.122,0,7.071c0.975,0.975,2.255,1.462,3.535,1.462 c1.281,0,2.562-0.487,3.536-1.462l0.707-0.707l-1.414-1.414l-0.707,0.707c-1.17,1.167-3.073,1.169-4.243,0 c-1.169-1.17-1.169-3.073,0-4.243L8.465,11.293z"
fill="currentColor"
/>
<path
d="M12,4.929l-0.707,0.707l1.414,1.414l0.707-0.707c1.169-1.167,3.072-1.169,4.243,0c1.169,1.17,1.169,3.073,0,4.243 l-2.122,2.121c-1.133,1.133-3.109,1.133-4.242,0L10.586,12l-1.414,1.414l0.707,0.707c0.943,0.944,2.199,1.465,3.535,1.465 s2.592-0.521,3.535-1.465L19.071,12c1.948-1.949,1.948-5.122,0-7.071C17.121,2.979,13.948,2.98,12,4.929z"
fill="currentColor"
/>
</svg>
);`;

const App = `import {Link} from "@nextui-org/react";
import {AnchorIcon} from "./AnchorIcon";

export default function App() {
return (
<Link
isExternal
showAnchorIcon
href="https://github.com/nextui-org/nextui"
anchorIcon={<AnchorIcon />}
>
Custom Icon
</Link>
);
}`;
import App from "./custom-anchor-icon.raw.jsx?raw";

const react = {
"/App.jsx": App,
"/AnchorIcon.jsx": AnchorIcon,
};

export default {
Expand Down
30 changes: 30 additions & 0 deletions apps/docs/content/components/link/custom-impl.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {forwardRef} from "react";
import {LinkIcon} from "@nextui-org/shared-icons";
import {linkAnchorClasses} from "@nextui-org/theme";
import {useLink} from "@nextui-org/react";

const MyLink = forwardRef((props, ref) => {
const {
Component,
children,
showAnchorIcon,
anchorIcon = <LinkIcon className={linkAnchorClasses} />,
getLinkProps,
} = useLink({
...props,
ref,
});

return (
<Component {...getLinkProps()}>
<>
{children}
{showAnchorIcon && anchorIcon}
</>
</Component>
);
});

MyLink.displayName = "MyLink";

export default MyLink;
32 changes: 32 additions & 0 deletions apps/docs/content/components/link/custom-impl.raw.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, {forwardRef} from "react";
import {LinkIcon} from "@nextui-org/shared-icons";
import {linkAnchorClasses} from "@nextui-org/theme";
import {LinkProps, useLink} from "@nextui-org/react";

export interface MyLinkProps extends LinkProps {}

const MyLink = forwardRef<HTMLAnchorElement, MyLinkProps>((props, ref) => {
const {
Component,
children,
showAnchorIcon,
anchorIcon = <LinkIcon className={linkAnchorClasses} />,
getLinkProps,
} = useLink({
...props,
ref,
});

return (
<Component {...getLinkProps()}>
<>
{children}
{showAnchorIcon && anchorIcon}
</>
</Component>
);
});

MyLink.displayName = "MyLink";

export default MyLink;
67 changes: 2 additions & 65 deletions apps/docs/content/components/link/custom-impl.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,5 @@
const App = `import {forwardRef} from "react";
import {LinkIcon} from "@nextui-org/shared-icons";
import {linkAnchorClasses} from "@nextui-org/theme";

import {useLink} from "@nextui-org/react";

const MyLink = forwardRef((props, ref) => {
const {
Component,
children,
showAnchorIcon,
anchorIcon = <LinkIcon className={linkAnchorClasses} />,
getLinkProps,
} = useLink({
...props,
ref,
});

return (
<Component {...getLinkProps()}>
<>
{children}
{showAnchorIcon && anchorIcon}
</>
</Component>
);
});

MyLink.displayName = "MyLink";

export default MyLink;`;

const AppTs = `import {forwardRef} from "react";
import {LinkIcon} from "@nextui-org/shared-icons";
import {linkAnchorClasses} from "@nextui-org/theme";

import {LinkProps, useLink} from "@nextui-org/react";

export interface MyLinkProps extends LinkProps {}

const MyLink = forwardRef<HTMLAnchorElement, MyLinkProps>((props, ref) => {
const {
Component,
children,
showAnchorIcon,
anchorIcon = <LinkIcon className={linkAnchorClasses} />,
getLinkProps,
} = useLink({
...props,
ref,
});

return (
<Component {...getLinkProps()}>
<>
{children}
{showAnchorIcon && anchorIcon}
</>
</Component>
);
});

MyLink.displayName = "MyLink";

export default MyLink;`;
import App from "./custom-impl.raw.jsx?raw";
import AppTs from "./custom-impl.raw.tsx?raw";

const react = {
"/App.jsx": App,
Expand Down
9 changes: 9 additions & 0 deletions apps/docs/content/components/link/disabled.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {Link} from "@nextui-org/react";

export default function App() {
return (
<Link isDisabled href="#">
Disabled Link
</Link>
);
}
8 changes: 1 addition & 7 deletions apps/docs/content/components/link/disabled.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
const App = `import {Link} from "@nextui-org/react";

export default function App() {
return (
<Link href="#" isDisabled>Disabled Link</Link>
);
}`;
import App from "./disabled.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
14 changes: 14 additions & 0 deletions apps/docs/content/components/link/external.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {Link} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-4">
<Link isExternal href="https://github.com/nextui-org/nextui">
External Link
</Link>
<Link isExternal showAnchorIcon href="https://github.com/nextui-org/nextui">
External Link Anchor
</Link>
</div>
);
}
19 changes: 1 addition & 18 deletions apps/docs/content/components/link/external.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
const App = `import {Link} from "@nextui-org/react";

export default function App() {
return (
<div className="flex gap-4">
<Link isExternal href="https://github.com/nextui-org/nextui">
External Link
</Link>
<Link
isExternal
href="https://github.com/nextui-org/nextui"
showAnchorIcon
>
External Link Anchor
</Link>
</div>
);
}`;
import App from "./external.raw.jsx?raw";

const react = {
"/App.jsx": App,
Expand Down
10 changes: 10 additions & 0 deletions apps/docs/content/components/link/nextjs.raw.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Link} from "@nextui-org/react";
import NextLink from "next/link";

export default function App() {
return (
<Link as={NextLink} href="/route">
Next.js Link
</Link>
);
}
Loading