Skip to content

Commit bab705b

Browse files
committed
Add hover effect to button
1 parent 535f47b commit bab705b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/shared/button/Button.modules.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@
66
border: none;
77
border-radius: 5px;
88
cursor: pointer;
9-
}
109

11-
.disabled {
12-
cursor: not-allowed;
13-
opacity: 0.6;
10+
&:hover {
11+
&:not([disabled]) {
12+
background-color: #0056b3;
13+
}
14+
}
15+
16+
&:disabled {
17+
cursor: not-allowed;
18+
opacity: 0.6;
19+
}
1420
}

src/shared/button/Button.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { ReactNode, MouseEvent } from 'react';
2-
import cn from 'clsx';
32
import s from './Button.modules.scss';
43

54
type ButtonProps = {
@@ -9,7 +8,7 @@ type ButtonProps = {
98
};
109

1110
export const Button = ({ children, onClick, disabled = false }: ButtonProps) => (
12-
<button className={cn(s.button, { [s.disabled]: disabled })} onClick={onClick}>
11+
<button className={s.button} onClick={onClick} disabled={disabled}>
1312
{children}
1413
</button>
1514
);

0 commit comments

Comments
 (0)