Skip to content

Commit ebf04b4

Browse files
asizikovCopilot
andcommitted
refactor: extract shared data table styles into reusable classes
Replace duplicated table styling across orgs, users, user-details, and cost-centers views with shared .data-table-wrap and .data-table CSS classes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d44991a commit ebf04b4

5 files changed

Lines changed: 54 additions & 131 deletions

File tree

src/App.css

Lines changed: 44 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,41 @@
212212
width: 100%;
213213
}
214214

215+
/* Shared data table */
216+
.data-table-wrap {
217+
background: #ffffff;
218+
border: 1px solid #d1d9e0;
219+
border-radius: 6px;
220+
overflow: auto;
221+
}
222+
223+
.data-table {
224+
width: 100%;
225+
border-collapse: collapse;
226+
font-size: 13px;
227+
}
228+
229+
.data-table th,
230+
.data-table td {
231+
padding: 12px 16px;
232+
border-bottom: 1px solid #f6f8fa;
233+
white-space: nowrap;
234+
}
235+
236+
.data-table tbody tr:last-child td {
237+
border-bottom: none;
238+
}
239+
240+
.data-table th {
241+
text-align: left;
242+
font-size: 11px;
243+
letter-spacing: 0.05em;
244+
text-transform: uppercase;
245+
font-weight: 600;
246+
color: #636c76;
247+
background: #ffffff;
248+
}
249+
215250
/* Users view */
216251
.users-view {
217252
display: flex;
@@ -258,35 +293,8 @@
258293
color: #636c76;
259294
}
260295

261-
.orgs-view__tableWrap {
262-
background: #ffffff;
263-
border: 1px solid #d1d9e0;
264-
border-radius: 6px;
265-
overflow: auto;
266-
}
267-
268-
.orgs-view__table {
269-
width: 100%;
270-
border-collapse: collapse;
271-
font-size: 13px;
272-
}
273-
274-
.orgs-view__table th,
275-
.orgs-view__table td {
276-
padding: 10px 12px;
277-
border-bottom: 1px solid #f6f8fa;
278-
white-space: nowrap;
279-
}
280-
281-
.orgs-view__table th {
282-
text-align: left;
283-
font-size: 12px;
284-
letter-spacing: 0.04em;
285-
text-transform: uppercase;
286-
color: #636c76;
287-
background: #f6f8fa;
288-
position: sticky;
289-
top: 0;
296+
.orgs-view__table th.orgs-view__num {
297+
text-align: right;
290298
}
291299

292300
.orgs-view__num {
@@ -799,9 +807,6 @@
799807
}
800808

801809
.cost-centers-view__tableWrap {
802-
background: #ffffff;
803-
border: 1px solid #d1d9e0;
804-
border-radius: 6px;
805810
overflow: hidden;
806811
}
807812

@@ -816,33 +821,6 @@
816821
background: #f6f8fa;
817822
}
818823

