Skip to content

Commit d81c2f3

Browse files
committed
[PRAC/cont] Add styles for contact-row input/btn
Initial styling input/btn from "add-modal" contact-row, :before/:after. Worth noting: - automatically transfer focus() to contact-row input.. after selection in "add-modal" dropdown menu. core: B-3 / JS-BL
1 parent 5442c7b commit d81c2f3

File tree

4 files changed

+111
-1
lines changed

4 files changed

+111
-1
lines changed

core-courses/3-js-basic-level/practicum-js-basic-level/sb-crm-client/css/modal-add.css

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,82 @@
256256
color: var(--text-gray);
257257
}
258258

259+
.modal__add-body-add-contact-input {
260+
border: 1px solid var(--gray);
261+
border-radius: 0;
262+
}
263+
264+
.modal__add-body-add-contact-input::placeholder {
265+
font-weight: var(--regular);
266+
}
267+
268+
.modal__add-body-add-x-btn {
269+
position: relative;
270+
border: 1px solid var(--gray);
271+
border-radius: 0;
272+
width: 27px;
273+
background: var(--select-gray);
274+
outline: none;
275+
transition-property: border, box-shadow;
276+
transition-duration: 0.2s;
277+
transition-timing-function: ease;
278+
}
279+
280+
.modal__add-body-add-x-btn:before,
281+
.modal__add-body-add-x-btn:after {
282+
content: '';
283+
position: absolute;
284+
top: 50%;
285+
left: 50%;
286+
transform: translate(-50%, -50%);
287+
width: 20px;
288+
height: 20px;
289+
background-repeat: no-repeat;
290+
background-position: center;
291+
background-size: contain;
292+
/* отработка клика и на arrow-icon */
293+
pointer-events: none;
294+
transition: opacity 0.2s ease;
295+
}
296+
297+
.modal__add-body-add-x-btn:before {
298+
background-image: url('../images/delete-contact-btn-gray.svg');
299+
opacity: 1;
300+
}
301+
302+
.modal__add-body-add-x-btn:after {
303+
background-image: url('../images/delete-contact-btn-red.svg');
304+
opacity: 0;
305+
}
306+
307+
.modal__add-body-add-x-btn:focus-visible {
308+
border-color: var(--bootstrap-red);
309+
box-shadow: 0 0 0 .25rem rgba(220, 53, 69, .25);
310+
z-index: 1;
311+
}
312+
313+
.modal__add-body-add-x-btn:focus-visible::before {
314+
opacity: 0;
315+
}
316+
317+
.modal__add-body-add-x-btn:focus-visible:after {
318+
opacity: 1;
319+
}
320+
321+
.modal__add-body-add-x-btn:active {
322+
border-color: var(--gray);
323+
box-shadow: 0 0 0 .25rem rgba(200, 197, 209, 0.25);
324+
z-index: 1;
325+
}
326+
327+
.modal__add-body-add-x-btn:active:before {
328+
opacity: 1;
329+
}
330+
331+
.modal__add-body-add-x-btn:active:after {
332+
opacity: 0;
333+
}
334+
259335
.modal__add-btn {
260336
margin: 0;
261337
border: none;
@@ -405,6 +481,20 @@
405481
background-color: var(--select-gray);
406482
}
407483

484+
.modal__add-body-add-x-btn:hover:not(:active) {
485+
border-color: var(--bootstrap-red);
486+
box-shadow: 0 0 0 .25rem rgba(220, 53, 69, .25);
487+
z-index: 10;
488+
}
489+
490+
.modal__add-body-add-x-btn:hover:not(:active):before {
491+
opacity: 0;
492+
}
493+
494+
.modal__add-body-add-x-btn:hover:not(:active):after {
495+
opacity: 1;
496+
}
497+
408498
.modal__add-body-save-btn:hover:not(:active) {
409499
background-color: var(--light-purple);
410500
}
Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 10 additions & 0 deletions
Loading

core-courses/3-js-basic-level/practicum-js-basic-level/sb-crm-client/js/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@
700700
addModalContactItemEmail.textContent = 'Email';
701701
addModalContactItemVk.textContent = 'Vk';
702702
addModalContactItemFacebook.textContent = 'Facebook';
703-
addModalContactXBtn.textContent = '✖';
704703

705704
addModalContactList.append(
706705
addModalContactItemExtraPhone,
@@ -780,6 +779,7 @@
780779
addModalContactDropBtn.textContent = target.textContent;
781780
addModalContactHiddenInput.value = selectedItemValue; // обновление данных в "скрытом" input (для последующей отправки на сервер)
782781
closeBtnDropdown(); // закрытие выпадающего списка
782+
addModalContactInput.focus(); // перевод фокуса на соседний инпут (после выбора в выпадающем списке)
783783
}
784784

785785
function closeBtnDropdown() {

0 commit comments

Comments
 (0)