Skip to content

Commit b181518

Browse files
committed
ui-manchette: add fit button
Signed-off-by: Clara Ni <[email protected]>
1 parent 7022497 commit b181518

File tree

2 files changed

+50
-36
lines changed

2 files changed

+50
-36
lines changed

ui-manchette/src/components/Manchette.tsx

+10-15
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type ManchetteProps = {
1212
activeOperationalPointId?: string;
1313
zoomYIn: () => void;
1414
zoomYOut: () => void;
15+
resetZoom: () => void;
1516
height?: number;
1617
yZoom?: number;
1718
children?: React.ReactNode;
@@ -22,6 +23,7 @@ type ManchetteProps = {
2223
const Manchette = ({
2324
zoomYIn,
2425
zoomYOut,
26+
resetZoom,
2527
yZoom = 1,
2628
operationalPoints,
2729
activeOperationalPointId,
@@ -31,7 +33,7 @@ const Manchette = ({
3133
}: ManchetteProps) => (
3234
<div className="manchette-container">
3335
<div
34-
className=" bg-ambientB-10 border-r border-grey-30"
36+
className="bg-ambientB-10 border-r border-grey-30"
3537
style={{ minHeight: `${INITIAL_OP_LIST_HEIGHT}px` }}
3638
>
3739
<OperationalPointList
@@ -40,24 +42,17 @@ const Manchette = ({
4042
/>
4143
{children}
4244
</div>
43-
<div className="manchette-actions flex items-center">
44-
<div className=" flex items-center ">
45-
<button
46-
className="h-full px-3 w-full zoom-out"
47-
onClick={zoomYOut}
48-
disabled={yZoom <= MIN_ZOOM_Y}
49-
>
45+
<div className="manchette-actions">
46+
<div className="zoom-buttons">
47+
<button className="zoom-out" onClick={zoomYOut} disabled={yZoom <= MIN_ZOOM_Y}>
5048
<ZoomOut />
5149
</button>
52-
</div>
53-
<div className=" flex items-center border-x border-black-25 h-full">
54-
<button
55-
className="h-full px-3 w-full zoom-in"
56-
disabled={yZoom >= MAX_ZOOM_Y}
57-
onClick={zoomYIn}
58-
>
50+
<button className="zoom-in" onClick={zoomYIn} disabled={yZoom >= MAX_ZOOM_Y}>
5951
<ZoomIn />
6052
</button>
53+
<button className="zoom-reset" onClick={resetZoom}>
54+
Fit
55+
</button>
6156
</div>
6257
<div className="flex items-center ml-auto text-sans font-semibold">
6358
<button className="toggle-mode" onClick={toggleMode}>

ui-manchette/src/styles/manchette.css

+40-21
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,51 @@
11

22
.manchette-container {
3+
.manchette-actions {
4+
align-items: center;
5+
background-color: rgba(250, 249, 245, 0.6);
6+
border-top: solid 1px;
7+
border-right: solid 1px;
8+
border-radius: 0px 0px 0px 10px;
9+
@apply border-black-25;
10+
display: flex;
11+
height: 2.5rem;
12+
width: inherit;
13+
position: sticky;
14+
bottom: 0;
15+
left: 0;
16+
width: 100%;
17+
backdrop-filter: blur(8px);
18+
-webkit-backdrop-filter: blur(8px);
319

4-
.manchette-actions {
5-
background-color: rgba(250, 249, 245, 0.6);
6-
height: 2.5rem;
7-
width: inherit;
8-
position: sticky;
9-
bottom: 0;
10-
left: 0;
11-
width: 100%;
12-
backdrop-filter: blur(8px);
13-
-webkit-backdrop-filter: blur(8px);
14-
border-top: solid 1px;
15-
border-right: solid 1px;
16-
@apply border-black-25;
17-
border-radius: 0px 0px 0px 10px;
1820

19-
.zoom-out:disabled {
20-
opacity: 0.4;
21+
.zoom-buttons {
22+
display: flex;
23+
align-items: center;
24+
height: 100%;
25+
26+
button {
27+
border-right: solid 1px #d3d1cf;
28+
border-top: solid 1px white;
29+
height: 100%;
30+
padding-inline: 12px;
2131
}
2232

23-
.zoom-in:disabled {
24-
opacity: 0.4;
33+
button:disabled {
34+
span {
35+
color: #B6B2AF
36+
}
2537
}
2638

27-
.toggle-mode{
28-
font-size: 0.875rem;
29-
line-height: 14px;
39+
.zoom-reset {
40+
color: #797671;
41+
font-weight: 600;
42+
font-size: 14px;
3043
}
3144
}
45+
46+
.toggle-mode{
47+
font-size: 0.875rem;
48+
line-height: 14px;
49+
}
3250
}
51+
}

0 commit comments

Comments
 (0)