Skip to content

Commit

Permalink
fixup! Feat(web-react): Introduce Navigation #DS-1524
Browse files Browse the repository at this point in the history
  • Loading branch information
curdaj committed Dec 14, 2024
1 parent 6db4256 commit d49782b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ const meta: Meta<typeof Navigation> = {
export default meta;
type Story = StoryObj<typeof Navigation>;

export const NavigationPlayground: Story = {
export const Playground: Story = {
name: 'Navigation',
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { SpiritNavigationLinkProps } from '../../types';

export type UseNavigationLinkProps = Partial<SpiritNavigationLinkProps> & {
'aria-current'?: string;
};
export type UseNavigationLinkProps = Partial<SpiritNavigationLinkProps>;

export type UseNavigationLinkReturn = {
navigationLinkProps: UseNavigationLinkProps;
Expand All @@ -11,16 +9,14 @@ export type UseNavigationLinkReturn = {
export const useNavigationLinkProps = (props: UseNavigationLinkProps): UseNavigationLinkReturn => {
const { elementType = 'a', isDisabled, href, target, rel, ariaLabel } = props;

const additionalProps: Partial<SpiritNavigationLinkProps> = {
const navigationLinkProps: Partial<SpiritNavigationLinkProps> = {
href: elementType === 'a' && !isDisabled ? href : undefined,
target: elementType === 'a' && !isDisabled ? target : undefined,
rel: elementType === 'a' ? rel : undefined,
'aria-label': ariaLabel,
};

return {
navigationLinkProps: {
...additionalProps,
},
navigationLinkProps,
};
};
2 changes: 1 addition & 1 deletion packages/web-react/src/types/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
TransferProps,
} from './shared';

export interface SpiritNavigationProps extends StyleProps {
export interface SpiritNavigationProps extends StyleProps, AriaLabelingProps {
children:
| ReactElement<HTMLLIElement>
| ReactElement<typeof NavigationItem>
Expand Down

0 comments on commit d49782b

Please sign in to comment.