-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jribbink/get-wallet-platform' into jribbink/connect-wallet
- Loading branch information
Showing
7 changed files
with
88 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Button, ButtonProps, RightJoinProps } from '@chakra-ui/react' | ||
import NextLink, { LinkProps } from 'next/link' | ||
|
||
type BaseProps = { | ||
children: React.ReactNode | ||
} | ||
|
||
type LinkButtonProps = RightJoinProps<LinkProps, ButtonProps> & BaseProps | ||
|
||
type StandardButtonProps = ButtonProps & BaseProps | ||
|
||
type HybridButtonProps = LinkButtonProps | StandardButtonProps | ||
|
||
function HybridButton({ children, ...props }: HybridButtonProps) { | ||
if ('href' in props) { | ||
return ( | ||
<Button as={NextLink} target="_blank" {...props}> | ||
{children} | ||
</Button> | ||
) | ||
} else { | ||
return <Button {...props}>{children}</Button> | ||
} | ||
} | ||
|
||
export default HybridButton |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
export enum BrowserType { | ||
CHROME = 'chrome', | ||
} | ||
import { BROWSERS } from './constants' | ||
|
||
export function getBrowserType(userAgent: string): BrowserType { | ||
export function getBrowserInfo( | ||
userAgent: string | ||
): typeof BROWSERS[keyof typeof BROWSERS] { | ||
if (userAgent.includes('Chrome')) { | ||
return BrowserType.CHROME | ||
return BROWSERS.CHROME | ||
} | ||
|
||
throw new Error('Unsupported browser') | ||
return BROWSERS.BROWSER | ||
} |
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