Skip to content

Commit d56ea9b

Browse files
authored
Remove custom styles from popover on 'all accounts page' (#1116)
1 parent 9a1daa4 commit d56ea9b

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

src/apps/popup/pages/all-accounts/content.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export const AllAccountsContent = () => {
9494
accountsInfo={accountsInfo}
9595
accountLiquidBalance={accountLiquidBalance}
9696
isLoadingBalance={isLoadingBalance}
97+
isAllAccountsPage={true}
9798
/>
9899
);
99100
}}

src/libs/ui/components/account-list/account-list-item.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ interface AccountListItemProps {
5959
accountsInfo: Record<string, IAccountInfo> | undefined;
6060
accountLiquidBalance: string | undefined;
6161
isLoadingBalance: boolean;
62+
isAllAccountsPage?: boolean;
6263
}
6364

6465
export const AccountListItem = ({
@@ -70,7 +71,8 @@ export const AccountListItem = ({
7071
closeModal,
7172
accountsInfo,
7273
accountLiquidBalance,
73-
isLoadingBalance
74+
isLoadingBalance,
75+
isAllAccountsPage = false
7476
}: AccountListItemProps) => {
7577
const popoverParentRef = useRef<HTMLDivElement | null>(null);
7678

@@ -137,6 +139,7 @@ export const AccountListItem = ({
137139
showHideAccountItem={showHideAccountItem}
138140
onClick={closeModal}
139141
popoverParentRef={popoverParentRef}
142+
isAllAccountsPage={isAllAccountsPage}
140143
/>
141144
</AlignedSpaceBetweenFlexRow>
142145
</ListItemContainer>

src/libs/ui/components/account-popover/account-popover.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ interface AccountActionsMenuPopoverProps {
3535
onClick?: (e: React.MouseEvent) => void;
3636
showHideAccountItem?: boolean;
3737
popoverParentRef: React.MutableRefObject<HTMLDivElement | null>;
38+
isAllAccountsPage?: boolean;
3839
}
3940
export const AccountActionsMenuPopover = ({
4041
account,
4142
onClick,
4243
showHideAccountItem,
43-
popoverParentRef
44+
popoverParentRef,
45+
isAllAccountsPage = false
4446
}: AccountActionsMenuPopoverProps) => {
4547
const [isOpen, setIsOpen] = useState(false);
4648

@@ -59,6 +61,7 @@ export const AccountActionsMenuPopover = ({
5961
return (
6062
<Popover
6163
popoverParentRef={popoverParentRef}
64+
isAllAccountsPage={isAllAccountsPage}
6265
isOpen={isOpen}
6366
setIsOpen={setIsOpen}
6467
content={() => (
@@ -80,7 +83,7 @@ export const AccountActionsMenuPopover = ({
8083
marginRight="medium"
8184
color="contentDisabled"
8285
/>
83-
<Typography type="body">
86+
<Typography type="body" color="contentPrimary">
8487
<Trans t={t}>Disconnect</Trans>
8588
</Typography>
8689
</PopoverLink>
@@ -104,7 +107,7 @@ export const AccountActionsMenuPopover = ({
104107
marginRight="medium"
105108
color="contentDisabled"
106109
/>
107-
<Typography type="body">
110+
<Typography type="body" color="contentPrimary">
108111
<Trans t={t}>Connect</Trans>
109112
</Typography>
110113
</PopoverLink>
@@ -126,7 +129,7 @@ export const AccountActionsMenuPopover = ({
126129
marginRight="medium"
127130
color="contentDisabled"
128131
/>
129-
<Typography type="body">
132+
<Typography type="body" color="contentPrimary">
130133
<Trans t={t}>Rename</Trans>
131134
</Typography>
132135
</PopoverLink>
@@ -141,7 +144,7 @@ export const AccountActionsMenuPopover = ({
141144
marginRight="medium"
142145
color="contentDisabled"
143146
/>
144-
<Typography type="body">
147+
<Typography type="body" color="contentPrimary">
145148
<Trans t={t}>View on CSPR.live</Trans>
146149
</Typography>
147150
</PopoverLink>
@@ -163,7 +166,7 @@ export const AccountActionsMenuPopover = ({
163166
marginRight="medium"
164167
color="contentDisabled"
165168
/>
166-
<Typography type="body">
169+
<Typography type="body" color="contentPrimary">
167170
{account.hidden ? (
168171
<Trans t={t}>Show in list</Trans>
169172
) : (
@@ -189,7 +192,7 @@ export const AccountActionsMenuPopover = ({
189192
marginRight="medium"
190193
color="contentDisabled"
191194
/>
192-
<Typography type="body">
195+
<Typography type="body" color="contentPrimary">
193196
<Trans t={t}>Manage</Trans>
194197
</Typography>
195198
</PopoverLink>

src/libs/ui/components/popover/popover.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ interface PopoverProps {
77
children: JSX.Element;
88
isOpen: boolean;
99
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
10+
isAllAccountsPage?: boolean;
1011
}
1112

1213
export function Popover({
1314
content,
1415
children,
1516
popoverParentRef,
1617
isOpen,
17-
setIsOpen
18+
setIsOpen,
19+
isAllAccountsPage = false
1820
}: PropsWithChildren<PopoverProps>) {
1921
useEffect(() => {
2022
// Get the container with class "ms-container"
@@ -48,11 +50,17 @@ export function Popover({
4850
isOpen={isOpen}
4951
onClickOutside={() => setIsOpen(false)}
5052
positions={['bottom', 'top']}
51-
containerStyle={{
52-
zIndex: '15'
53-
}}
54-
transform={{ top: 55, left: 135 }}
55-
parentElement={popoverParentRef.current || undefined}
53+
containerStyle={
54+
isAllAccountsPage
55+
? undefined
56+
: {
57+
zIndex: '15'
58+
}
59+
}
60+
transform={isAllAccountsPage ? undefined : { top: 55, left: 135 }}
61+
parentElement={
62+
isAllAccountsPage ? undefined : popoverParentRef.current || undefined
63+
}
5664
content={content}
5765
>
5866
{children}

0 commit comments

Comments
 (0)