Skip to content

Commit 2be3123

Browse files
committed
SD-34: Rework shielder ui
1 parent 54cf423 commit 2be3123

File tree

77 files changed

+2870
-875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2870
-875
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ dist
88
*.local
99

1010
.env
11+
12+
.qodo

package-lock.json

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"motion": "^12.4.12",
3737
"react": "^19.0.0",
3838
"react-dom": "^19.0.0",
39+
"react-merge-refs": "^2.1.1",
40+
"rooks": "^8.0.0",
3941
"sonner": "^2.0.2",
4042
"styled-components": "^6.1.15",
4143
"styled-reset": "^4.5.2",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import styled from 'styled-components';
2+
3+
import getChainConfigById from 'src/domains/chains/utils/getChainConfigById';
4+
import vars from 'src/domains/styling/utils/vars.ts';
5+
6+
type Props = {
7+
chainId: number | string,
8+
size?: number,
9+
className?: string,
10+
};
11+
const ChainIcon = ({ chainId, size = 16, className }: Props) => {
12+
const { ChainIcon } = getChainConfigById(chainId);
13+
14+
return (
15+
<Container style={{ height: size, width: size, borderRadius: size * 0.25 }} className={className}>
16+
<ChainIcon />
17+
</Container>
18+
);
19+
};
20+
21+
export default ChainIcon;
22+
23+
const Container = styled.div`
24+
display: grid;
25+
place-items: center;
26+
border: 1px solid ${vars('--color-neutral-foreground-1-rest')};
27+
color: ${vars('--color-neutral-foreground-1-rest')};
28+
29+
svg {
30+
height: 100%;
31+
width: 100%
32+
}
33+
`;
Lines changed: 4 additions & 18 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,72 @@
1-
import styled, { css, type RuleSet } from 'styled-components';
1+
import styled, { css } from 'styled-components';
22

3+
import ChainIcon from 'src/domains/chains/components/ChainIcon.tsx';
34
import CIcon from 'src/domains/misc/components/CIcon';
45
import vars from 'src/domains/styling/utils/vars';
56

6-
type Size = 'extra-small' | 'small' | 'medium' | 'large';
7-
87
type Props = {
98
type: 'public' | 'shielded',
10-
size: Size,
9+
size: number,
1110
className?: string,
1211
withBorder?: boolean,
12+
chainId?: string | number,
1313
};
1414

15-
const AccountTypeIcon = ({ type, size, className, withBorder }: Props) => (
16-
<IconWrapper className={className} $size={size} $withBorder={withBorder}>
17-
<CIcon
18-
icon={type === 'public' ? 'PersonFilled' : 'ShieldedFilled'}
19-
size={ICON_SIZE[size]}
20-
/>
21-
</IconWrapper>
15+
const AccountTypeIcon = ({ type, size, className, withBorder, chainId }: Props) => (
16+
<Wrapper>
17+
<IconWrapper className={className} $size={size} $withBorder={withBorder}>
18+
<CIcon
19+
icon={type === 'public' ? 'PersonFilled' : 'ShieldedFilled'}
20+
size={size / 1.6}
21+
/>
22+
</IconWrapper>
23+
{chainId && (
24+
<ChainIconWrapper>
25+
<ChainIcon chainId={chainId} />
26+
</ChainIconWrapper>
27+
)}
28+
</Wrapper>
2229
);
2330

2431
export default styled(AccountTypeIcon)``;
2532

26-
const ICON_SIZE = {
27-
'extra-small': 12,
28-
small: 16,
29-
medium: 16,
30-
large: 20,
31-
} satisfies Record<Size, number>;
33+
const IconWrapper = styled.div<{ $size: number, $withBorder?: boolean }>`
34+
display: grid;
3235
33-
const perSize = <T extends string | RuleSet>(sizes: Record<Size, T>) =>
34-
({ $size }: { $size: Size }) => sizes[$size];
36+
position: relative;
3537
36-
const IconWrapper = styled.div<{ $size: Size, $withBorder?: boolean }>`
37-
display: grid;
3838
place-items: center;
39+
40+
height: ${({ $size }) => `${$size}px`};
41+
width: ${({ $size }) => `${$size}px`};
42+
43+
3944
color: ${vars('--color-neutral-foreground-static-rest')};
45+
46+
47+
4048
border-radius: ${vars('--border-radius-circular')};
4149
background: linear-gradient(135deg, #cce0ff 0%, #6fa1eb 100%);
42-
50+
51+
52+
4353
${({ $withBorder }) => $withBorder && css`
4454
border: 1px solid ${vars('--color-neutral-stroke-subtle-rest')};
4555
`}
46-
47-
${perSize({
48-
'extra-small': css`
49-
height: 16px;
50-
width: 16px;
51-
`,
52-
small: css`
53-
height: 20px;
54-
width: 20px;
55-
`,
56-
medium: css`
57-
height: 24px;
58-
width: 24px;
59-
`,
60-
large: css`
61-
height: 32px;
62-
width: 32px;
63-
`,
64-
})}
56+
`;
57+
58+
const ChainIconWrapper = styled.div`
59+
position: absolute;
60+
right: calc(${vars('--spacing-xxs')} * -1);
61+
bottom: calc(${vars('--spacing-xxs')} * -1);
62+
63+
padding: ${vars('--spacing-xxs')};
64+
65+
border-radius: ${vars('--border-radius-s-nudge-2')};
66+
background: inherit;
67+
`;
68+
69+
const Wrapper = styled.div`
70+
position: relative;
71+
background: inherit;
6572
`;

src/domains/misc/components/CIcon/icons.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import ArrowDownload from './icons/arrowDownload.svg?react';
1414
import ArrowImport from './icons/arrowImport.svg?react';
1515
import ArrowRight from './icons/arrowRight.svg?react';
1616
import ArrowSort from './icons/arrowSort.svg?react';
17+
import ArrowTurnDownLeft from './icons/arrowTurnDownLeft.svg?react';
1718
import ArrowUpRight from './icons/arrowUpRight.svg?react';
1819
import ArrowUpRightRegular from './icons/arrowUpRightRegular.svg?react';
1920
import Azero from './icons/azero.svg?react';
@@ -48,6 +49,7 @@ import Lock from './icons/lock.svg?react';
4849
import MoreVertical from './icons/moreVertical.svg?react';
4950
import Network from './icons/network.svg?react';
5051
import Open from './icons/open.svg?react';
52+
import Pencil from './icons/pencil.svg?react';
5153
import PersonFeedback from './icons/personFeedback.svg?react';
5254
import PersonFilled from './icons/personFilled.svg?react';
5355
import Power from './icons/power.svg?react';
@@ -82,6 +84,7 @@ export const icons = {
8284
ArrowImport,
8385
ArrowRight,
8486
ArrowSort,
87+
ArrowTurnDownLeft,
8588
ArrowUpRight,
8689
ArrowUpRightRegular,
8790
Azero,
@@ -116,6 +119,7 @@ export const icons = {
116119
MoreVertical,
117120
Network,
118121
Open,
122+
Pencil,
119123
PersonFeedback,
120124
PersonFilled,
121125
Power,
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)