-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
254 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
apps/docs/content/components/link/custom-anchor-icon.raw.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
Oops, something went wrong.