Skip to content

Commit c65bf5c

Browse files
authored
fix: HTML table text alignment issues (#1086)
* Using classes instead of inline css, fixed up a few text alignment mismatches * Centered column
1 parent a1a64e6 commit c65bf5c

6 files changed

Lines changed: 28 additions & 14 deletions

File tree

components/Admin/RegisteredUsers.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ export default function RegisteredUsers ({ users }: IProps): JSX.Element {
3131
)
3232
},
3333
{
34-
Header: 'Admin',
34+
Header: () => (<div className="text-center">Admin</div>),
3535
accessor: 'isAdmin',
3636
Cell: ({ cell }: CellProps<UserWithSupertokens>) => (
37-
cell.value === true ? <span className={style.admin}>Yes</span> : 'No'
37+
<div className="text-center">
38+
{cell.value === true ? <span className={style.admin}>Yes</span> : 'No'}
39+
</div>
3840
)
3941
}
4042
]

components/Admin/SubscribedAddresses.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function SubscribedAddresses (): JSX.Element {
2727
}
2828
},
2929
{
30-
Header: 'View',
30+
Header: () => (<div className="text-center">View</div>),
3131
accessor: 'view',
3232
Cell: (cellProps: any) => {
3333
return <a href={`https://explorer.e.cash/address/${cellProps.cell.row.values.address as string}`} target="_blank" rel="noopener noreferrer" className="table-eye-ctn">

components/Dashboard/Leaderboard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default ({ buttons, totalString, currencyId }: IProps): JSX.Element => {
3535
}
3636
},
3737
{
38-
Header: () => (<div style={{ textAlign: 'right' }}>{totalString} Revenue</div>),
38+
Header: () => (<div className="text-right">{totalString} Revenue</div>),
3939
accessor: totalRevenueAcessor,
4040
id: 'revenue',
4141
sortType: compareNumericString,
@@ -46,7 +46,7 @@ export default ({ buttons, totalString, currencyId }: IProps): JSX.Element => {
4646
}
4747
},
4848
{
49-
Header: () => (<div style={{ textAlign: 'right' }}>{totalString} Payments</div>),
49+
Header: () => (<div className="text-right">{totalString} Payments</div>),
5050
accessor: 'total.payments',
5151
Cell: (cellProps) => {
5252
return <div style={{ textAlign: 'right', fontWeight: '600' }}>{cellProps.cell.value}</div>

components/Transaction/PaybuttonTransactions.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default ({ paybuttonId, addressSyncing, tableRefreshCount, timezone = mom
8585
}
8686
},
8787
{
88-
Header: () => (<div style={{ textAlign: 'right' }}>Amount</div>),
88+
Header: () => (<div className="text-right">Amount</div>),
8989
accessor: 'amount',
9090
sortType: compareNumericString,
9191
Cell: (cellProps) => {
@@ -100,7 +100,7 @@ export default ({ paybuttonId, addressSyncing, tableRefreshCount, timezone = mom
100100
}
101101
},
102102
{
103-
Header: () => (<div style={{ textAlign: 'center' }}>Network</div>),
103+
Header: () => (<div className="text-center">Network</div>),
104104
accessor: 'address.networkId',
105105
Cell: (cellProps) => {
106106
return (
@@ -113,7 +113,7 @@ export default ({ paybuttonId, addressSyncing, tableRefreshCount, timezone = mom
113113
}
114114
},
115115
{
116-
Header: () => (<div style={{ textAlign: 'center' }}>TX</div>),
116+
Header: () => (<div className="text-center">TX</div>),
117117
accessor: 'hash',
118118
disableSortBy: true,
119119
Cell: (cellProps) => {

pages/payments/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export default function Payments ({ user, userId, organization }: PaybuttonsProp
265265
}
266266
},
267267
{
268-
Header: () => (<div style={{ textAlign: 'right' }}>Amount</div>),
268+
Header: () => (<div className="text-right">Amount</div>),
269269
accessor: 'amount',
270270
sortType: compareNumericString,
271271
Cell: (cellProps) => {
@@ -280,7 +280,7 @@ export default function Payments ({ user, userId, organization }: PaybuttonsProp
280280
}
281281
},
282282
{
283-
Header: () => (<div style={{ textAlign: 'right' }}>Value</div>),
283+
Header: () => (<div className="text-right">Value</div>),
284284
accessor: 'values',
285285
sortType: compareNumericString,
286286
disableSortBy: true,
@@ -289,7 +289,7 @@ export default function Payments ({ user, userId, organization }: PaybuttonsProp
289289
}
290290
},
291291
{
292-
Header: () => (<div style={{ textAlign: 'center' }}>Network</div>),
292+
Header: () => (<div className="text-center">Network</div>),
293293
accessor: 'networkId',
294294
Cell: (cellProps) => {
295295
return (
@@ -302,7 +302,7 @@ export default function Payments ({ user, userId, organization }: PaybuttonsProp
302302
}
303303
},
304304
{
305-
Header: () => (<div style={{ textAlign: 'center' }}>Buttons</div>),
305+
Header: () => (<div className="text-center">Buttons</div>),
306306
accessor: 'buttonDisplayDataList',
307307
Cell: (cellProps) => {
308308
return (
@@ -321,7 +321,7 @@ export default function Payments ({ user, userId, organization }: PaybuttonsProp
321321
}
322322
},
323323
{
324-
Header: 'TX',
324+
Header: () => (<div className="text-center">TX</div>),
325325
accessor: 'hash',
326326
disableSortBy: true,
327327
Cell: (cellProps) => {
@@ -336,7 +336,7 @@ export default function Payments ({ user, userId, organization }: PaybuttonsProp
336336
}
337337
},
338338
{
339-
Header: () => (<div style={{ textAlign: 'center' }}>Invoice</div>),
339+
Header: () => (<div className="text-center">Invoice</div>),
340340
id: 'actions',
341341
disableSortBy: true,
342342
Cell: (cellProps) => {

styles/global.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,18 @@ button:enabled:hover {
194194
transform: rotate(180deg);
195195
}
196196

197+
.text-left {
198+
text-align: left;
199+
}
200+
201+
.text-center {
202+
text-align: center;
203+
}
204+
205+
.text-right {
206+
text-align: right;
207+
}
208+
197209
.table-icon-ctn {
198210
width: 100%;
199211
display: flex;

0 commit comments

Comments
 (0)