-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sparkle] - enh: introduce
LinkWrapper
(#8288)
* [sparkle] - feature: introduce LinkWrapper component for context-aware links - Created a new LinkWrapper component that takes SparkleContext to render links conditionally based on the provided href - Exposed LinkWrapperProps and LinkWrapper to be accessible from the sparkle package components index * [sparkle] - fix: correct aria-label attribute in context link component - Fixed a typo in the `aria-label` attribute of the context link component to ensure proper accessibility standards are met * [sparkle] - feature: enhance NewDropdownMenuItem with link capabilities - NewDropdownMenuItem refactored to include LinkWrapper for optional link behavior - Added props for link handling such as href, target, and rel to NewDropdownMenuItem component * [sparkle] - feature: enhance NavigationListItem with LinkWrapper functionality - Integrated LinkWrapper component to NavigationListItem to support hyperlinking capabilities - Added pass-through props from LinkWrapper to NavigationListItem excluding 'children' and 'className' for extended functionality * [sparkle] - feature: enhance TabsContent to support routing links - TabsContent now accepts LinkWrapperProps to enable client-side routing for tabbed interfaces - Wrapped TabsContent in LinkWrapper to facilitate navigation when tabs are clicked * [sparkle] - refactor: improve TabsTrigger component with LinkWrapperProps - Extended TabsTrigger props to include Omit<LinkWrapperProps, "children" | "className"> for better link management - Wrapped TabsTrigger content with LinkWrapper component to provide link capabilities - Removed redundant displayName setting for TabsTrigger and moved it to TabsContent component * [sparkle] - fix: adjust conditional rendering and wrapper elements in components - Make `asChild` prop conditionally apply when either `href` or `asChild` is true in `NewDropdownMenuItem` - Wrap `Button` with a `div` in `TabsTrigger` to ensure proper rendering - Remove `s-ring-ring` class duplication in `TabsContent` styles - Apply `asChild` prop directly to `NewDropdownMenuTrigger` in storybook examples for consistent behavior * [sparkle] - feature: bump package version to 0.2.283 - Incremented the package version for a new release - Updated package-lock.json to keep dependencies in sync with the new version --------- Co-authored-by: Jules <[email protected]>
- Loading branch information
1 parent
6e5460f
commit c13504b
Showing
10 changed files
with
235 additions
and
95 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,42 @@ | ||
import React from "react"; | ||
|
||
import { SparkleContext } from "@sparkle/context"; | ||
|
||
export interface LinkWrapperProps { | ||
href?: string; | ||
target?: string; | ||
rel?: string; | ||
replace?: boolean; | ||
shallow?: boolean; | ||
className?: string; | ||
children: React.ReactNode; | ||
} | ||
|
||
export function LinkWrapper({ | ||
href, | ||
target, | ||
rel, | ||
replace, | ||
shallow, | ||
className, | ||
children, | ||
}: LinkWrapperProps) { | ||
const { components } = React.useContext(SparkleContext); | ||
|
||
if (href) { | ||
return ( | ||
<components.link | ||
href={href} | ||
target={target} | ||
rel={rel} | ||
replace={replace} | ||
shallow={shallow} | ||
className={className} | ||
> | ||
{children} | ||
</components.link> | ||
); | ||
} | ||
|
||
return <>{children}</>; | ||
} |
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
Oops, something went wrong.