Skip to content

Commit c0eec95

Browse files
committed
add some more basic styles for the demos:
1 parent 00079a6 commit c0eec95

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

src/features/counter/Counter.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useDispatch, useSelector } from "react-redux";
33
import { RootState } from "../../app/rootReducer";
44
import { increment, decrement, incrementByAmount } from "./counterSlice";
55
import Button from "../../components/Button";
6+
import styles from "./styles.module.scss";
67

78
// Define a counter component that uses the redux state and actions
89
const Counter: React.FC = () => {
@@ -46,13 +47,20 @@ const Counter: React.FC = () => {
4647

4748
// Return the JSX element for the counter component
4849
return (
49-
<div>
50+
<div className={styles.container}>
5051
<h1>Counter</h1>
51-
<p>The current counter value is {counter}</p>
52-
<Button onClick={handleIncrement}>Increment</Button>
53-
<Button onClick={handleDecrement}>Decrement</Button>
54-
<input value={incrementAmount} onChange={handleIncrementAmountChange} />
55-
<Button onClick={handleIncrementByAmount}>Increment by amount</Button>
52+
<div>
53+
<p>
54+
The current counter value is{" "}
55+
<span className={styles.counterValue}>{counter}</span>
56+
</p>
57+
<Button onClick={handleIncrement}>Increment</Button>
58+
<Button onClick={handleDecrement}>Decrement</Button>
59+
</div>
60+
<div>
61+
<input value={incrementAmount} onChange={handleIncrementAmountChange} />
62+
<Button onClick={handleIncrementByAmount}>Increment by amount</Button>
63+
</div>
5664
</div>
5765
);
5866
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@import '/src/theme/colors.scss';
2+
3+
.container {
4+
display: flex;
5+
flex-direction: column;
6+
7+
.counterValue {
8+
display: inline-flex;
9+
font-size: 42px;
10+
background: $theme-accent;
11+
padding: 10px 25px;
12+
font-weight: bold;
13+
}
14+
}

src/pages/Home.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ const Home: React.FC = () => {
3737
(scss modules).
3838
</p>
3939
</div>
40-
<Counter />
41-
<TodoList />
40+
<div className={styles.demoContainer}>
41+
<div>
42+
<Counter />
43+
</div>
44+
<div>
45+
<TodoList />
46+
</div>
47+
</div>
4248
</div>
4349
);
4450
};

src/pages/styles/home.module.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,15 @@
3434
padding: 0 69px;
3535
}
3636
}
37+
38+
.demoContainer {
39+
display: flex;
40+
flex-direction: row;
41+
width: 100%;
42+
43+
div {
44+
flex: 1;
45+
padding: 25px;
46+
}
47+
}
3748
}

0 commit comments

Comments
 (0)