Account menu and components improvements (#145)
* better copy button * hide sign into mobile for production and use new copy icon button * new checkbox
@ -44,9 +44,11 @@
|
||||
"@dydxprotocol/v4-localization": "^1.0.5",
|
||||
"@ethersproject/providers": "^5.7.2",
|
||||
"@js-joda/core": "^5.5.3",
|
||||
"@radix-ui/react-checkbox": "^1.0.4",
|
||||
"@radix-ui/react-collapsible": "^1.0.3",
|
||||
"@radix-ui/react-dialog": "^1.0.4",
|
||||
"@radix-ui/react-dropdown-menu": "^2.0.5",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@radix-ui/react-navigation-menu": "^1.1.3",
|
||||
"@radix-ui/react-popover": "^1.0.6",
|
||||
"@radix-ui/react-radio-group": "^1.1.3",
|
||||
|
||||
50
pnpm-lock.yaml
generated
@ -1,9 +1,5 @@
|
||||
lockfileVersion: '6.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
dependencies:
|
||||
'@0xsquid/sdk':
|
||||
specifier: ^1.10.0
|
||||
@ -41,6 +37,9 @@ dependencies:
|
||||
'@js-joda/core':
|
||||
specifier: ^5.5.3
|
||||
version: 5.5.3
|
||||
'@radix-ui/react-checkbox':
|
||||
specifier: ^1.0.4
|
||||
version: 1.0.4(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
|
||||
'@radix-ui/react-collapsible':
|
||||
specifier: ^1.0.3
|
||||
version: 1.0.3(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
|
||||
@ -50,6 +49,9 @@ dependencies:
|
||||
'@radix-ui/react-dropdown-menu':
|
||||
specifier: ^2.0.5
|
||||
version: 2.0.5(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
|
||||
'@radix-ui/react-icons':
|
||||
specifier: ^1.3.0
|
||||
version: 1.3.0(react@18.2.0)
|
||||
'@radix-ui/react-navigation-menu':
|
||||
specifier: ^1.1.3
|
||||
version: 1.1.3(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
|
||||
@ -2181,6 +2183,34 @@ packages:
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
dev: false
|
||||
|
||||
/@radix-ui/react-checkbox@1.0.4(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0):
|
||||
resolution: {integrity: sha512-CBuGQa52aAYnADZVt/KBQzXrwx6TqnlwtcIPGtVt5JkkzQwMOLJjPukimhfKEr4GQNd43C+djUh5Ikopj8pSLg==}
|
||||
peerDependencies:
|
||||
'@types/react': '*'
|
||||
'@types/react-dom': '*'
|
||||
react: ^16.8 || ^17.0 || ^18.0
|
||||
react-dom: ^16.8 || ^17.0 || ^18.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
'@types/react-dom':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.22.10
|
||||
'@radix-ui/primitive': 1.0.1
|
||||
'@radix-ui/react-compose-refs': 1.0.1(@types/react@18.2.14)(react@18.2.0)
|
||||
'@radix-ui/react-context': 1.0.1(@types/react@18.2.14)(react@18.2.0)
|
||||
'@radix-ui/react-presence': 1.0.1(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
|
||||
'@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)
|
||||
'@radix-ui/react-use-controllable-state': 1.0.1(@types/react@18.2.14)(react@18.2.0)
|
||||
'@radix-ui/react-use-previous': 1.0.1(@types/react@18.2.14)(react@18.2.0)
|
||||
'@radix-ui/react-use-size': 1.0.1(@types/react@18.2.14)(react@18.2.0)
|
||||
'@types/react': 18.2.14
|
||||
'@types/react-dom': 18.2.6
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
dev: false
|
||||
|
||||
/@radix-ui/react-collapsible@1.0.3(@types/react-dom@18.2.6)(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0):
|
||||
resolution: {integrity: sha512-UBmVDkmR6IvDsloHVN+3rtx4Mi5TFvylYXpluuv0f37dtaz3H99bp8No0LGXRigVpl3UAT4l9j6bIchh42S/Gg==}
|
||||
peerDependencies:
|
||||
@ -2482,6 +2512,14 @@ packages:
|
||||
react-dom: 18.2.0(react@18.2.0)
|
||||
dev: false
|
||||
|
||||
/@radix-ui/react-icons@1.3.0(react@18.2.0):
|
||||
resolution: {integrity: sha512-jQxj/0LKgp+j9BiTXz3O3sgs26RNet2iLWmsPyRz2SIcR4q/4SbazXfnYwbAr+vLYKSfc7qxzyGQA1HLlYiuNw==}
|
||||
peerDependencies:
|
||||
react: ^16.x || ^17.x || ^18.x
|
||||
dependencies:
|
||||
react: 18.2.0
|
||||
dev: false
|
||||
|
||||
/@radix-ui/react-id@1.0.0(react@18.2.0):
|
||||
resolution: {integrity: sha512-Q6iAB/U7Tq3NTolBBQbHTgclPmGWE3OlktGGqrClPozSw4vkQ1DfQAOtzgRPecKsMdJINE05iaoDUG8tRzCBjw==}
|
||||
peerDependencies:
|
||||
@ -14099,3 +14137,7 @@ packages:
|
||||
/zwitch@2.0.4:
|
||||
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
||||
dev: true
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
|
Before Width: | Height: | Size: 817 B After Width: | Height: | Size: 297 B |
@ -13,7 +13,9 @@ export const Checkboxes: Story<CheckboxProps> = (args) => {
|
||||
<Checkbox
|
||||
{...args}
|
||||
checked={isChecked}
|
||||
onClick={(e: React.ChangeEvent) => setIsChecked((e.target as HTMLInputElement).checked)}
|
||||
onCheckedChange={setIsChecked}
|
||||
id="story-checkbox"
|
||||
label="example label"
|
||||
/>
|
||||
</StoryWrapper>
|
||||
);
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||
import { Root, Indicator } from '@radix-ui/react-checkbox';
|
||||
import { CheckIcon } from '@radix-ui/react-icons';
|
||||
|
||||
import { breakpoints } from '@/styles';
|
||||
import { layoutMixins } from '@/styles/layoutMixins';
|
||||
|
||||
type ElementProps = {
|
||||
checked: boolean;
|
||||
onClick: (e: React.ChangeEvent) => void;
|
||||
onCheckedChange: (checked: boolean) => void;
|
||||
id?: string;
|
||||
label?: React.ReactNode;
|
||||
};
|
||||
|
||||
type StyleProps = {
|
||||
@ -13,85 +17,54 @@ type StyleProps = {
|
||||
|
||||
export type CheckboxProps = ElementProps & StyleProps;
|
||||
|
||||
export const Checkbox: React.FC<CheckboxProps> = ({ checked, className, onClick }) => {
|
||||
return (
|
||||
<Styled.CheckboxWrapper className={className}>
|
||||
<Styled.Checkbox
|
||||
type="checkbox"
|
||||
checked={checked}
|
||||
onChange={onClick}
|
||||
/>
|
||||
<Styled.CustomCheckbox />
|
||||
</Styled.CheckboxWrapper>
|
||||
);
|
||||
};
|
||||
export const Checkbox: React.FC<CheckboxProps> = ({
|
||||
checked,
|
||||
className,
|
||||
onCheckedChange,
|
||||
id,
|
||||
label,
|
||||
}) => (
|
||||
<Styled.Container>
|
||||
<Styled.Root className={className} checked={checked} onCheckedChange={onCheckedChange} id={id}>
|
||||
<Styled.Indicator>
|
||||
<CheckIcon />
|
||||
</Styled.Indicator>
|
||||
</Styled.Root>
|
||||
{label && <label htmlFor={id}>{label}</label>}
|
||||
</Styled.Container>
|
||||
);
|
||||
|
||||
const Styled: Record<string, AnyStyledComponent> = {};
|
||||
|
||||
Styled.CustomCheckbox = styled.span`
|
||||
width: 1.25em;
|
||||
height: 1.25em;
|
||||
Styled.Container = styled.div`
|
||||
${layoutMixins.row}
|
||||
gap: 1ch;
|
||||
font: var(--font-small-book);
|
||||
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
label {
|
||||
cursor: pointer;
|
||||
}
|
||||
`;
|
||||
|
||||
Styled.Root = styled(Root)`
|
||||
--checkbox-backgroundColor: var(--color-layer-0);
|
||||
|
||||
min-width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
|
||||
border-radius: 0.375rem;
|
||||
border: var(--border-width) solid var(--color-border);
|
||||
background-color: var(--checkbox-backgroundColor);
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: '';
|
||||
top: 0.25em;
|
||||
left: 0.4375em;
|
||||
width: 0.3125em;
|
||||
height: 0.5em;
|
||||
border: solid var(--checkbox-checkColor);
|
||||
border-width: 0 0.125em 0.125em 0;
|
||||
border-radius: 0.0625em;
|
||||
opacity: 0;
|
||||
transform: rotate(0deg) scale(0);
|
||||
transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
@media ${breakpoints.tablet} {
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
|
||||
&::after {
|
||||
top: 0.25em;
|
||||
left: 0.4375em;
|
||||
width: 0.4375em;
|
||||
height: 0.625em;
|
||||
}
|
||||
&[data-state='checked'] {
|
||||
--checkbox-backgroundColor: var(--color-accent);
|
||||
}
|
||||
`;
|
||||
|
||||
Styled.CheckboxWrapper = styled.div`
|
||||
--checkbox-backgroundColor: var(--color-layer-1);
|
||||
--checkbox-checkColor: var(--color-text-1);
|
||||
|
||||
Styled.Indicator = styled(Indicator)`
|
||||
display: flex;
|
||||
border-radius: 0.25em;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
> input:checked ~ ${Styled.CustomCheckbox}::after {
|
||||
opacity: 1;
|
||||
transform: rotate(40deg) scale(1);
|
||||
}
|
||||
`;
|
||||
|
||||
Styled.Checkbox = styled.input`
|
||||
width: 1.25em;
|
||||
height: 1.25em;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
|
||||
@media ${breakpoints.tablet} {
|
||||
width: 1.5em;
|
||||
height: 1.5em;
|
||||
}
|
||||
color: var(--color-text-2);
|
||||
`;
|
||||
|
||||
@ -15,10 +15,10 @@ CopyButtonStory.args = {
|
||||
};
|
||||
|
||||
CopyButtonStory.argTypes = {
|
||||
shownAsText: {
|
||||
options: [true, false],
|
||||
buttonType: {
|
||||
options: ["text", "icon", "default"],
|
||||
control: { type: 'select' },
|
||||
defaultValue: false,
|
||||
defaultValue: "default",
|
||||
},
|
||||
children: {
|
||||
options: ['some text to copy'],
|
||||
|
||||
@ -9,14 +9,20 @@ import { layoutMixins } from '@/styles/layoutMixins';
|
||||
|
||||
import { Button, ButtonProps } from './Button';
|
||||
import { Icon, IconName } from './Icon';
|
||||
import { IconButton } from './IconButton';
|
||||
|
||||
export type CopyButtonProps = {
|
||||
value?: string;
|
||||
shownAsText?: boolean;
|
||||
buttonType?: 'text' | 'icon' | 'default';
|
||||
children?: React.ReactNode;
|
||||
} & ButtonProps;
|
||||
|
||||
export const CopyButton = ({ value, shownAsText, children, ...buttonProps }: CopyButtonProps) => {
|
||||
export const CopyButton = ({
|
||||
value,
|
||||
buttonType = 'default',
|
||||
children,
|
||||
...buttonProps
|
||||
}: CopyButtonProps) => {
|
||||
const stringGetter = useStringGetter();
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
@ -28,11 +34,19 @@ export const CopyButton = ({ value, shownAsText, children, ...buttonProps }: Cop
|
||||
setTimeout(() => setCopied(false), 500);
|
||||
};
|
||||
|
||||
return shownAsText ? (
|
||||
return buttonType === 'text' ? (
|
||||
<Styled.InlineRow onClick={onCopy} copied={copied}>
|
||||
{children}
|
||||
<Icon iconName={IconName.Copy} />
|
||||
<Styled.Icon copied={copied} iconName={copied ? IconName.Check : IconName.Copy} />
|
||||
</Styled.InlineRow>
|
||||
) : buttonType === 'icon' ? (
|
||||
<Styled.IconButton
|
||||
{...buttonProps}
|
||||
copied={copied}
|
||||
action={ButtonAction.Base}
|
||||
iconName={copied ? IconName.Check : IconName.Copy}
|
||||
onClick={onCopy}
|
||||
/>
|
||||
) : (
|
||||
<Button
|
||||
{...buttonProps}
|
||||
@ -63,3 +77,21 @@ Styled.InlineRow = styled.div<{ copied: boolean }>`
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
||||
Styled.Icon = styled(Icon)<{ copied: boolean }>`
|
||||
${({ copied }) =>
|
||||
copied &&
|
||||
css`
|
||||
color: var(--color-positive);
|
||||
`}
|
||||
`;
|
||||
|
||||
Styled.IconButton = styled(IconButton)<{ copied: boolean }>`
|
||||
${({ copied }) =>
|
||||
copied &&
|
||||
css`
|
||||
svg {
|
||||
color: var(--color-positive);
|
||||
}
|
||||
`}
|
||||
`;
|
||||
|
||||
@ -9,6 +9,7 @@ import {
|
||||
RadioItem,
|
||||
Portal,
|
||||
} from '@radix-ui/react-dropdown-menu';
|
||||
import { CheckIcon } from '@radix-ui/react-icons';
|
||||
|
||||
import { type MenuItem } from '@/constants/menus';
|
||||
|
||||
@ -90,7 +91,9 @@ export const DropdownSelectMenu = <MenuItemValue extends string>({
|
||||
|
||||
{slotAfter}
|
||||
|
||||
<Styled.ItemIndicator>✔{/* <CheckIcon /> */}</Styled.ItemIndicator>
|
||||
<Styled.ItemIndicator>
|
||||
<CheckIcon />
|
||||
</Styled.ItemIndicator>
|
||||
</Styled.RadioItem>
|
||||
))}
|
||||
</RadioGroup>
|
||||
|
||||
@ -1,43 +1,16 @@
|
||||
import styled, { AnyStyledComponent } from 'styled-components';
|
||||
|
||||
import { layoutMixins } from '@/styles/layoutMixins';
|
||||
|
||||
import { Icon, IconName } from '@/components/Icon';
|
||||
|
||||
export const GreenCheckCircle = ({ className }: { className?: string }) => (
|
||||
<Styled.GreenCheckCircle className={className}>
|
||||
<Icon iconName={IconName.Check} />
|
||||
</Styled.GreenCheckCircle>
|
||||
<Styled.Icon className={className} iconName={IconName.CheckCircle} />
|
||||
);
|
||||
|
||||
const Styled: Record<string, AnyStyledComponent> = {};
|
||||
|
||||
Styled.GreenCheckCircle = styled.div`
|
||||
${layoutMixins.stack}
|
||||
|
||||
Styled.Icon = styled(Icon)`
|
||||
--icon-size: 1.25rem;
|
||||
--icon-border-width: 3px;
|
||||
|
||||
width: var(--icon-size);
|
||||
height: var(--icon-size);
|
||||
border-radius: 50%;
|
||||
|
||||
align-items: center;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
width: calc(var(--icon-size) - var(--icon-border-width) * 2);
|
||||
height: calc(var(--icon-size) - var(--icon-border-width) * 2);
|
||||
border: solid var(--icon-border-width) var(--color-positive);
|
||||
border-radius: 50%;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
svg {
|
||||
width: calc(var(--icon-size) / 3);
|
||||
height: calc(var(--icon-size) / 3);
|
||||
|
||||
color: var(--color-positive);
|
||||
justify-self: center;
|
||||
}
|
||||
`;
|
||||
|
||||
@ -15,6 +15,7 @@ import {
|
||||
CautionCircleIcon,
|
||||
ChatIcon,
|
||||
CheckIcon,
|
||||
CheckCircleIcon,
|
||||
ChevronLeftIcon,
|
||||
ChevronRightIcon,
|
||||
ClockIcon,
|
||||
@ -86,6 +87,7 @@ export enum IconName {
|
||||
CautionCircleStroked = 'CautionCircleStroked',
|
||||
Chat = 'Chat',
|
||||
Check = 'Check',
|
||||
CheckCircle = 'CheckCircle',
|
||||
ChevronLeft = 'ChevronLeft',
|
||||
ChevronRight = 'ChevronRight',
|
||||
Clock = 'Clock',
|
||||
@ -158,6 +160,7 @@ const icons = {
|
||||
[IconName.CautionCircleStroked]: CautionCircleStrokeIcon,
|
||||
[IconName.Chat]: ChatIcon,
|
||||
[IconName.Check]: CheckIcon,
|
||||
[IconName.CheckCircle]: CheckCircleIcon,
|
||||
[IconName.ChevronLeft]: ChevronLeftIcon,
|
||||
[IconName.ChevronRight]: ChevronRightIcon,
|
||||
[IconName.Clock]: ClockIcon,
|
||||
|
||||
@ -13,6 +13,7 @@ import {
|
||||
Portal,
|
||||
Icon as SelectIcon,
|
||||
} from '@radix-ui/react-select';
|
||||
import { CheckIcon } from '@radix-ui/react-icons';
|
||||
|
||||
import { popoverMixins } from '@/styles/popoverMixins';
|
||||
import { formMixins } from '@/styles/formMixins';
|
||||
@ -68,7 +69,9 @@ export const SelectItem = <T extends string>({
|
||||
}) => (
|
||||
<Styled.Item className={className} value={value}>
|
||||
<ItemText>{label}</ItemText>
|
||||
<Styled.ItemIndicator>✔{/* <CheckIcon /> */}</Styled.ItemIndicator>
|
||||
<Styled.ItemIndicator>
|
||||
<CheckIcon />
|
||||
</Styled.ItemIndicator>
|
||||
</Styled.Item>
|
||||
);
|
||||
|
||||
|
||||
6
src/icons/check-circle.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<svg width="27" height="28" viewBox="0 0 27 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Frame">
|
||||
<path id="Vector" d="M9.5 15L12.5 18L17.5 11M25.5 14C25.5 15.5759 25.1896 17.1363 24.5866 18.5922C23.9835 20.0481 23.0996 21.371 21.9853 22.4853C20.871 23.5996 19.5481 24.4835 18.0922 25.0866C16.6363 25.6896 15.0759 26 13.5 26C11.9241 26 10.3637 25.6896 8.9078 25.0866C7.45189 24.4835 6.12902 23.5996 5.01472 22.4853C3.90042 21.371 3.0165 20.0481 2.41345 18.5922C1.81039 17.1363 1.5 15.5759 1.5 14C1.5 10.8174 2.76428 7.76516 5.01472 5.51472C7.26516 3.26428 10.3174 2 13.5 2C16.6826 2 19.7348 3.26428 21.9853 5.51472C24.2357 7.76516 25.5 10.8174 25.5 14Z" stroke="#3ED9A4" stroke-opacity="0.5" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path id="Vector_2" d="M9.5 15L12.5 18L17.5 11" stroke="#3ED9A4" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 914 B |
@ -1,4 +1,4 @@
|
||||
<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2 6.39098L5.68182 10L11 2" stroke="currentColor" stroke-width="3" stroke-linecap="round"
|
||||
<path d="M2 6.39098L5.68182 10L11 2" stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 235 B |
@ -10,6 +10,7 @@ export { default as CautionCircleIcon } from './caution-circle.svg';
|
||||
export { default as CautionCircleStrokeIcon } from './caution-circle-stroke.svg';
|
||||
export { default as ChatIcon } from './chat-bubble.svg';
|
||||
export { default as CheckIcon } from './check.svg';
|
||||
export { default as CheckCircleIcon } from './check-circle.svg';
|
||||
export { default as ChevronLeftIcon } from './chevron-left.svg';
|
||||
export { default as ChevronRightIcon } from './chevron-right.svg';
|
||||
export { default as ClockIcon } from './clock.svg';
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<g fill="#FFFFFF">
|
||||
<path d="M461.2 128H80c-8.84 0-16-7.16-16-16s7.16-16 16-16h384c8.84 0 16-7.16 16-16 0-26.51-21.49-48-48-48H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h397.2c28.02 0 50.8-21.53 50.8-48V176c0-26.47-22.78-48-50.8-48zM416 336c-17.67 0-32-14.33-32-32s14.33-32 32-32 32 14.33 32 32-14.33 32-32 32z"/>
|
||||
</g>
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="Wallet" clip-path="url(#clip0_14122_34311)">
|
||||
<g id="Group 151">
|
||||
<path id="Exclude" fill-rule="evenodd" clip-rule="evenodd" d="M11.4979 10.9976C11.1764 11.3193 10.7404 11.5 10.2857 11.5L1.71429 11.5C1.25963 11.5 0.823594 11.3193 0.502102 10.9976C0.180612 10.6758 -4.76837e-07 10.2395 -4.76837e-07 9.78455L-4.76837e-07 2.06502C-4.76837e-07 2.51999 0.180612 2.95632 0.502102 3.27803C0.823594 3.59974 1.25963 3.78047 1.71429 3.78047L10.2857 3.78047C10.7404 3.78047 11.1764 3.96121 11.4979 4.28292C11.8194 4.60462 12 5.04096 12 5.49592V9.78455C12 10.2395 11.8194 10.6758 11.4979 10.9976ZM9.64294 8.7126C10.2347 8.7126 10.7144 8.23258 10.7144 7.64044C10.7144 7.0483 10.2347 6.56828 9.64294 6.56828C9.05121 6.56828 8.57151 7.0483 8.57151 7.64044C8.57151 8.23258 9.05121 8.7126 9.64294 8.7126Z" fill="#C8C7D8"/>
|
||||
<path id="Vector" d="M8.57031 2.92186V2.06413C8.57031 1.60917 8.3897 1.17284 8.06821 0.851128C7.74672 0.529419 7.31068 0.348684 6.85603 0.348684L2.14174 0.348684C1.80075 0.348684 1.47372 0.484235 1.2326 0.725517C0.991486 0.966799 0.856028 1.29405 0.856028 1.63527C0.856028 1.9765 0.991486 2.30374 1.2326 2.54503C1.47372 2.78631 1.80075 2.92186 2.14174 2.92186L8.57031 2.92186Z" fill="#C8C7D8"/>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_14122_34311">
|
||||
<rect width="12" height="12" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 1.4 KiB |
@ -5,7 +5,7 @@ import { AlertType } from '@/constants/alerts';
|
||||
import { ButtonAction, ButtonSize } from '@/constants/buttons';
|
||||
import { STRING_KEYS } from '@/constants/localization';
|
||||
import { useAccounts, useStringGetter } from '@/hooks';
|
||||
import { breakpoints } from '@/styles';
|
||||
import breakpoints from '@/styles/breakpoints';
|
||||
import { layoutMixins } from '@/styles/layoutMixins';
|
||||
|
||||
import { AlertMessage } from '@/components/AlertMessage';
|
||||
@ -54,11 +54,14 @@ export const MnemonicExportDialog = ({ setIsOpen }: ElementProps) => {
|
||||
<Styled.WithReceipt
|
||||
slotReceipt={
|
||||
<Styled.CheckboxContainer>
|
||||
<Styled.Checkbox
|
||||
<Checkbox
|
||||
checked={hasAcknowledged}
|
||||
onClick={() => setHasAcknowledged(!hasAcknowledged)}
|
||||
onCheckedChange={setHasAcknowledged}
|
||||
id="acknowledge-secret-phase-risk"
|
||||
label={stringGetter({
|
||||
key: STRING_KEYS.SECRET_PHRASE_RISK_ACK,
|
||||
})}
|
||||
/>
|
||||
<span>{stringGetter({ key: STRING_KEYS.SECRET_PHRASE_RISK_ACK })}</span>
|
||||
</Styled.CheckboxContainer>
|
||||
}
|
||||
>
|
||||
@ -162,17 +165,10 @@ Styled.WithReceipt = styled(WithReceipt)`
|
||||
`;
|
||||
|
||||
Styled.CheckboxContainer = styled.div`
|
||||
${layoutMixins.spacedRow};
|
||||
|
||||
padding: 1rem;
|
||||
gap: 0.75rem;
|
||||
color: var(--color-text-0);
|
||||
`;
|
||||
|
||||
Styled.Checkbox = styled(Checkbox)`
|
||||
--checkbox-backgroundColor: var(--color-layer-3);
|
||||
`;
|
||||
|
||||
Styled.AlertMessage = styled(AlertMessage)`
|
||||
font: var(--font-base-book);
|
||||
margin: 0;
|
||||
|
||||
@ -130,40 +130,38 @@ export const AdvancedTradeOptions = () => {
|
||||
</Styled.SelectMenu>
|
||||
)}
|
||||
{needsPostOnly && (
|
||||
<Styled.CheckboxField>
|
||||
<Checkbox
|
||||
checked={postOnly || false}
|
||||
onClick={() =>
|
||||
abacusStateManager.setTradeValue({
|
||||
value: !postOnly,
|
||||
field: TradeInputField.postOnly,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Styled.CheckboxLabel>
|
||||
<Checkbox
|
||||
checked={postOnly || false}
|
||||
onCheckedChange={(checked) =>
|
||||
abacusStateManager.setTradeValue({
|
||||
value: checked,
|
||||
field: TradeInputField.postOnly,
|
||||
})
|
||||
}
|
||||
id="post-only"
|
||||
label={
|
||||
<WithTooltip tooltip="post-only" side="right">
|
||||
{stringGetter({ key: STRING_KEYS.POST_ONLY })}
|
||||
</WithTooltip>
|
||||
</Styled.CheckboxLabel>
|
||||
</Styled.CheckboxField>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{needsReduceOnly && (
|
||||
<Styled.CheckboxField>
|
||||
<Checkbox
|
||||
checked={reduceOnly || false}
|
||||
onClick={() =>
|
||||
abacusStateManager.setTradeValue({
|
||||
value: !reduceOnly,
|
||||
field: TradeInputField.reduceOnly,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<Styled.CheckboxLabel>
|
||||
<Checkbox
|
||||
checked={reduceOnly || false}
|
||||
onCheckedChange={(checked) =>
|
||||
abacusStateManager.setTradeValue({
|
||||
value: checked,
|
||||
field: TradeInputField.reduceOnly,
|
||||
})
|
||||
}
|
||||
id="reduce-only"
|
||||
label={
|
||||
<WithTooltip tooltip="reduce-only" side="right">
|
||||
{stringGetter({ key: STRING_KEYS.REDUCE_ONLY })}
|
||||
</WithTooltip>
|
||||
</Styled.CheckboxLabel>
|
||||
</Styled.CheckboxField>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
@ -174,15 +172,6 @@ export const AdvancedTradeOptions = () => {
|
||||
|
||||
const Styled: Record<string, AnyStyledComponent> = {};
|
||||
|
||||
Styled.CheckboxField = styled.div`
|
||||
${layoutMixins.row}
|
||||
gap: 0.5rem;
|
||||
`;
|
||||
|
||||
Styled.CheckboxLabel = styled.div`
|
||||
font-size: 0.875em;
|
||||
`;
|
||||
|
||||
Styled.Collapsible = styled(Collapsible)`
|
||||
--trigger-backgroundColor: transparent;
|
||||
--trigger-open-backgroundColor: transparent;
|
||||
|
||||
@ -444,10 +444,6 @@ Styled.DestinationInputLabel = styled.span`
|
||||
|
||||
svg {
|
||||
color: var(--color-positive);
|
||||
|
||||
path {
|
||||
stroke-width: 2;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import { OnboardingState } from '@/constants/account';
|
||||
import { ButtonAction, ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons';
|
||||
import { DialogTypes } from '@/constants/dialogs';
|
||||
import { STRING_KEYS, TOOLTIP_STRING_KEYS } from '@/constants/localization';
|
||||
import { isMainnet } from '@/constants/networks';
|
||||
import { DydxChainAsset, wallets } from '@/constants/wallets';
|
||||
|
||||
import {
|
||||
@ -21,6 +22,7 @@ import {
|
||||
import { OnboardingTriggerButton } from '@/views/dialogs/OnboardingTriggerButton';
|
||||
|
||||
import { AssetIcon } from '@/components/AssetIcon';
|
||||
import { CopyButton } from '@/components/CopyButton';
|
||||
import { DropdownMenu } from '@/components/DropdownMenu';
|
||||
import { Output, OutputType } from '@/components/Output';
|
||||
import { Icon, IconName } from '@/components/Icon';
|
||||
@ -38,6 +40,7 @@ import { layoutMixins } from '@/styles/layoutMixins';
|
||||
import { headerMixins } from '@/styles/headerMixins';
|
||||
import { MustBigNumber } from '@/lib/numbers';
|
||||
|
||||
|
||||
export const AccountMenu = () => {
|
||||
const stringGetter = useStringGetter();
|
||||
const { mintscanBase } = useURLConfigs();
|
||||
@ -87,13 +90,8 @@ export const AccountMenu = () => {
|
||||
</WithTooltip>
|
||||
<Styled.Address>{truncateAddress(dydxAddress)}</Styled.Address>
|
||||
</Styled.Column>
|
||||
<IconButton
|
||||
action={ButtonAction.Base}
|
||||
iconName={IconName.Copy}
|
||||
onClick={() => dydxAddress && navigator.clipboard.writeText(dydxAddress)}
|
||||
shape={ButtonShape.Square}
|
||||
/>
|
||||
<IconButton
|
||||
<Styled.CopyButton buttonType="icon" value={dydxAddress} shape={ButtonShape.Square} />
|
||||
<Styled.IconButton
|
||||
action={ButtonAction.Base}
|
||||
href={`${mintscanBase}/account/${dydxAddress}`}
|
||||
iconName={IconName.LinkOut}
|
||||
@ -121,7 +119,7 @@ export const AccountMenu = () => {
|
||||
key: STRING_KEYS.ASSET_BALANCE,
|
||||
params: { ASSET: chainTokenLabel },
|
||||
})}
|
||||
{/* <AssetIcon symbol="DYDX" /> */}
|
||||
<AssetIcon symbol={chainTokenLabel} />
|
||||
</Styled.label>
|
||||
<Styled.BalanceOutput type={OutputType.Asset} value={nativeTokenBalance} />
|
||||
</div>
|
||||
@ -169,22 +167,9 @@ export const AccountMenu = () => {
|
||||
onSelect: onRecoverKeys,
|
||||
separator: true,
|
||||
},
|
||||
dydxAddress && {
|
||||
value: 'CopyAddress',
|
||||
icon: <Icon iconName={IconName.Copy} />,
|
||||
label: stringGetter({ key: STRING_KEYS.COPY_ADDRESS }),
|
||||
onSelect: async () => await navigator.clipboard.writeText(dydxAddress),
|
||||
},
|
||||
// {
|
||||
// value: 'ViewInExplorer',
|
||||
// icon: <Icon iconName={IconName.Etherscan} />,
|
||||
// label: stringGetter({ key: STRING_KEYS.OPEN_IN_ETHERSCAN }),
|
||||
// onSelect: () => globalThis.open(`${mintscanBase}/address/${address}`),
|
||||
// separator: true,
|
||||
// },
|
||||
...(onboardingState === OnboardingState.AccountConnected && hdKey
|
||||
? [
|
||||
{
|
||||
!isMainnet && {
|
||||
value: 'MobileQrSignIn',
|
||||
icon: <Icon iconName={IconName.Qr} />,
|
||||
label: stringGetter({ key: STRING_KEYS.TITLE_SIGN_INTO_MOBILE }),
|
||||
@ -192,16 +177,12 @@ export const AccountMenu = () => {
|
||||
},
|
||||
{
|
||||
value: 'MnemonicExport',
|
||||
icon: (
|
||||
<span>
|
||||
<Icon iconName={IconName.ExportKeys} />
|
||||
</span>
|
||||
),
|
||||
icon: <Icon iconName={IconName.ExportKeys} />,
|
||||
label: <span>{stringGetter({ key: STRING_KEYS.EXPORT_SECRET_PHRASE })}</span>,
|
||||
highlightColor: 'negative',
|
||||
onSelect: () => dispatch(openDialog({ type: DialogTypes.MnemonicExport })),
|
||||
},
|
||||
]
|
||||
].filter(isTruthy)
|
||||
: []),
|
||||
{
|
||||
value: 'Disconnect',
|
||||
@ -333,13 +314,12 @@ Styled.label = styled.div`
|
||||
Styled.Balances = styled.div`
|
||||
${layoutMixins.flexColumn}
|
||||
|
||||
gap: 2px;
|
||||
|
||||
> div {
|
||||
${layoutMixins.spacedRow}
|
||||
box-shadow: 0 0 0 1px var(--color-border);
|
||||
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 1rem;
|
||||
padding: 0.625rem 1rem;
|
||||
|
||||
background-color: var(--color-layer-4);
|
||||
|
||||
@ -386,4 +366,10 @@ Styled.ConnectToChain = styled(Styled.Column)`
|
||||
|
||||
Styled.IconButton = styled(IconButton)`
|
||||
--button-padding: 0 0.25rem;
|
||||
--button-border: solid var(--border-width) var(--color-layer-6);
|
||||
`;
|
||||
|
||||
Styled.CopyButton = styled(CopyButton)`
|
||||
--button-padding: 0 0.25rem;
|
||||
--button-border: solid var(--border-width) var(--color-layer-6);
|
||||
`;
|
||||
|
||||
@ -81,10 +81,10 @@ const getTransferHistoryTableColumnDef = ({
|
||||
),
|
||||
renderCell: ({ fromAddress, toAddress }) => (
|
||||
<TableCell stacked>
|
||||
<CopyButton shownAsText value={fromAddress ?? undefined}>
|
||||
<CopyButton buttonType="text" value={fromAddress ?? undefined}>
|
||||
{fromAddress ? truncateAddress(fromAddress) : '-'}
|
||||
</CopyButton>{' '}
|
||||
<CopyButton shownAsText value={toAddress ?? undefined}>
|
||||
<CopyButton buttonType="text" value={toAddress ?? undefined}>
|
||||
{toAddress ? truncateAddress(toAddress) : '-'}
|
||||
</CopyButton>
|
||||
</TableCell>
|
||||
|
||||