Skip to content

Commit a5d3184

Browse files
authored
Merge pull request #3486 from celestiancoder/LB-1518
LB-1518: remember custom color presets on the Art Creator
2 parents 483080c + 62cf16a commit a5d3184

File tree

2 files changed

+356
-59
lines changed

2 files changed

+356
-59
lines changed

frontend/css/sass/stats-art-creator.scss

Lines changed: 115 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$color-selector-size: 24px;
2+
13
#stats-art-creator {
24
display: flex;
35
gap: 15px;
@@ -17,52 +19,141 @@
1719
align-items: center;
1820
justify-items: center;
1921
justify-content: center;
22+
2023
.gallery-tile {
2124
max-width: 100px;
2225
border: none;
2326
pointer-events: none;
27+
2428
&.selected {
2529
border: 3px solid $orange;
2630
}
2731
}
2832
}
2933

30-
.color-picker-panel {
31-
display: flex;
32-
align-items: center;
33-
justify-content: space-between;
34+
.color-presets-panel {
3435
margin-bottom: 4px;
3536
margin-top: 10px;
37+
display: grid;
38+
grid-template-columns: repeat(5, 1fr);
39+
gap: 15px;
40+
max-height: 140px;
41+
overflow-y: scroll;
42+
padding: 5px;
43+
align-items: start;
44+
justify-items: center;
45+
46+
/* prettier-ignore */
47+
@supports not selector(::-webkit-scrollbar) {
48+
scrollbar-width: thin;
49+
scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
50+
}
51+
52+
&::-webkit-scrollbar {
53+
width: 4px;
54+
}
55+
56+
&::-webkit-scrollbar-track {
57+
background: transparent;
58+
}
59+
60+
&::-webkit-scrollbar-thumb {
61+
background: rgba(0, 0, 0, 0.2);
62+
border-radius: 2px;
63+
}
3664
}
3765

3866
.settings-navbar {
3967
margin-left: auto;
4068
max-width: 320px;
69+
overflow-y: scroll;
70+
71+
/* prettier-ignore */
72+
@supports not selector(::-webkit-scrollbar) {
73+
scrollbar-width: thin;
74+
scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
75+
}
76+
77+
&::-webkit-scrollbar {
78+
width: 4px;
79+
}
80+
81+
&::-webkit-scrollbar-track {
82+
background: transparent;
83+
}
84+
85+
&::-webkit-scrollbar-thumb {
86+
background: rgba(0, 0, 0, 0.2);
87+
border-radius: 2px;
88+
}
4189
}
4290

4391
/*Color Picker*/
4492
.color-picker {
45-
width: 24px;
46-
height: 24px;
93+
width: $color-selector-size;
94+
height: $color-selector-size;
4795
border-radius: 50%;
4896
position: relative;
4997
overflow: hidden;
5098
border: none;
99+
cursor: pointer;
51100

52101
.color-half {
53102
width: 50%;
54103
height: 100%;
55104
position: absolute;
56105
top: 0;
106+
57107
&:first-child {
58108
left: 0;
59109
}
110+
60111
&:last-child {
61112
left: 50%;
62113
}
63114
}
64115
}
65116

117+
.color-preset-wrapper {
118+
position: relative;
119+
display: flex;
120+
justify-content: center;
121+
align-items: center;
122+
border-radius: 50%;
123+
height: $color-selector-size;
124+
width: $color-selector-size;
125+
126+
&.preset-selected {
127+
box-shadow: 0 0 0 1px #ffffff, 0 0 0 3px $listenbrainz-blue;
128+
z-index: 1;
129+
}
130+
131+
.delete-preset-btn {
132+
position: absolute;
133+
top: -5px;
134+
right: -5px;
135+
border-radius: 50%;
136+
border: none;
137+
color: $listenbrainz-blue;
138+
font-size: 14px;
139+
cursor: pointer;
140+
opacity: 0;
141+
transition: opacity 0.2s ease-in-out, transform 0.1s;
142+
padding: 0;
143+
width: 14px;
144+
height: 14px;
145+
display: flex;
146+
align-items: center;
147+
justify-content: center;
148+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
149+
z-index: 2;
150+
}
151+
152+
&:hover .delete-preset-btn {
153+
opacity: 1;
154+
}
155+
}
156+
66157
.preview {
67158
border-radius: 5px;
68159
margin-bottom: 10px;
@@ -85,6 +176,7 @@
85176
position: relative;
86177
display: inline-block;
87178
padding-left: 0;
179+
88180
/* Input */
89181
> input {
90182
appearance: none;
@@ -105,14 +197,17 @@
105197
transform: scale(1);
106198
pointer-events: none;
107199
transition: opacity 0.3s 0.1s, transform 0.2s 0.1s;
200+
108201
/* Checked */
109202
&:checked {
110203
right: -10px;
111204
background-color: $gray-600;
112205
}
206+
113207
&:focus {
114208
opacity: 0.12;
115209
}
210+
116211
/* Active */
117212
&:active {
118213
opacity: 1;
@@ -128,6 +223,7 @@
128223
background-color: $gray-600;
129224
transform: translateX(10px);
130225
}
226+
131227
&:active + span::before {
132228
background-color: $gray-600;
133229
}
@@ -153,6 +249,7 @@
153249
background-color: $black;
154250
}
155251
}
252+
156253
/* Track */
157254
> span::before {
158255
content: "";
@@ -165,6 +262,7 @@
165262
vertical-align: top;
166263
transition: background-color 0.2s, opacity 0.2s;
167264
}
265+
168266
/* Thumb */
169267
> span::after {
170268
content: "";
@@ -183,6 +281,7 @@
183281
/* Hover, Focus */
184282
&:hover > input {
185283
opacity: 0.04;
284+
186285
&:focus {
187286
opacity: 0.16;
188287
}
@@ -196,49 +295,59 @@
196295
gap: 1em;
197296
margin-top: 1em;
198297
margin-bottom: 1em;
298+
199299
.profile,
200300
.share-buttons {
201301
flex: 1;
202302
flex-basis: 300px;
203303
justify-content: left;
304+
204305
> .btn-link > span {
205306
margin-right: 0.2em;
206307
font-size: 14px;
207308
}
208309
}
310+
209311
.profile {
210312
text-align: left;
211313
}
314+
212315
.link-container {
213316
min-width: 150px;
214317
height: 3em;
215318
margin-left: 0.6em;
216319
margin-right: auto;
320+
217321
> input {
218322
text-overflow: ellipsis;
219323
border-radius: 5px 0 0 5px;
220324
height: inherit;
221325
}
326+
222327
> span {
223328
height: inherit;
329+
224330
> button {
225331
height: inherit;
226332
border-radius: 0 5px 5px 0;
227333
line-height: 1em;
334+
228335
> svg {
229336
font-size: 1.5em;
230337
}
231338
}
232339
}
233340
}
234341
}
342+
235343
input[type="color"] {
236344
padding: 0;
237345
max-width: 5em;
238346
}
239347

240348
.input-group {
241349
flex-wrap: nowrap;
350+
242351
.input-group-text {
243352
font-size: 1.4rem;
244353
}

0 commit comments

Comments
 (0)