Skip to content

Commit 06a60f6

Browse files
committed
btnClass working
1 parent e8ee9e7 commit 06a60f6

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

.DS_Store

0 Bytes
Binary file not shown.

firstapp/src/Components/Cockpit/Cockpit.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React from 'react';
22
import styles from './Cockpit.module.css';
3+
import Aux from '../../hoc/Aux';
34
const cockpit = (props) => {
45

56
const assignedClasses = [];
6-
let btnClass = '';
7+
let btnClass = styles.Button;
78
if(props.showPersons){
89

9-
btnClass = styles.Button;
10+
1011
console.log('btnclass', btnClass);
1112
if (props.showPersons) {
1213

@@ -25,14 +26,14 @@ const cockpit = (props) => {
2526
}
2627

2728
return(
28-
<div>
29+
<Aux>
2930
<h1>tekstiä</h1>
3031
<p className={assignedClasses.join(' ')}>lisää tekstiä</p>
3132

3233
<button
3334
className={btnClass}
34-
onClick={props.clicked}>Toggle Persons</button>
35-
</div>
35+
onClick={props.clicked}> Toggle Persons </button>
36+
</Aux>
3637
)
3738
};
3839
export default cockpit;

firstapp/src/Components/Cockpit/Cockpit.module.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
font-weight: bold;
88
}
99

10-
.Button button {
10+
.Button {
1111
border: 1px solid blue;
1212
padding: 16px;
1313
background-color: green;
@@ -16,16 +16,16 @@
1616
cursor: pointer;
1717
}
1818

19-
.Button button:hover {
19+
.Button:hover {
2020
background-color: lightgreen;
2121
color: black;
2222
}
2323

24-
.Button button.Red {
24+
.Button.Red {
2525
background-color: red;
2626
}
2727

28-
.Button button.Red:hover {
28+
.Button.Red:hover {
2929
background-color: salmon;
3030
color: black;
3131
}

0 commit comments

Comments
 (0)