11import React from "react" ;
2- import styled , { css } from "styled-components" ;
3-
4- import { landscapeStyle } from "styles/landscapeStyle" ;
52
63import Identicon from "react-identicons" ;
74import { isAddress } from "viem" ;
@@ -11,110 +8,6 @@ import { useAccount, useChainId, useEnsAvatar, useEnsName } from "wagmi";
118import { getChain } from "consts/chains" ;
129import { shortenAddress } from "utils/shortenAddress" ;
1310
14- const Container = styled . div `
15- display: flex;
16- flex-direction: column;
17- justify-content: space-between;
18- height: auto;
19- align-items: flex-start;
20- gap: 8px;
21- align-items: center;
22- background-color: ${ ( { theme } ) => theme . whiteBackground } ;
23- padding: 0px;
24- cursor: pointer;
25-
26- &:hover {
27- label {
28- color: ${ ( { theme } ) => theme . white } !important;
29- transition: color 0.2s;
30- }
31- }
32-
33- ${ landscapeStyle (
34- ( ) => css `
35- background-color: ${ ( { theme } ) => theme . whiteLowOpacitySubtle } ;
36- &:hover {
37- transition: background-color 0.1s;
38- background-color: ${ ( { theme } ) => theme . whiteLowOpacityStrong } ;
39- }
40- flex-direction: row;
41- align-content: center;
42- border-radius: 300px;
43- gap: 0px;
44- padding: 0 12px;
45- `
46- ) }
47- ` ;
48-
49- const AccountContainer = styled . div `
50- min-height: 32px;
51- display: flex;
52- align-items: center;
53- width: fit-content;
54- gap: 8px;
55-
56- > label {
57- font-size: 16px;
58- font-weight: 600;
59- }
60-
61- ${ landscapeStyle (
62- ( ) => css `
63- gap: 12px;
64- > label {
65- color: ${ ( { theme } ) => theme . white } CC !important;
66- font-weight: 400;
67- font-size: 14px;
68- }
69- `
70- ) }
71- ` ;
72-
73- const ChainConnectionContainer = styled . div `
74- display: flex;
75- width: fit-content;
76- min-height: 32px;
77- align-items: center;
78- padding-left: 0px;
79- > label {
80- color: ${ ( { theme } ) => theme . success } ;
81- font-size: 16px;
82-
83- font-weight: 500;
84- }
85-
86- :before {
87- content: "";
88- width: 8px;
89- height: 8px;
90- margin: 0px 13px 0px 3px;
91- border-radius: 50%;
92- background-color: ${ ( { theme } ) => theme . success } ;
93- }
94-
95- ${ landscapeStyle (
96- ( ) => css `
97- display: none;
98- `
99- ) }
100- ` ;
101-
102- const StyledIdenticon = styled ( Identicon ) < { size : `${ number } ` } > `
103- align-items: center;
104- svg {
105- width: ${ ( { size } ) => size + "px" } ;
106- height: ${ ( { size } ) => size + "px" } ;
107- }
108- ` ;
109-
110- const StyledAvatar = styled . img < { size : `${ number } ` } > `
111- align-items: center;
112- object-fit: cover;
113- border-radius: 50%;
114- width: ${ ( { size } ) => size + "px" } ;
115- height: ${ ( { size } ) => size + "px" } ;
116- ` ;
117-
11811interface IIdenticonOrAvatar {
11912 size ?: `${number } `;
12013 address ?: `0x${string } `;
@@ -134,9 +27,9 @@ export const IdenticonOrAvatar: React.FC<IIdenticonOrAvatar> = ({ size = "16", a
13427 } ) ;
13528
13629 return avatar ? (
137- < StyledAvatar src = { avatar } alt = "avatar" size = { size } />
30+ < img className = "items-center object-cover rounded-[50%]" src = { avatar } alt = "avatar" width = { size } height = { size } />
13831 ) : (
139- < StyledIdenticon size = { size } string = { address } />
32+ < Identicon className = "items-center" size = { size } string = { address } />
14033 ) ;
14134} ;
14235
@@ -164,15 +57,32 @@ export const ChainDisplay: React.FC = () => {
16457
16558const AccountDisplay : React . FC = ( ) => {
16659 return (
167- < Container >
168- < AccountContainer >
60+ < div
61+ className = {
62+ "flex flex-col justify-between h-auto items-center gap-2 bg-klerosUIComponentsWhiteBackground p-0 cursor-pointer" +
63+ "hover:[&_label]:text-white hover:[&_label]:transition-colors hover:[&_label]:duration-200 landscape-900:hover:bg-white-low-opacity-strong landscape-900:hover:transition-[background-color_0.1s]" +
64+ "landscape-900:bg-white-low-opacity-subtle landscape-900:flex-row landscape-900:content-center landscape-900:rounded-[300px] landscape-900:gap-0 landscape-900:py-0 landscape-900:px-3"
65+ }
66+ >
67+ < div
68+ className = {
69+ "flex items-center gap-2 w-fit min-h-8 [&>label]:text-base [&>label]:font-semibold" +
70+ "landscape-900:gap-3 landscape-900:[&>label]:text-sm landscape-900:[&>label]:font-normal"
71+ }
72+ >
16973 < IdenticonOrAvatar size = "32" />
17074 < AddressOrName />
171- </ AccountContainer >
172- < ChainConnectionContainer >
75+ </ div >
76+ < div
77+ className = {
78+ "flex w-fit min-h-8 items-center pl-0 [&>label]:text-klerosUIComponentsSuccess [&>label]:text-base [&>label]:font-medium" +
79+ "before:content-[''] before:w-2 before:h-2 before:rounded-[50%] before:bg-klerosUIComponentsSuccess before:my-0 before:mr-[13px] before:ml-[3px]" +
80+ "landscape-900:display-none"
81+ }
82+ >
17383 < ChainDisplay />
174- </ ChainConnectionContainer >
175- </ Container >
84+ </ div >
85+ </ div >
17686 ) ;
17787} ;
17888
0 commit comments