-
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.
- Loading branch information
1 parent
beaf9c5
commit c717b87
Showing
7 changed files
with
21 additions
and
237 deletions.
There are no files selected for viewing
50 changes: 5 additions & 45 deletions
50
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 |
---|---|---|
@@ -1,51 +1,11 @@ | ||
@import '../../../../styles/variables'; | ||
|
||
.dropdown-navigation-item { | ||
&__control { | ||
text-wrap: nowrap; | ||
display: flex; | ||
align-items: center; | ||
text-wrap: nowrap; | ||
display: flex; | ||
align-items: center; | ||
|
||
&:hover { | ||
color: var(--g-color-text-brand); | ||
} | ||
|
||
&_active { | ||
color: var(--g-color-text-brand-heavy); | ||
} | ||
} | ||
|
||
&__text { | ||
margin-right: var(--g-spacing-1); | ||
} | ||
|
||
&__arrow { | ||
margin-left: auto; | ||
} | ||
|
||
&__dropdown { | ||
width: 100%; | ||
} | ||
|
||
&__dropdown-content-wrapper { | ||
background-color: transparent; | ||
border-color: transparent; | ||
border-radius: 0px; | ||
border-width: 0px; | ||
box-shadow: none; | ||
} | ||
|
||
&__dropdown-content-container { | ||
padding: 0 var(--g-spacing-5); | ||
} | ||
|
||
&__dropdown-content { | ||
background-color: var(--g-color-base-brand); | ||
padding: var(--g-spacing-5) var(--g-spacing-3); | ||
border-radius: 24px; | ||
} | ||
|
||
&__foldable-content-container { | ||
padding: 0px; | ||
&:hover { | ||
color: var(--g-color-text-brand); | ||
} | ||
} |
61 changes: 12 additions & 49 deletions
61
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 |
---|---|---|
@@ -1,63 +1,26 @@ | ||
import React, {useRef} from 'react'; | ||
import React from 'react'; | ||
|
||
import {Popup} from '@gravity-ui/uikit'; | ||
|
||
import {Foldable, ToggleArrow} from '../../../components'; | ||
import {Col, Grid, Row} from '../../../grid'; | ||
import {NavigationDropdownItem} from '../../../models'; | ||
import {cn} from '../../../utils'; | ||
import {NavigationItemProps, NavigationLayout} from '../../models'; | ||
|
||
import {ItemListContent} from './components/ItemListContent/ItemListContent'; | ||
import {NavigationItemProps} from '../../models'; | ||
|
||
import './CustomComponent.scss'; | ||
|
||
const b = cn('dropdown-navigation-item'); | ||
|
||
type DCDropdownNavigationItemProps = Pick< | ||
NavigationItemProps, | ||
'onClick' | 'isActive' | 'hidePopup' | 'menuLayout' | ||
> & | ||
NavigationDropdownItem; | ||
'onClick' | 'isActive' | 'menuLayout' | ||
>; | ||
|
||
export const CustomComponent: React.FC<DCDropdownNavigationItemProps> = (props) => { | ||
const {onClick, hidePopup, isActive, items, text, menuLayout} = props; | ||
const ref = useRef<HTMLDivElement>(null); | ||
|
||
const {onClick, isActive, menuLayout} = props; | ||
return ( | ||
<React.Fragment> | ||
<div ref={ref} className={b('control', {active: isActive})} onClick={onClick}> | ||
<span className={b('text')}>{text}</span>{' '} | ||
<ToggleArrow | ||
className={b('arrow')} | ||
type={'vertical'} | ||
iconType="navigation" | ||
open={isActive} | ||
/> | ||
</div> | ||
{menuLayout === NavigationLayout.Desktop ? ( | ||
<Popup | ||
anchorRef={ref} | ||
className={b('dropdown')} | ||
contentClassName={b('dropdown-content-wrapper')} | ||
open={isActive || false} | ||
onClose={hidePopup} | ||
> | ||
<Grid containerClass={b('dropdown-content-container')}> | ||
<Row className={b('dropdown-content')}> | ||
<Col> | ||
<ItemListContent items={items} /> | ||
</Col> | ||
</Row> | ||
</Grid> | ||
</Popup> | ||
) : ( | ||
<Foldable isOpened={isActive || false}> | ||
<Grid containerClass={b('foldable-content-container')}> | ||
<ItemListContent items={items} mobile /> | ||
</Grid> | ||
</Foldable> | ||
)} | ||
</React.Fragment> | ||
<div className={b({active: isActive})} onClick={onClick}> | ||
<span className={b('text')}>Custom Item</span> | ||
{' ('} | ||
{`${menuLayout}`} | ||
{isActive && ' - active'} | ||
{')'} | ||
</div> | ||
); | ||
}; |
20 changes: 0 additions & 20 deletions
20
src/navigation/__stories__/CustomComponent/components/ItemListContent/ItemListContent.scss
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
src/navigation/__stories__/CustomComponent/components/ItemListContent/ItemListContent.tsx
This file was deleted.
Oops, something went wrong.
46 changes: 0 additions & 46 deletions
46
...ation/__stories__/CustomComponent/components/NavigationPopupItem/NavigationPopupItem.scss
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
...gation/__stories__/CustomComponent/components/NavigationPopupItem/NavigationPopupItem.tsx
This file was deleted.
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