819-
.cost-centers-view__table {
820-
width: 100%;
821-
border-collapse: collapse;
822-
font-size: 13px;
823-
}
824-
825-
.cost-centers-view__table th,
826-
.cost-centers-view__table td {
827-
padding: 12px 16px;
828-
border-bottom: 1px solid #f6f8fa;
829-
white-space: nowrap;
830-
}
831-
832-
.cost-centers-view__table tbody tr:last-child td {
833-
border-bottom: none;
834-
}
835-
836-
.cost-centers-view__table th {
837-
text-align: left;
838-
font-size: 11px;
839-
letter-spacing: 0.05em;
840-
text-transform: uppercase;
841-
font-weight: 600;
842-
color: #636c76;
843-
background: #ffffff;
844-
}
845-
846824
.cost-centers-view__num {
847825
text-align: right;
848826
font-variant-numeric: tabular-nums;
@@ -880,10 +858,9 @@ td.cost-centers-view__num {
880858

881859
/* Per-model breakdown */
882860
.per-model {
883-
background: #ffffff;
884-
border: 1px solid #d1d9e0;
885-
border-radius: 6px;
886-
padding: 16px;
861+
display: flex;
862+
flex-direction: column;
863+
gap: 20px;
887864
}
888865

889866
.per-model__header {
@@ -1033,26 +1010,6 @@ td.cost-centers-view__num {
10331010
outline-offset: 2px;
10341011
}
10351012

1036-
.users-view__tableWrap {
1037-
background: #ffffff;
1038-
border: 1px solid #d1d9e0;
1039-
border-radius: 6px;
1040-
overflow: auto;
1041-
}
1042-
1043-
.users-view__table {
1044-
width: 100%;
1045-
border-collapse: collapse;
1046-
font-size: 13px;
1047-
}
1048-
1049-
.users-view__table th,
1050-
.users-view__table td {
1051-
padding: 10px 12px;
1052-
border-bottom: 1px solid #f6f8fa;
1053-
white-space: nowrap;
1054-
}
1055-
10561013
.users-view__row--clickable {
10571014
cursor: pointer;
10581015
}
@@ -1066,15 +1023,8 @@ td.cost-centers-view__num {
10661023
outline-offset: -2px;
10671024
}
10681025

1069-
.users-view__table th {
1070-
text-align: left;
1071-
font-size: 12px;
1072-
letter-spacing: 0.04em;
1073-
text-transform: uppercase;
1074-
color: #636c76;
1075-
background: #f6f8fa;
1076-
position: sticky;
1077-
top: 0;
1026+
.users-view__table th.users-view__num {
1027+
text-align: right;
10781028
}
10791029

10801030
.users-view__num {
@@ -1165,35 +1115,8 @@ td.cost-centers-view__num {
11651115
color: #636c76;
11661116
}
11671117

1168-
.user-details__tableWrap {
1169-
background: #ffffff;
1170-
border: 1px solid #d1d9e0;
1171-
border-radius: 6px;
1172-
overflow: auto;
1173-
}
1174-
1175-
.user-details__table {
1176-
width: 100%;
1177-
border-collapse: collapse;
1178-
font-size: 13px;
1179-
}
1180-
1181-
.user-details__table th,
1182-
.user-details__table td {
1183-
padding: 10px 12px;
1184-
border-bottom: 1px solid #f6f8fa;
1185-
white-space: nowrap;
1186-
}
1187-
1188-
.user-details__table th {
1189-
text-align: left;
1190-
font-size: 12px;
1191-
letter-spacing: 0.04em;
1192-
text-transform: uppercase;
1193-
color: #636c76;
1194-
background: #f6f8fa;
1195-
position: sticky;
1196-
top: 0;
1118+
.user-details__table th.user-details__num {
1119+
text-align: right;
11971120
}
11981121

11991122
.user-details__num {

src/views/CostCentersView.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ export function CostCentersView({ data, rangeStart }: { data: CostCenterResult;
133133
</div>
134134

135135
<div className="cost-centers-view__tables">
136-
<div className="cost-centers-view__tableWrap">
136+
<div className="cost-centers-view__tableWrap data-table-wrap">
137137
<div className="cost-centers-view__tableTitle">Per model</div>
138-
<table className="cost-centers-view__table">
138+
<table className="cost-centers-view__table data-table">
139139
<thead>
140140
<tr>
141141
<th>Model</th>
@@ -166,9 +166,9 @@ export function CostCentersView({ data, rangeStart }: { data: CostCenterResult;
166166
</table>
167167
</div>
168168

169-
<div className="cost-centers-view__tableWrap">
169+
<div className="cost-centers-view__tableWrap data-table-wrap">
170170
<div className="cost-centers-view__tableTitle">Per user</div>
171-
<table className="cost-centers-view__table">
171+
<table className="cost-centers-view__table data-table">
172172
<thead>
173173
<tr>
174174
<th>User</th>

src/views/OrganizationsView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export function OrganizationsView({ data }: { data: OrganizationResult }) {
2020
</div>
2121
</div>
2222

23-
<div className="orgs-view__tableWrap">
24-
<table className="orgs-view__table">
23+
<div className="orgs-view__tableWrap data-table-wrap">
24+
<table className="orgs-view__table data-table">
2525
<thead>
2626
<tr>
2727
<th>Organization</th>

src/views/UserDetailsView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ export function UserDetailsView({ user }: UserDetailsViewProps) {
161161
<MultiSeriesStackedBarChart title="Daily AI Credits by Model" labels={labels} series={aiuSeries} height={340} />
162162
</div>
163163

164-
<div className="user-details__tableWrap">
165-
<table className="user-details__table">
164+
<div className="user-details__tableWrap data-table-wrap">
165+
<table className="user-details__table data-table">
166166
<thead>
167167
<tr>
168168
<th>Date</th>

src/views/UsersView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ export function UsersView({ users, onSelectUser }: UsersViewProps) {
5656
aria-label="Search users"
5757
/>
5858

59-
<div className="users-view__tableWrap">
60-
<table className="users-view__table">
59+
<div className="users-view__tableWrap data-table-wrap">
60+
<table className="users-view__table data-table">
6161
<thead>
6262
<tr>
6363
<th>User</th>

0 commit comments

Comments
 (0)