-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Josh Wooding <[email protected]> Co-authored-by: mark-tate <[email protected]>
- Loading branch information
1 parent
569f8ac
commit 225a61b
Showing
10 changed files
with
146 additions
and
6 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,5 @@ | ||
--- | ||
"@salt-ds/core": minor | ||
--- | ||
|
||
Added `render` prop to `Link`. The `render` prop enables the substitution of the default anchor tag with an alternate link, such as React Router, facilitating integration with routing libraries. |
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
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 { type ComponentPropsWithoutRef, forwardRef } from "react"; | ||
import { renderProps } from "../utils"; | ||
|
||
interface LinkActionProps extends ComponentPropsWithoutRef<"a"> {} | ||
|
||
export const LinkAction = forwardRef<HTMLAnchorElement, LinkActionProps>( | ||
function LinkAction(props, ref) { | ||
return renderProps("a", { ...props, ref }); | ||
}, | ||
); |
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
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,19 @@ | ||
import { Link, Text } from "@salt-ds/core"; | ||
import type { ReactElement } from "react"; | ||
import styles from "./index.module.css"; | ||
|
||
const CustomLinkImplementation = (props: any) => ( | ||
<a {...props}> | ||
<Text>Your own Link implementation</Text> | ||
</a> | ||
); | ||
|
||
export const RenderElement = (): ReactElement => { | ||
return ( | ||
<Link | ||
href="#" | ||
className={styles.linkExample} | ||
render={<CustomLinkImplementation />} | ||
/> | ||
); | ||
}; |
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,19 @@ | ||
import { Link, Text } from "@salt-ds/core"; | ||
import type { ReactElement } from "react"; | ||
import styles from "./index.module.css"; | ||
|
||
const CustomLinkImplementation = (props: any) => ( | ||
<a {...props}> | ||
<Text>Your own Link implementation</Text> | ||
</a> | ||
); | ||
|
||
export const RenderProp = (): ReactElement => { | ||
return ( | ||
<Link | ||
href="#" | ||
className={styles.linkExample} | ||
render={(props) => <CustomLinkImplementation {...props} />} | ||
/> | ||
); | ||
}; |
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