-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from dhedge/feat/trading-settings-disclosure-c…
…omponents feat: add trading widget settings and withdraw disclosure components
- Loading branch information
Showing
108 changed files
with
2,498 additions
and
359 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
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
51 changes: 51 additions & 0 deletions
51
packages/trading-widget/src/components/common/badge/token-badge/token-badge.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 classNames from 'classnames' | ||
import type { FC, HTMLAttributes, ReactElement } from 'react' | ||
|
||
import { useTranslationContext } from 'providers/translation-provider' | ||
import type { TokenIconSize } from 'types' | ||
|
||
import { TokenIcon } from '../../icon/token-icon/token-icon' | ||
import { Skeleton } from '../../skeleton/skeleton' | ||
|
||
interface TokenBadgeProps { | ||
symbol: string | ||
iconSymbols: string[] | ||
size?: TokenIconSize | ||
symbolClasses?: HTMLAttributes<HTMLDivElement>['className'] | ||
CustomIcon?: ReactElement | ||
customTitle?: string | ||
className?: string | ||
} | ||
|
||
export const TokenBadge: FC<TokenBadgeProps> = ({ | ||
symbol, | ||
iconSymbols, | ||
size, | ||
symbolClasses = 'dtw-text-sm dtw-font-medium', | ||
CustomIcon, | ||
customTitle, | ||
className, | ||
}) => { | ||
const t = useTranslationContext() | ||
const title = customTitle || (symbol === 'all' ? t.allAssets : symbol) | ||
|
||
return ( | ||
<div | ||
className={classNames( | ||
'dtw-flex dtw-w-full dtw-items-center dtw-space-x-1.5', | ||
className, | ||
)} | ||
> | ||
{CustomIcon ?? ( | ||
<TokenIcon | ||
size={size} | ||
symbols={iconSymbols} | ||
className="dtw-flex-shrink-0" | ||
/> | ||
)} | ||
<div className={symbolClasses} title={title}> | ||
{title || <Skeleton className="dtw-w-[70px]" />} | ||
</div> | ||
</div> | ||
) | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/trading-widget/src/components/common/balance/balance.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,19 @@ | ||
import type { FC } from 'react' | ||
|
||
interface BalanceProps { | ||
balance: string | ||
price: string | null | ||
} | ||
|
||
export const Balance: FC<BalanceProps> = ({ balance, price }) => ( | ||
<div className="dtw-flex dtw-items-center dtw-justify-between"> | ||
<span className="dtw-text-[length:var(--panel-balance-font-size,var(--panel-font-size-lg))] dtw-leading-[var(--panel-balance-line-height,var(--panel-line-height-lg))] dtw-text-[color:var(--panel-balance-content-color,var(--panel-content-color))]"> | ||
{balance} | ||
</span> | ||
{price && ( | ||
<span className="dtw-text-[color:var(--panel-balance-price-content-color,var(--panel-secondary-content-color))] dtw-text-[length:var(--panel-balance-price-font-size,var(--panel-font-size))] dtw-leading-[var(--panel-balance-price-line-height,var(--panel-line-height))]"> | ||
{price} | ||
</span> | ||
)} | ||
</div> | ||
) |
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
31 changes: 31 additions & 0 deletions
31
packages/trading-widget/src/components/common/button/icon-button/icon-button.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,31 @@ | ||
import classNames from 'classnames' | ||
import type { ComponentProps, FC, FunctionComponent } from 'react' | ||
|
||
interface IconButtonProps { | ||
Icon: FunctionComponent<Omit<ComponentProps<'svg'>, 'ref'>> | ||
onClick?: () => void | ||
className?: string | ||
containerClassName?: string | ||
} | ||
|
||
export const IconButton: FC<IconButtonProps> = ({ | ||
Icon, | ||
onClick, | ||
className = 'dtw-h-7 dtw-w-7', | ||
containerClassName, | ||
}) => ( | ||
<div | ||
className={classNames( | ||
'dtw-group dtw-w-fit dtw-cursor-pointer dtw-self-end dtw-rounded-lg dtw-p-1 hover:dtw-bg-gray-700', | ||
containerClassName, | ||
)} | ||
onClick={onClick} | ||
> | ||
<Icon | ||
className={classNames( | ||
'dtw-text-themeGray group-hover:dtw-text-white', | ||
className, | ||
)} | ||
/> | ||
</div> | ||
) |
18 changes: 18 additions & 0 deletions
18
...ges/trading-widget/src/components/common/button/max-balance-button/max-balance-button.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,18 @@ | ||
import type { FC } from 'react' | ||
import { useTranslationContext } from 'providers/translation-provider' | ||
|
||
interface MaxBalanceButtonProps { | ||
onClick: () => void | ||
} | ||
|
||
export const MaxBalanceButton: FC<MaxBalanceButtonProps> = ({ onClick }) => { | ||
const t = useTranslationContext() | ||
return ( | ||
<button | ||
className="dtw-cursor-pointer dtw-text-[color:var(--panel-input-button-content-color,var(--panel-content-color))] dtw-rounded-[var(--panel-input-button-radius,var(--panel-radius))] dtw-bg-[var(--panel-input-button-bg,var(--panel-secondary-color))] dtw-border dtw-border-[var(--panel-input-button-border-color,var(--panel-accent-to-color))] dtw-px-[var(--panel-input-button-px)] dtw-text-[length:var(--panel-input-button-font-size,var(--panel-font-size-xs))] dtw-leading-[var(--panel-input-button-line-height,var(--panel-line-height-xs))] hover:dtw-opacity-[var(--panel-action-hover-opacity)] dtw-opacity-[var(--panel-action-opacity)]" | ||
onClick={onClick} | ||
> | ||
{t.max} | ||
</button> | ||
) | ||
} |
Oops, something went wrong.