Skip to content

Commit db67b55

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

File tree

3 files changed

+38
-24
lines changed

3 files changed

+38
-24
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/stories/Manchette.stories.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const ManchetteWithWaypointMenu = () => {
7474
}))}
7575
zoomYIn={() => {}}
7676
zoomYOut={() => {}}
77+
resetZoom={() => {}}
7778
toggleMode={() => {}}
7879
activeOperationalPointId={activeOperationalPointId}
7980
>

ui-manchette/src/styles/manchette.css

+27-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
.manchette-container {
22
.manchette-actions {
3+
align-items: center;
34
background-color: rgba(250, 249, 245, 0.6);
5+
border-top: solid 1px;
6+
border-right: solid 1px;
7+
border-radius: 0 0 0 10px;
8+
@apply border-black-25;
9+
display: flex;
410
height: 2.5rem;
511
width: inherit;
612
position: sticky;
@@ -9,17 +15,29 @@
915
width: 100%;
1016
backdrop-filter: blur(8px);
1117
-webkit-backdrop-filter: blur(8px);
12-
border-top: solid 1px;
13-
border-right: solid 1px;
14-
@apply border-black-25;
15-
border-radius: 0px 0px 0px 10px;
1618

17-
.zoom-out:disabled {
18-
opacity: 0.4;
19-
}
2019

21-
.zoom-in:disabled {
22-
opacity: 0.4;
20+
.zoom-buttons {
21+
display: flex;
22+
align-items: center;
23+
height: 100%;
24+
25+
button {
26+
border-right: solid 1px theme('colors.grey.20');
27+
border-top: solid 1px white;
28+
height: 100%;
29+
padding-inline: 12px;
30+
}
31+
32+
button:disabled {
33+
@apply text-grey-30;
34+
}
35+
36+
.zoom-reset {
37+
@apply text-grey-50;
38+
font-weight: 600;
39+
font-size: 14px;
40+
}
2341
}
2442

2543
.toggle-mode {

0 commit comments

Comments
 (0)