-
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.
CU-86a5j1veu-NEON3 - Swap - Implement Swap Details Page
- Loading branch information
Showing
21 changed files
with
524 additions
and
336 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Binary file not shown.
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,90 @@ | ||
import { cloneElement, ComponentProps } from 'react' | ||
import { MdOutlineContentCopy } from 'react-icons/md' | ||
import { StyleHelper } from '@renderer/helpers/StyleHelper' | ||
import { UtilsHelper } from '@renderer/helpers/UtilsHelper' | ||
|
||
import { IconButton } from './IconButton' | ||
import { Separator } from './Separator' | ||
|
||
type TRootProps = ComponentProps<'div'> | ||
const Root = ({ className, children, ...props }: TRootProps) => { | ||
return ( | ||
<div | ||
className={StyleHelper.mergeStyles('flex flex-col py-2.5 px-4 bg-asphalt rounded w-full', className)} | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
type THeaderProps = { | ||
label: string | ||
icon?: JSX.Element | ||
} & ComponentProps<'div'> | ||
const Header = ({ label, icon, children, ...props }: THeaderProps) => { | ||
return ( | ||
<div {...props}> | ||
<div className="flex items-center gap-2.5"> | ||
{icon && cloneElement(icon, { className: StyleHelper.mergeStyles('text-blue w-6 h-6', icon.props.className) })} | ||
|
||
<span className="text-sm text-white">{label}</span> | ||
|
||
{children} | ||
</div> | ||
|
||
<Separator className="mt-2.5 mb-5" /> | ||
</div> | ||
) | ||
} | ||
type TBodyProps = ComponentProps<'div'> | ||
const Body = ({ className, children, ...props }: TBodyProps) => { | ||
return ( | ||
<div className={StyleHelper.mergeStyles('flex flex-col gap-5', className)} {...props}> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
type TPanelProps = { label: string } & ComponentProps<'div'> | ||
const Panel = ({ className, children, label, ...props }: TPanelProps) => { | ||
return ( | ||
<div className={StyleHelper.mergeStyles('flex flex-col', className)} {...props}> | ||
<div className="text-blue text-xs py-1.5 px-3.5 bg-gray-300/15 ">{label}</div> | ||
|
||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
type TItemProps = { label: string; copyable?: boolean } & ComponentProps<'div'> | ||
const Item = ({ label, children, copyable, className, ...props }: TItemProps) => { | ||
const handleCopy = () => { | ||
if (typeof children !== 'string') return | ||
UtilsHelper.copyToClipboard(children) | ||
} | ||
return ( | ||
<div className={StyleHelper.mergeStyles('flex flex-col group', className)}> | ||
<div className="flex flex-col gap-2.5 py-4 px-3" {...props}> | ||
<span className="text-xs text-gray-100 uppercase">{label}</span> | ||
|
||
<div className="flex gap-2.5 items-center"> | ||
{typeof children === 'string' ? <span className="text-sm text-white break-all">{children}</span> : children} | ||
|
||
{copyable && ( | ||
<IconButton | ||
icon={<MdOutlineContentCopy className="text-neon" />} | ||
size="sm" | ||
onClick={handleCopy} | ||
compacted | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
|
||
<Separator className="group-last:hidden" /> | ||
</div> | ||
) | ||
} | ||
|
||
export const Details = { Root, Header, Body, Panel, Item } |
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
Oops, something went wrong.