Skip to content

Commit 6034b2c

Browse files
Ivan SemochkinIvan Semochkin
Ivan Semochkin
authored and
Ivan Semochkin
committed
update selects
1 parent b5ea5a3 commit 6034b2c

File tree

6 files changed

+57
-52
lines changed

6 files changed

+57
-52
lines changed

src/app.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ body {
164164
--bg-wall-tool: var(--bg-wall);
165165

166166

167-
--bg-select: hsl(0, 0%, 3%);
167+
--bg-select: var(--bg-body);
168168
--bg-tool-border: #F0E8F4;
169-
--select-active: hsl(215, 80%, 35%);
169+
--select-active: var(--bg-path);
170170

171-
--color-weight: hsl(218, 13%, 88%);
172-
--color-player: hsl(210, 19%, 73%);
173-
--color-nav: hsl(0, 19%, 95%);
171+
--color-weight: #F0E8F4;
172+
--color-player: #F0E8F4;
173+
--color-nav: #F0E8F4;
174174
}
175175

176176
body.dark {

src/lib/Components/AlgoSelect.svelte

+18-16
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
player.reset();
2121
grid.reset($layout.screen);
2222
};
23-
24-
// <div class="current">
25-
// {displayNames[$selectedAlgorithm]}
26-
// </div>
2723
</script>
2824

29-
<Border>
25+
<Border selected={isOpen}>
3026
<div class="wrapper" on:pointerdown={setIsOpen}>
31-
{displayNames[$selectedAlgorithm]}
27+
<div class="name">
28+
{displayNames[$selectedAlgorithm]}
29+
</div>
3230

3331
{#if isOpen}
3432
<ul use:pointerOutside={{ cb: setIsOpen }}>
@@ -60,20 +58,16 @@
6058
font-weight: bold;
6159
}
6260
63-
.current {
64-
border-bottom: 2px solid var(--bg-tool-border);
65-
}
66-
6761
ul {
6862
z-index: 2;
6963
position: absolute;
70-
bottom: -1px;
71-
left: -1px;
72-
width: calc(100% + 2px);
64+
bottom: 8px;
65+
width: 100%;
7366
display: flex;
7467
flex-direction: column;
68+
justify-content: center;
7569
list-style: none;
76-
background-color: var(--bg-select);
70+
background-color: var(--bg-body);
7771
}
7872
7973
li {
@@ -87,14 +81,17 @@
8781
@media (min-width: 600px) {
8882
.wrapper {
8983
font-size: 28px;
90-
min-width: 256px;
9184
}
9285
}
9386
9487
@media (min-width: 1024px) {
9588
.wrapper {
9689
font-size: 36px;
9790
}
91+
92+
ul {
93+
bottom: 14px;
94+
}
9895
}
9996
10097
@media (min-width: 1600px) {
@@ -108,8 +105,13 @@
108105
background-color: var(--select-active);
109106
}
110107
111-
.wrapper:hover {
108+
.wrapper:hover .name {
112109
background-color: var(--select-active);
110+
display: flex;
111+
align-items: center;
112+
justify-content: center;
113+
height: 70%;
114+
width: 60%;
113115
}
114116
}
115117
</style>

src/lib/Components/Border.svelte

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
<script lang="ts">
2+
export let selected: boolean;
3+
</script>
4+
15
<div class="wrapper">
26
<slot />
3-
<div class="border"></div>
7+
<div class="border" class:selected></div>
48
</div>
59

610
<style>
711
.wrapper {
812
position: relative;
13+
height: 100%;
914
}
1015
1116
.border {
@@ -15,6 +20,20 @@
1520
height: 2px;
1621
left: 20%;
1722
width: 60%;
18-
bottom: 10px;
23+
bottom: 6px;
24+
opacity: 0.7;
25+
}
26+
27+
.border.selected {
28+
left: 0;
29+
transition: all 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
30+
width: 100%;
31+
opacity: 1;
32+
}
33+
34+
@media (min-width: 1024px) {
35+
.border {
36+
bottom: 12px;
37+
}
1938
}
2039
</style>

src/lib/Components/Grid.svelte

-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
<script lang="ts">
22
import Node from '$lib/Components/Node.svelte';
33
import { gridSnapshot } from '$lib/stores/history';
4-
import Player from './Player.svelte';
5-
import Nav from '$lib/Components/Nav.svelte';
64
import { layout } from '$lib/stores/layout';
75
import { CELL_SIZE, GRID_GAP, grid } from '$lib/stores/grid';
86
import { tool } from '$lib/stores/tool';
97
import { onMount } from 'svelte';
108
import { queueAnimationByKey, removeFromAnimationQByKey } from '$lib/stores/animation';
119
import { selectedNodeKey, startNodeKey, endNodeKey, walls, weight } from '$lib/stores/nodes';
12-
import Icon from './Icon.svelte';
1310
import { player } from '$lib/stores/player';
1411
1512
onMount(() => {

src/lib/Components/Tools/Tool.svelte

+13-25
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
import { selectedNodeKey } from '$lib/stores/nodes';
33
import { tool, setTool } from '$lib/stores/tool';
44
import type { Tool } from '$lib/types';
5+
import Border from '../Border.svelte';
56
67
export let name: Tool;
78
</script>
89

9-
<div
10-
class="wrapper"
11-
class:selected={name === $tool}
12-
on:pointerdown={() => {
13-
selectedNodeKey.set(null);
14-
setTool(name);
15-
}}
16-
>
17-
<slot />
18-
<div class="border" class:selected={name === $tool}></div>
19-
</div>
10+
<Border selected={name === $tool}>
11+
<div
12+
class="wrapper"
13+
class:selected={name === $tool}
14+
on:pointerdown={() => {
15+
selectedNodeKey.set(null);
16+
setTool(name);
17+
}}
18+
>
19+
<slot />
20+
</div>
21+
</Border>
2022

2123
<style>
2224
.wrapper {
@@ -28,20 +30,6 @@
2830
opacity: 0.7;
2931
}
3032
31-
.border {
32-
position: absolute;
33-
transition: 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
34-
background-color: var(--bg-tool-border);
35-
height: 2px;
36-
width: 30%;
37-
bottom: 10px;
38-
}
39-
40-
.border.selected {
41-
transition: all 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
42-
width: 130%;
43-
}
44-
4533
.wrapper.selected {
4634
opacity: 1;
4735
}

src/routes/+page.svelte

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
height: 100%;
6767
display: flex;
6868
flex-direction: column;
69-
/* justify-content: center; */
7069
align-items: center;
7170
overflow: hidden;
7271
}

0 commit comments

Comments
 (0)