Skip to content

Commit 78952df

Browse files
committed
[PRAC/cont] Add states for "head-cell" text/icon
Realiz :focus/hover/active for output-tbl "head-cell", accord template. Worth noting: - adding states for "output-title-hash" too. core: B-3 / JS-BL
1 parent 2f094be commit 78952df

File tree

2 files changed

+75
-11
lines changed

2 files changed

+75
-11
lines changed

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

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@
2525
line-height: 44px;
2626
color: var(--main-purple);
2727
cursor: pointer;
28+
transition: color var(--short) ease;
2829
}
2930

3031
.crm__output-title-hash:focus-visible {
32+
color: var(--light-purple);
3133
outline: solid rgba(152, 115, 255, 0.5);
3234
}
3335

36+
.crm__output-title-hash:active {
37+
color: var(--gray);
38+
}
39+
3440
.crm__output-table {
3541
margin-bottom: 0;
3642
min-height: 322px;
@@ -55,15 +61,15 @@
5561
cursor: pointer;
5662
}
5763

58-
.crm__output-table .crm__o-table-head-cell {
64+
.crm__output-table .crm__output-table-head-cell {
5965
padding: 8px 10px;
6066
}
6167

6268
.crm__output-table #table-th-id {
6369
padding-left: 20px;
6470
width: 70px;
6571
font-weight: var(--semi-bold);
66-
color: var(--main-purple);
72+
color: var(--text-gray);
6773
}
6874

6975
.crm__output-table #table-th-fio {
@@ -87,10 +93,23 @@
8793
cursor: default;
8894
}
8995

90-
.crm__o-table-head-cell:focus-visible {
96+
.crm__output-table-head-cell:focus-visible {
9197
outline: solid rgba(152, 115, 255, 0.5);
9298
}
9399

100+
.head-cell__text,
101+
.head-cell__icon,
102+
.head-cell__sort {
103+
transition-property: color, opacity;
104+
transition-duration: var(--short);
105+
transition-timing-function: ease;
106+
}
107+
108+
.head-cell__icon,
109+
.head-cell__sort {
110+
opacity: 0.7;
111+
}
112+
94113
.head-cell__text {
95114
margin-right: 2px;
96115
}
@@ -99,6 +118,30 @@
99118
padding-right: 16px;
100119
}
101120

121+
.head-cell-with-icon:focus-visible .head-cell__text {
122+
color: var(--main-purple);
123+
}
124+
125+
.head-cell-with-icon:focus-visible .head-cell__icon {
126+
opacity: 1;
127+
}
128+
129+
.head-cell-with-icon:focus-visible .head-cell__sort {
130+
opacity: 1;
131+
}
132+
133+
.head-cell-with-icon:active .head-cell__text {
134+
color: var(--main-purple);
135+
}
136+
137+
.head-cell-with-icon:active .head-cell__icon {
138+
opacity: 1;
139+
}
140+
141+
.head-cell-with-icon:active .head-cell__sort {
142+
opacity: 1;
143+
}
144+
102145
.head-cell__icon-up {
103146
background: url(../images/cell-arrow-up.svg) no-repeat 0px 1px / 17px;
104147
}
@@ -147,3 +190,21 @@
147190
width: 190px;
148191
}
149192
}
193+
194+
@media (any-hover: hover) {
195+
.crm__output-title-hash:hover:not(:active) {
196+
color: var(--light-purple);
197+
}
198+
199+
.head-cell-with-icon:hover:not(:focus-visible):not(:active) .head-cell__text {
200+
color: var(--black);
201+
}
202+
203+
.head-cell-with-icon:hover .head-cell__icon {
204+
opacity: 1;
205+
}
206+
207+
.head-cell-with-icon:hover .head-cell__sort {
208+
opacity: 1;
209+
}
210+
}

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@
9292
outputTable.classList.add('crm__output-table', 'table', 'table-hover');
9393
outTableHead.classList.add('crm__output-table-head');
9494
outTableBody.classList.add('crm__output-table-body');
95-
outTblHeadTr.classList.add('crm__o-table-head-row');
95+
outTblHeadTr.classList.add('crm__output-table-head-row');
9696
outTblHeadThId.classList.add(
9797
'head-cell',
9898
'head-cell-with-icon',
99-
'crm__o-table-head-cell'
99+
'crm__output-table-head-cell'
100100
);
101101
outTblHeadThIdWrap.classList.add('head-cell__wrap', 'head-cell__wrap-id');
102102
outTblHeadThIdText.classList.add('head-cell__text', 'head-cell__text-id');
@@ -108,7 +108,7 @@
108108
outTblHeadThFIO.classList.add(
109109
'head-cell',
110110
'head-cell-with-icon',
111-
'crm__o-table-head-cell'
111+
'crm__output-table-head-cell'
112112
);
113113
outTblHeadThFIOWrap.classList.add('head-cell__wrap', 'head-cell__wrap-fio');
114114
outTblHeadThFIOText.classList.add('head-cell__text', 'head-cell__text-fio');
@@ -121,7 +121,7 @@
121121
outTblHeadThCreationDT.classList.add(
122122
'head-cell',
123123
'head-cell-with-icon',
124-
'crm__o-table-head-cell'
124+
'crm__output-table-head-cell'
125125
);
126126
outTblHeadThDTWrap.classList.add('head-cell__wrap', 'head-cell__wrap-dt');
127127
outTblHeadThDTText.classList.add('head-cell__text', 'head-cell__text-dt');
@@ -133,7 +133,7 @@
133133
outTblHeadThChanges.classList.add(
134134
'head-cell',
135135
'head-cell-with-icon',
136-
'crm__o-table-head-cell'
136+
'crm__output-table-head-cell'
137137
);
138138
outTblHeadThChangeWrap.classList.add(
139139
'head-cell__wrap',
@@ -148,7 +148,10 @@
148148
'head-cell__icon-change',
149149
'head-cell__icon-down'
150150
);
151-
outTblHeadThContacts.classList.add('head-cell', 'crm__o-table-head-cell');
151+
outTblHeadThContacts.classList.add(
152+
'head-cell',
153+
'crm__output-table-head-cell'
154+
);
152155
outTblHeadThContactWrap.classList.add(
153156
'head-cell__wrap',
154157
'head-cell__wrap-contact'
@@ -157,7 +160,7 @@
157160
'head-cell__text',
158161
'head-cell__text-contact'
159162
);
160-
outTblHeadThActions.classList.add('head-cell', 'crm__o-table-head-cell');
163+
outTblHeadThActions.classList.add('head-cell', 'crm__output-table-head-cell');
161164
outTblHeadThActionWrap.classList.add(
162165
'head-cell__wrap',
163166
'head-cell__wrap-action'
@@ -545,7 +548,7 @@
545548

546549
// ** изменение направления стрелки/svg-icon, согласно прожатия по заглавной ячейке (при сортировке данных)
547550
const allHeaderRowCells = document.querySelectorAll(
548-
'.crm__o-table-head-cell'
551+
'.crm__output-table-head-cell'
549552
);
550553

551554
function changeIconDirection(event) {

0 commit comments

Comments
 (0)