data-table.scss 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. // ─────────────────────────────────────────────────────────────
  2. // D6 §5.1 — 고밀도 DataTable 스타일 (components/table/DataTable.tsx)
  3. // 원칙: 행 구분 하단 1px 선만(세로선·zebra 없음, nof1/monotaro), 숫자열 우측 정렬 + tabular-nums,
  4. // sticky thead, 밀도 3단(html[data-density] 변수: --row-h/--cell-fs/--cell-px),
  5. // 우선순위 낮은 열 mobile drop(data-priority='low'), 포인트 컬러는 등락에 미사용.
  6. // ─────────────────────────────────────────────────────────────
  7. .data-table {
  8. width: 100%;
  9. border-collapse: collapse;
  10. font-variant-numeric: tabular-nums;
  11. // caption — 기본 sr-only(접근성), captionVisible 시 표시
  12. .data-table__caption {
  13. padding: var(--sp-3) 0;
  14. font-size: var(--fs-sm);
  15. color: var(--text-muted);
  16. text-align: left;
  17. caption-side: top;
  18. }
  19. .data-table__caption--sr {
  20. position: absolute;
  21. width: 1px;
  22. height: 1px;
  23. padding: 0;
  24. overflow: hidden;
  25. clip: rect(0 0 0 0);
  26. white-space: nowrap;
  27. border: 0;
  28. }
  29. thead th {
  30. position: sticky;
  31. top: 0;
  32. z-index: 1;
  33. height: var(--row-h);
  34. padding: 0 var(--cell-px);
  35. font-size: var(--cell-fs);
  36. font-weight: 600;
  37. color: var(--text-muted);
  38. background: var(--bg-elevated);
  39. border-bottom: 1px solid var(--border-strong);
  40. white-space: nowrap;
  41. }
  42. tbody td {
  43. height: var(--row-h);
  44. padding: 0 var(--cell-px);
  45. font-size: var(--cell-fs);
  46. color: var(--text-primary);
  47. border-bottom: 1px solid var(--border-light);
  48. white-space: nowrap;
  49. }
  50. // 정렬 (data-align) — 헤더/바디 공통
  51. [data-align='left'] {
  52. text-align: left;
  53. }
  54. [data-align='right'] {
  55. text-align: right;
  56. }
  57. [data-align='center'] {
  58. text-align: center;
  59. }
  60. tbody tr:hover {
  61. background: var(--bg-subtle-hover);
  62. }
  63. .data-table__row--clickable {
  64. cursor: pointer;
  65. }
  66. // 정렬 가능 헤더 버튼
  67. .data-table__sort {
  68. display: inline-flex;
  69. align-items: center;
  70. gap: var(--sp-2);
  71. padding: 0;
  72. font: inherit;
  73. color: inherit;
  74. background: none;
  75. border: none;
  76. cursor: pointer;
  77. &:hover {
  78. color: var(--text-secondary);
  79. }
  80. }
  81. .data-table__sort-icon {
  82. font-size: var(--fs-2xs);
  83. color: var(--text-muted);
  84. }
  85. // 이름/제목 셀 — 말줄임 (가변 폭)
  86. .data-table__cell--name {
  87. max-width: 0;
  88. width: 40%;
  89. }
  90. // 빈 상태
  91. .data-table__empty {
  92. padding: var(--sp-7) var(--sp-5);
  93. font-size: var(--fs-base);
  94. color: var(--text-muted);
  95. text-align: center;
  96. }
  97. // 우선순위 낮은 열 mobile drop (<768px)
  98. @media (max-width: 767.98px) {
  99. [data-priority='low'] {
  100. display: none;
  101. }
  102. }
  103. }
  104. // ── 종목 셀 (StockRow) ──
  105. .stock-cell {
  106. display: flex;
  107. align-items: center;
  108. gap: var(--sp-3);
  109. min-height: var(--row-h);
  110. color: var(--text-primary);
  111. &:hover .stock-cell__name {
  112. text-decoration: underline;
  113. }
  114. &__name {
  115. overflow: hidden;
  116. white-space: nowrap;
  117. text-overflow: ellipsis;
  118. }
  119. &__code {
  120. flex: 0 0 auto;
  121. font-size: var(--fs-xs);
  122. color: var(--text-muted);
  123. font-variant-numeric: tabular-nums;
  124. }
  125. }
  126. // ── 게시글 셀 (PostRow) ──
  127. .post-cell {
  128. display: flex;
  129. align-items: center;
  130. gap: var(--sp-2);
  131. min-height: var(--row-h);
  132. color: var(--text-primary);
  133. &:hover .post-cell__subject {
  134. text-decoration: underline;
  135. }
  136. &__prefix {
  137. flex: 0 0 auto;
  138. color: var(--text-muted);
  139. }
  140. &__subject {
  141. overflow: hidden;
  142. white-space: nowrap;
  143. text-overflow: ellipsis;
  144. }
  145. &__comments {
  146. flex: 0 0 auto;
  147. font-size: var(--fs-xs);
  148. color: var(--az-accent);
  149. font-variant-numeric: tabular-nums;
  150. }
  151. }
  152. // ── 등락 표시 (PriceChange) — 색 + 부호 병행 (색맹 대응), 포인트 컬러 미사용 ──
  153. .price-change {
  154. display: inline-flex;
  155. align-items: baseline;
  156. gap: 2px;
  157. font-variant-numeric: tabular-nums;
  158. &__symbol {
  159. font-size: var(--fs-2xs);
  160. }
  161. &--up {
  162. color: var(--price-up);
  163. }
  164. &--down {
  165. color: var(--price-down);
  166. }
  167. &--flat {
  168. color: var(--price-flat);
  169. }
  170. }