Skip to content

Commit 0d475c0

Browse files
committed
hover icon images for buttons
1 parent 802a0ed commit 0d475c0

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed

public/icons/arrow-up-right-hover.svg

Lines changed: 3 additions & 0 deletions
Loading

public/icons/redo-hover.svg

Lines changed: 3 additions & 0 deletions
Loading

src/app/components/IconButton/index.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,29 @@
2323
color: var(--comp-icon-button-icon-clr);
2424
}
2525

26+
.default-image {
27+
display: block;
28+
}
29+
30+
.hover-image {
31+
display: none;
32+
}
33+
2634
&:hover {
2735
color: var(--comp-icon-button-hover-bg-clr);
2836
border: 1px solid var(--comp-icon-button-hover-bg-clr);
2937

3038
i {
3139
color: var(--comp-icon-button-hover-bg-clr) !important;
3240
}
41+
42+
.default-image {
43+
display: none;
44+
}
45+
46+
.hover-image {
47+
display: block;
48+
}
3349
}
3450
}
3551

src/app/components/IconButton/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ interface IconButtonProps {
1212
onClick?: () => void;
1313
iconCls?: string;
1414
imgSrc?: string;
15+
imgHoverSrc?: string;
1516
imgWidth?: number | string;
1617
imgHeight?: number | string;
1718
buttonCls?: string;
1819
buttonType?: IconButtonType;
1920
isDisabled?: boolean;
2021
}
2122

22-
const IconButton = ({ buttonLbl, onClick, iconCls = "", imgSrc = "", imgWidth = "1rem", imgHeight = "1rem", buttonCls = "",
23+
const IconButton = ({ buttonLbl, onClick, iconCls = "", imgSrc = "", imgHoverSrc = "", imgWidth = "1rem", imgHeight = "1rem", buttonCls = "",
2324
buttonType = IconButtonType.REGULAR, isDisabled = false }: IconButtonProps) => {
2425

2526
const handleClick = () => {
@@ -33,7 +34,8 @@ const IconButton = ({ buttonLbl, onClick, iconCls = "", imgSrc = "", imgWidth =
3334
<div className='comp-icon-button-wrapper'>
3435
<span className="button-lbl">{buttonLbl}</span>
3536
{iconCls && <i className={`icon ${iconCls}`} />}
36-
{imgSrc && <ImageIcon imgSrc={imgSrc} alt={buttonLbl} imgWidth={imgWidth} imgHeight={imgHeight} />}
37+
{imgSrc && <ImageIcon imgSrc={imgSrc} alt={buttonLbl} imgWidth={imgWidth} imgHeight={imgHeight} className="default-image" />}
38+
{imgHoverSrc && <ImageIcon imgSrc={imgHoverSrc} alt={buttonLbl} imgWidth={imgWidth} imgHeight={imgHeight} className="hover-image" />}
3739
</div>
3840
</div>);
3941
}

src/app/components/ImageIcon/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ interface IImageIconProps {
77
alt: string;
88
imgWidth?: number | string;
99
imgHeight?: number | string;
10+
className?: string;
1011
}
1112

12-
const ImageIcon = ({ imgSrc, alt, imgWidth = "1rem", imgHeight = "1rem" }: IImageIconProps) => {
13-
return <div className="comp-image-icon" style={{ width: imgWidth, height: imgHeight }} >
13+
const ImageIcon = ({ imgSrc, alt, imgWidth = "1rem", imgHeight = "1rem", className = "" }: IImageIconProps) => {
14+
return <div className={`comp-image-icon ${className}`} style={{ width: imgWidth, height: imgHeight }} >
1415
<Image src={imgSrc} alt={alt} fill />
1516
</div>
1617
}

src/app/page-components/PgMainHeader/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,11 @@ const PgMainHeader = () => {
210210
buttonCls="header-run-btn" onClick={handleRunQuery} buttonType={IconButtonType.SUCCESS} isDisabled={isRunButtonDisabled} />
211211
<IconButton buttonLbl={labels.buttonReset}
212212
imgSrc='/icons/redo.svg' imgWidth="1.25rem" imgHeight="1.25rem"
213+
imgHoverSrc='/icons/redo-hover.svg'
213214
buttonCls="header-reset-btn" onClick={handleResetQuery} />
214215
<IconButton buttonLbl={labels.buttonShare}
215216
imgSrc='/icons/arrow-up-right.svg' imgWidth="1.25rem" imgHeight="1.25rem"
217+
imgHoverSrc='/icons/arrow-up-right-hover.svg'
216218
buttonCls="header-share-btn" onClick={handleShareQuery} />
217219
</div>
218220
</div>

0 commit comments

Comments
 (0)