Skip to content

Commit 38cdf41

Browse files
Ivan SemochkinIvan Semochkin
authored andcommitted
update layout
1 parent f3b1d3d commit 38cdf41

File tree

6 files changed

+46
-35
lines changed

6 files changed

+46
-35
lines changed

src/app.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,5 @@ body.light {
170170
--bg-player: hsl(240, 10%, 30%);
171171
--bg-wall: hsla(0, 0%, 55%, 1);
172172

173-
174173
--bg-nav: hsl(240, 10%, 30%, 1);
175174
}

src/lib/Components/AlgoSelect.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,16 @@
4040
<style>
4141
.wrapper {
4242
height: 100%;
43-
min-width: 160px;
43+
grid-area: select;
44+
/* max-width: 160px; */
45+
width: 100%;
4446
display: flex;
4547
justify-content: center;
4648
align-items: center;
4749
font-size: 24px;
4850
color: white;
4951
position: relative;
5052
font-weight: bold;
51-
border: 2px solid var(--bg-body);
52-
border-top: none;
53-
border-left: none;
5453
}
5554
5655
ul {

src/lib/Components/Player.svelte

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import { player, cancelFunction } from '$lib/stores/player';
2121
import { history, trackAtTheEnd } from '$lib/stores/history';
2222
import { algorithms } from '$lib/algorithms';
23+
import AlgoSelect from './AlgoSelect.svelte';
2324
2425
const playAlgorithm = async () => {
2526
const drawShortestPath = async (node: Node | undefined): Promise<void> => {
@@ -241,32 +242,37 @@
241242
style="--height:{$layout.player.height}px;--width:{$layout.player.width}px;"
242243
id="player"
243244
>
245+
<AlgoSelect />
244246
<Tools />
245247
<Controls {playAlgorithm} />
246248
</div>
247249

248250
<style>
249251
.wrapper {
250252
transition: background-color ease-in-out 0.5s;
251-
252253
position: absolute;
253254
left: 0;
254255
bottom: 0;
255256
height: var(--height);
256257
min-height: var(--height);
257-
width: var(--width);
258+
width: 100%;
258259
background-color: var(--bg-player);
259-
display: flex;
260-
flex-direction: column;
261-
justify-content: center;
260+
261+
display: grid;
262+
grid-template-columns: 1fr 1fr;
263+
grid-template-rows: 1fr 1fr;
264+
grid-template-areas: 'select tools' 'controls controls';
262265
gap: 10px;
266+
padding-bottom: 10px;
263267
}
264268
265-
/* @media (min-width: 1024px) {
269+
@media (min-width: 1024px) {
266270
.wrapper {
267271
left: 0;
268-
width: 576px;
272+
grid-template-columns: 1fr 1fr 1fr;
273+
grid-template-rows: 1fr;
274+
grid-template-areas: 'select controls tools';
269275
height: var(--height);
270276
}
271-
} */
277+
}
272278
</style>

src/lib/Components/PlayerControls/Controls.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@
5757

5858
<style>
5959
.wrapper {
60-
flex: 1;
61-
width: 100%;
60+
/* width: 100%; */
61+
grid-area: controls;
6262
display: flex;
6363
justify-content: center;
6464
align-items: center;
@@ -74,7 +74,6 @@
7474
align-items: center;
7575
border: none;
7676
color: inherit;
77-
font-size: 32px;
7877
}
7978
8079
button.disabled:hover {
@@ -88,7 +87,7 @@
8887
8988
.play {
9089
color: white;
91-
font-size: 68px;
90+
font-size: 64px;
9291
}
9392
9493
.play:hover {

src/lib/Components/Tools.svelte

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
<script lang="ts">
2-
import AlgoSelect from '$lib/Components/AlgoSelect.svelte';
32
import Wall from '$lib/Components/Tools/Wall.svelte';
43
import Weight from '$lib/Components/Tools/Weight.svelte';
54
import Reset from '$lib/Components/Tools/Reset.svelte';
65
</script>
76

87
<div class="wrapper">
9-
<AlgoSelect />
10-
<div class="tools">
11-
<Weight name="weight" />
12-
<Wall name="wall" />
13-
<Reset name="reset" />
14-
</div>
8+
<Weight name="weight" />
9+
<Wall name="wall" />
10+
<Reset name="reset" />
1511
</div>
1612

1713
<style>
1814
.wrapper {
19-
flex: 0.8;
15+
/* flex: 0.8; */
2016
display: flex;
21-
justify-content: space-between;
17+
justify-content: center;
18+
align-items: center;
19+
gap: 10px;
2220
}
2321
24-
.tools {
25-
flex: 1;
22+
.wrapper {
23+
grid-area: tools;
2624
height: 100%;
27-
width: 100%;
25+
/* width: 100%; */
2826
display: flex;
2927
align-items: center;
3028
justify-content: space-evenly;

src/lib/stores/layout.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,26 @@ const createLayoutStore = () => {
3535
};
3636

3737
const getPlayerLayout = (screenHeight: number, screenCols: number, screenRows: number) => {
38-
let playerRows;
38+
let playerRows = 4;
3939
let playerCols;
4040

4141
const emptyVerticalSpace = (screenHeight % 32) - 1;
4242

43-
if (screenRows <= 22) {
44-
playerRows = 4;
45-
} else {
46-
playerRows = 6;
47-
}
43+
console.log('screenRows', screenRows);
44+
45+
// if (screenRows <= 22) {
46+
// playerRows = 4;
47+
// } else if (screenRows <= 35) {
48+
// playerRows = 2;
49+
// } else {
50+
// playerRows = 4
51+
// }
52+
53+
// if (screenRows <= 22) {
54+
// playerRows = 4;
55+
// } else {
56+
// playerRows = 4;
57+
// }
4858

4959
if (screenCols <= 30) {
5060
playerCols = screenCols;

0 commit comments

Comments
 (0)