-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add PolkaGate * Update Yarn on CI * Change dependency installation command * Update yarn.lock * Make linter happy * Supress sass deprecation warning --------- Co-authored-by: Lauro Gripa <laurogripa@gmail.com>
- Loading branch information
1 parent
f1af77e
commit 8149f77
Showing
7 changed files
with
17,562 additions
and
11,757 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
nodeLinker: node-modules | ||
|
||
packageExtensions: | ||
babel-preset-react-app@*: | ||
dependencies: | ||
|
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 |
---|---|---|
@@ -1,25 +1,30 @@ | ||
import React from 'react' | ||
import { Link, LinkProps, useLocation } from 'react-router-dom' | ||
import styled from 'styled-components' | ||
|
||
const LinkWithQuery = ({ children, to, ...props }: LinkProps & React.RefAttributes<HTMLAnchorElement>) => { | ||
const { search } = useLocation() | ||
const isSelected = location.pathname === to.toString() || location.pathname === to.toString() + '/' | ||
interface LinkWithQueryProps extends Omit<LinkProps, 'to'> { | ||
to: string | ||
children: React.ReactNode | ||
} | ||
|
||
const LinkWithQuery: React.FC<LinkWithQueryProps> = ({ children, to, ...props }) => { | ||
const { search, pathname } = useLocation() | ||
const isSelected = pathname === to || pathname === to + '/' | ||
return ( | ||
<StyledLink to={to + search} {...props} selected={isSelected}> | ||
<StyledLink to={to + search} {...props} $selected={isSelected}> | ||
{children} | ||
</StyledLink> | ||
) | ||
} | ||
|
||
interface StyledLinkProps extends LinkProps { | ||
selected?: boolean | ||
interface StyledLinkProps { | ||
$selected?: boolean | ||
} | ||
|
||
const StyledLink = styled(Link)<StyledLinkProps>` | ||
color: ${(props) => props.selected && 'white !important'}; | ||
pointer-events: ${(props) => (props.selected ? 'none' : 'auto')}; | ||
cursor: ${(props) => (props.selected ? 'default' : 'pointer')}; | ||
color: ${(props) => props.$selected && 'white !important'}; | ||
pointer-events: ${(props) => (props.$selected ? 'none' : 'auto')}; | ||
cursor: ${(props) => (props.$selected ? 'default' : 'pointer')}; | ||
` | ||
|
||
export { LinkWithQuery } |
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.