This repository was archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add basic menu * fix storybook * add menu content * add menu and links styles * mobile improvements * mobile menu * navbar improvements * Fix conflict with styled-components * add icons and remove old menu * delete menu * toogle styles * show logo on mobile and fix ui issues * mobile improvements * add dark bg color * fix routes and constants part 1 * const error fix * change links to routes fromo const * remove const folder - to be refactored in a new PR * menu logic * fix husky error * menu logic * fix menu color on mobile * Fix navbar * icons tets * Convert file to .tsx * Add icon type * Fix icon type * Fix network redirect * fix style home link on mobile * feedback point 5 - mobile links * Display icons on menu dropdown * Fix problems with typing * Move menuContainer * Fix clickoutside * Fix when clickCloseMenuMobile, unify screenSizes mediaqueries * Remove escaped log * Fix close mobile menu click when click on Logo * Fix hide mobile mene when clicking on an internal Link * add icons to the menu * change logo animation as we have on CoWSwap * add external link icon * fix logo animation * fix cow icon size * remove svg styles * removed internal link attributes * feddback 2. Removed logo animation on mobile. * header improvement * remove globally touch highlight color effect * feedback 5: fix scrollbar on mobile * feedback 4: fix menu on medium and desktop * menu: App Data -> AppData * delete commented code * fix logo on mobile avoid opening the menu * feedback 3: landscape mode on mobile * menu item height * code improvements * fix storybook * fix dropdown stories * add MainMenu storybook * Moving MenuIcon inside MenuTree component, addin mobile behavior to the storybook * fix menu alignment on mobile * change dropdown component storybook * change component name Co-authored-by: Henry Palacios <[email protected]> Co-authored-by: Mati Dastugue <[email protected]>
- Loading branch information
1 parent
7f5cadd
commit 66b62c0
Showing
25 changed files
with
970 additions
and
58 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
51 changes: 51 additions & 0 deletions
51
src/components/common/MenuDropdown/InternalExternalLink.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,51 @@ | ||
import React from 'react' | ||
import SVG from 'react-inlinesvg' | ||
import { StyledIcon } from 'components/common/MenuDropdown/styled' | ||
import { ExternalLink } from 'components/analytics/ExternalLink' | ||
import { faExternalLink } from '@fortawesome/free-solid-svg-icons' | ||
import { LinkWithPrefixNetwork } from 'components/common/LinkWithPrefixNetwork' | ||
import { MenuImageProps, MenuItemKind, MenuLink } from './types' | ||
|
||
function MenuImage(props: MenuImageProps): JSX.Element | null { | ||
const { title, iconSVG, icon } = props | ||
|
||
if (iconSVG) { | ||
return <SVG src={iconSVG} description={`${title} icon`} /> | ||
} else if (icon) { | ||
return <img src={icon} alt={`${title} icon`} /> | ||
} else { | ||
return null | ||
} | ||
} | ||
|
||
interface InternalExternalLinkProps { | ||
link: MenuLink | ||
handleMobileMenuOnClick?: () => void | ||
} | ||
|
||
export default function InternalExternalMenuLink({ | ||
link, | ||
handleMobileMenuOnClick, | ||
}: InternalExternalLinkProps): JSX.Element { | ||
const { kind, title, url, iconSVG, icon } = link | ||
const menuImage = <MenuImage title={title} icon={icon} iconSVG={iconSVG} /> | ||
const menuImageExternal = <StyledIcon icon={faExternalLink} /> | ||
const isExternal = kind === MenuItemKind.EXTERNAL_LINK | ||
|
||
if (isExternal) { | ||
return ( | ||
<ExternalLink target={'_blank'} href={url} onClick={handleMobileMenuOnClick}> | ||
{menuImage} | ||
{title} | ||
{menuImageExternal} | ||
</ExternalLink> | ||
) | ||
} else { | ||
return ( | ||
<LinkWithPrefixNetwork to={url} target="_self" onClickOptional={handleMobileMenuOnClick}> | ||
{menuImage} | ||
{title} | ||
</LinkWithPrefixNetwork> | ||
) | ||
} | ||
} |
Oops, something went wrong.