Skip to content

Commit 1e8cd15

Browse files
committed
refactor(web): move-maintenance-button-to-top
1 parent 9fa4148 commit 1e8cd15

File tree

5 files changed

+33
-24
lines changed

5 files changed

+33
-24
lines changed

web/src/pages/Courts/CourtDetails/StakePanel/index.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import { landscapeStyle } from "styles/landscapeStyle";
1111
import Popup, { PopupType } from "components/Popup/index";
1212
import Tag from "components/Tag";
1313

14-
import StakeMaintenanceButtons from "../StakeMaintenanceButton";
15-
1614
import InputDisplay from "./InputDisplay";
1715
import JurorBalanceDisplay from "./JurorStakeDisplay";
1816
import { ActionType } from "./StakeWithdrawButton";
@@ -75,12 +73,6 @@ const ThreePnksIconContainer = styled.div`
7573
)};
7674
`;
7775

78-
const StyledStakeMtnceButtons = styled(StakeMaintenanceButtons)`
79-
position: absolute;
80-
right: 0;
81-
top: -4px;
82-
`;
83-
8476
const StakePanel: React.FC<{ courtName: string; id: string }> = ({ courtName = "General Court", id }) => {
8577
const [amount, setAmount] = useState("");
8678
const [isSending, setIsSending] = useState<boolean>(false);
@@ -98,7 +90,6 @@ const StakePanel: React.FC<{ courtName: string; id: string }> = ({ courtName = "
9890
const isStaking = action === ActionType.stake;
9991
return (
10092
<Container>
101-
<StyledStakeMtnceButtons />
10293
<LeftArea>
10394
<TagArea>
10495
<Tag text="Stake" active={isActive} onClick={() => handleClick(ActionType.stake)} />

web/src/pages/Courts/CourtDetails/StakeMaintenanceButton/index.tsx renamed to web/src/pages/Courts/StakeMaintenanceButton/index.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ const PopupContainer = styled.div`
3737
transform: translate(-100%, 100%);
3838
`;
3939

40-
const StyledDottedMenu = styled(DottedMenuButton)`
41-
.button-container {
42-
background-color: ${({ theme }) => theme.whiteBackground};
43-
}
44-
`;
45-
4640
export enum Phases {
4741
staking,
4842
generating,
@@ -76,7 +70,7 @@ const StakeMaintenanceButtons: React.FC<IStakeMaintenanceButtons> = ({ className
7670
</PopupContainer>
7771
</>
7872
) : null}
79-
<StyledDottedMenu {...{ toggle }} displayRipple={false} />
73+
<DottedMenuButton {...{ toggle }} displayRipple={false} />
8074
</Container>
8175
);
8276
};

web/src/pages/Courts/TopSearch.tsx

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useMemo } from "react";
2+
import styled from "styled-components";
23

34
import { useNavigate } from "react-router-dom";
45

@@ -8,20 +9,43 @@ import { isUndefined } from "utils/index";
89

910
import { useCourtTree, rootCourtToItems } from "queries/useCourtTree";
1011

12+
import { responsiveSize } from "styles/responsiveSize";
13+
1114
import { StyledSkeleton } from "components/StyledSkeleton";
1215

16+
import StakeMaintenanceButtons from "./StakeMaintenanceButton";
17+
18+
const Container = styled.div`
19+
width: 100%;
20+
display: flex;
21+
justify-content: space-between;
22+
align-items: center;
23+
`;
24+
25+
const StyledDropdownCascader = styled(DropdownCascader)`
26+
width: ${responsiveSize(200, 240)};
27+
> button {
28+
width: 100%;
29+
}
30+
`;
31+
1332
const TopSearch: React.FC = () => {
1433
const { data } = useCourtTree();
1534
const navigate = useNavigate();
1635
const items = useMemo(() => !isUndefined(data) && [rootCourtToItems(data.court)], [data]);
17-
return items ? (
18-
<DropdownCascader
19-
items={items}
20-
onSelect={(path: string | number) => navigate(path.toString())}
21-
placeholder="Select Court"
22-
/>
23-
) : (
24-
<StyledSkeleton width={240} height={42} />
36+
return (
37+
<Container>
38+
{items ? (
39+
<StyledDropdownCascader
40+
items={items}
41+
onSelect={(path: string | number) => navigate(path.toString())}
42+
placeholder="Select Court"
43+
/>
44+
) : (
45+
<StyledSkeleton width={240} height={42} />
46+
)}
47+
<StakeMaintenanceButtons />
48+
</Container>
2549
);
2650
};
2751

0 commit comments

Comments
 (0)