-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Navigation): provide dropdown props to custom components (#721)
* feat(Navigation): provide dropdown props to custom components * feat(Navigation): add layout data to custom component * fix: clearer code & storybook * fix: cleanup * fix: better naming in stories * fix: simplify custom navItem story * fix: clearer storybook
- Loading branch information
1 parent
4487d50
commit 3738410
Showing
4 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/navigation/__stories__/CustomComponent/CustomComponent.scss
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,7 @@ | ||
.custom-nav-item { | ||
white-space: nowrap; | ||
|
||
&:hover { | ||
color: var(--g-color-text-brand); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/navigation/__stories__/CustomComponent/CustomComponent.tsx
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,22 @@ | ||
import React from 'react'; | ||
|
||
import {cn} from '../../../utils'; | ||
import {NavigationItemProps} from '../../models'; | ||
|
||
import './CustomComponent.scss'; | ||
|
||
const b = cn('custom-nav-item'); | ||
|
||
type DCDropdownNavigationItemProps = Pick< | ||
NavigationItemProps, | ||
'onClick' | 'isActive' | 'menuLayout' | ||
>; | ||
|
||
export const CustomComponent: React.FC<DCDropdownNavigationItemProps> = (props) => { | ||
const {onClick, isActive, menuLayout} = props; | ||
return ( | ||
<div className={b({active: isActive})} onClick={onClick}> | ||
{`Custom Item (${menuLayout}${isActive ? ' - active' : ''})`} | ||
</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