Skip to content

Commit ffa314a

Browse files
committed
chore: move styling of LogResizeButton to common
1 parent 5ca7c73 commit ffa314a

File tree

2 files changed

+40
-26
lines changed

2 files changed

+40
-26
lines changed

src/Shared/Components/CICDHistory/History.components.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ import './cicdHistory.scss'
3131
export const LogResizeButton = withShortcut(
3232
({ fullScreenView, setFullScreenView, shortcut }: LogResizeButtonType & IWithShortcut): JSX.Element => {
3333
const { pathname } = useLocation()
34-
const zoomButtonRef = useRef<HTMLDivElement>(null)
34+
const isFullscreenViewRef = useRef(fullScreenView)
35+
isFullscreenViewRef.current = fullScreenView
3536

3637
const toggleFullScreen = (): void => {
3738
// NOTE: need to use ref due to the problem of stale function reference after registering the callback
38-
setFullScreenView(!(zoomButtonRef.current.dataset.isFullscreenView === 'true'))
39+
setFullScreenView(!isFullscreenViewRef.current)
3940
}
4041

4142
useEffect(() => {
@@ -62,14 +63,18 @@ export const LogResizeButton = withShortcut(
6263
combo: ['F'] as const,
6364
}}
6465
>
65-
<div
66-
ref={zoomButtonRef}
67-
data-is-fullscreen-view={fullScreenView}
68-
className={`zoom ${fullScreenView ? 'zoom--out' : 'zoom--in'} pointer dc__zi-4 flex`}
66+
<button
67+
type="button"
68+
aria-label="Enter/Exit fullscreen view"
69+
className="zoom dc__zi-4 flex dc__transparent log-resize-button"
6970
onClick={toggleFullScreen}
7071
>
71-
{fullScreenView ? <ZoomOut className="icon-dim-16" /> : <ZoomIn className="icon-dim-16" />}
72-
</div>
72+
{fullScreenView ? (
73+
<ZoomOut className="icon-dim-16 dc__no-shrink" />
74+
) : (
75+
<ZoomIn className="icon-dim-16 dc__no-shrink" />
76+
)}
77+
</button>
7378
</Tooltip>
7479
)
7580
)

src/Shared/Components/CICDHistory/cicdHistory.scss

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,6 @@
3737
position: absolute;
3838
bottom: 12px;
3939
right: 12px;
40-
transition: top 0.3s;
41-
padding: 6px;
42-
width: 32px;
43-
height: 32px;
44-
border-radius: 4px;
45-
box-shadow:
46-
0 0 4px 0 rgba(0, 10, 20, 0.5),
47-
0 0 4px 0 rgba(0, 10, 20, 0.5);
48-
background-color: #2c3354;
49-
opacity: 0.8;
50-
51-
&:hover {
52-
opacity: 1;
53-
}
5440
}
5541

5642
.ci-details__history {
@@ -110,10 +96,6 @@
11096
transition: height 0.3s;
11197
}
11298
}
113-
114-
.zoom {
115-
transition: top 0.3s;
116-
}
11799
}
118100
}
119101

@@ -294,3 +276,30 @@
294276
width: min(100%, 800px);
295277
}
296278
}
279+
280+
.log-resize-button {
281+
transition: opacity 0.2s ease-in-out;
282+
padding: 6px;
283+
width: 32px;
284+
height: 32px;
285+
border-radius: 4px;
286+
box-shadow:
287+
0 0 4px 0 rgba(0, 10, 20, 0.5),
288+
0 0 4px 0 rgba(0, 10, 20, 0.5);
289+
background-color: #2c3354;
290+
opacity: 0.8;
291+
z-index: 11;
292+
293+
& > svg {
294+
transition: transform 0.2s ease-in-out;
295+
transform: scale(1);
296+
}
297+
298+
&:hover {
299+
opacity: 1;
300+
301+
& > svg {
302+
transform: scale(1.1);
303+
}
304+
}
305+
}

0 commit comments

Comments
 (0)