-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update according to the latest API changes and fix github comments
- Loading branch information
Showing
104 changed files
with
1,996 additions
and
509 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { HTMLAttributes } from 'react'; | ||
|
||
type ButtonOnclick = Pick<HTMLAttributes<HTMLButtonElement>, 'onClick'>; | ||
|
||
export type PropsType = ButtonOnclick & { | ||
text: string; | ||
className?: string; | ||
hasTooltip?: boolean; | ||
}; |
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,43 @@ | ||
import { CopyIcon, CheckIcon } from 'components/icons'; | ||
import { PropsType } from './ButtonCopyIcon.type'; | ||
import { CopyText } from 'utils/copyText'; | ||
import { useState } from 'react'; | ||
import Tooltip from '../Tooltip'; | ||
|
||
function ButtonCopyIcon(props: PropsType) { | ||
const { text, className, hasTooltip = true } = props; | ||
const [copied, setCopied] = useState<boolean>(false); | ||
|
||
const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => { | ||
e.stopPropagation(); | ||
if (text && !copied) { | ||
CopyText(text); | ||
setCopied(true); | ||
setTimeout(() => setCopied(false), 3000); | ||
} | ||
}; | ||
|
||
return ( | ||
<button | ||
className={`flex items-center ${className || ''}`} | ||
onClick={handleClick}> | ||
{copied ? ( | ||
<> | ||
<CheckIcon /> | ||
</> | ||
) : ( | ||
<> | ||
{hasTooltip ? ( | ||
<Tooltip label="Copied To Clipboard"> | ||
<CopyIcon className="text-neutral-400 hover:text-hoverIcon" /> | ||
</Tooltip> | ||
) : ( | ||
<CopyIcon className="text-neutral-400 hover:text-hoverIcon" /> | ||
)} | ||
</> | ||
)} | ||
</button> | ||
); | ||
} | ||
|
||
export default ButtonCopyIcon; |
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,6 +1,8 @@ | ||
import { SvgIconProps } from '../SvgIcon'; | ||
|
||
export interface ListItemProps { | ||
location: string; | ||
openInNewTab: boolean; | ||
title: string; | ||
icon?: any; | ||
icon?: React.ComponentType<SvgIconProps>; | ||
} |
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
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
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,17 @@ | ||
import type { SvgIconPropsWithChildren } from './SvgIcon.types'; | ||
|
||
import React from 'react'; | ||
|
||
export function SvgIcon(props: SvgIconPropsWithChildren) { | ||
const { size = '1em', color, children, className } = props; | ||
const originalSvgProps = children?.props; | ||
const commonProps = { | ||
...originalSvgProps, | ||
width: size, | ||
height: size, | ||
color, | ||
className, | ||
}; | ||
|
||
return <svg {...commonProps}>{children?.props.children}</svg>; | ||
} |
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,8 @@ | ||
export interface SvgIconProps { | ||
size?: string; | ||
color?: string; | ||
className?: string; | ||
} | ||
export type SvgIconPropsWithChildren = SvgIconProps & { | ||
children?: React.ReactElement; | ||
}; |
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,2 @@ | ||
export { SvgIcon } from './SvgIcon'; | ||
export type { SvgIconPropsWithChildren, SvgIconProps } from './SvgIcon.types'; |
Oops, something went wrong.