Skip to content

Commit f2401db

Browse files
committed
styles: improve alignment of columns in channels/swaps lists
1 parent b399e47 commit f2401db

File tree

2 files changed

+42
-30
lines changed

2 files changed

+42
-30
lines changed

app/src/components/history/HistoryRow.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export const HistoryRowHeader: React.FC = () => {
4848
<Column>
4949
<HeaderFour>{l('amount')} (sats)</HeaderFour>
5050
</Column>
51-
<Column right>
51+
<Column right cols={3}>
5252
<HeaderFour>{l('created')}</HeaderFour>
5353
</Column>
54-
<Column right>
54+
<Column right cols={3}>
5555
<HeaderFour>{l('updated')}</HeaderFour>
5656
</Column>
5757
</Row>
@@ -77,8 +77,12 @@ const HistoryRow: React.FC<Props> = ({ swap, style }) => {
7777
<Column>
7878
<Unit sats={swap.amount} suffix={false} />
7979
</Column>
80-
<Column right>{swap.createdOnLabel}</Column>
81-
<Column right>{swap.updatedOnLabel}</Column>
80+
<Column right cols={3}>
81+
{swap.createdOnLabel}
82+
</Column>
83+
<Column right cols={3}>
84+
{swap.updatedOnLabel}
85+
</Column>
8286
</Row>
8387
);
8488
};

app/src/components/loop/ChannelRow.tsx

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ import ChannelIcon from './ChannelIcon';
1717
*/
1818
export const ROW_HEIGHT = 60;
1919

20+
const BaseColumn = styled(Column)`
21+
white-space: nowrap;
22+
line-height: ${ROW_HEIGHT}px;
23+
padding-left: 5px;
24+
padding-right: 5px;
25+
`;
26+
2027
const Styled = {
2128
Row: styled(Row)<{ dimmed?: boolean; selectable?: boolean }>`
2229
border-bottom: 0.5px solid ${props => props.theme.colors.darkGray};
@@ -35,28 +42,26 @@ const Styled = {
3542
}
3643
`}
3744
`,
38-
Column: styled(Column)<{ last?: boolean; ellipse?: boolean }>`
39-
white-space: nowrap;
40-
line-height: ${ROW_HEIGHT}px;
41-
padding-left: 5px;
45+
Column: styled(BaseColumn)<{ last?: boolean }>`
4246
padding-right: ${props => (props.last ? '15' : '5')}px;
43-
${props =>
44-
props.ellipse &&
45-
`
46-
overflow: hidden;
47-
text-overflow: ellipsis;
48-
`}
47+
`,
48+
ActionColumn: styled(BaseColumn)`
49+
max-width: 50px;
50+
padding-left: 24px;
51+
`,
52+
WideColumn: styled(BaseColumn)`
53+
overflow: hidden;
54+
text-overflow: ellipsis;
55+
56+
@media (min-width: 1200px) and (max-width: 1300px) {
57+
max-width: 20%;
58+
}
4959
`,
5060
StatusIcon: styled.span`
51-
float: left;
52-
margin-top: -1px;
53-
margin-left: 15px;
5461
color: ${props => props.theme.colors.pink};
5562
`,
5663
Check: styled(Checkbox)`
57-
float: left;
58-
margin-top: 18px;
59-
margin-left: 10px;
64+
margin-top: 17px;
6065
`,
6166
Balance: styled(ChannelBalance)`
6267
margin-top: ${ROW_HEIGHT / 2 - 2}px;
@@ -78,13 +83,14 @@ const ChannelAliasTip: React.FC<{ channel: Channel }> = ({ channel }) => {
7883

7984
export const ChannelRowHeader: React.FC = () => {
8085
const { l } = usePrefixedTranslation('cmps.loop.ChannelRowHeader');
81-
const { Column } = Styled;
86+
const { Column, ActionColumn, WideColumn } = Styled;
8287
return (
8388
<Row>
89+
<ActionColumn></ActionColumn>
8490
<Column right>
8591
<HeaderFour>{l('canReceive')}</HeaderFour>
8692
</Column>
87-
<Column cols={2} colsXl={3}></Column>
93+
<WideColumn cols={2} colsXl={3}></WideColumn>
8894
<Column>
8995
<HeaderFour>{l('canSend')}</HeaderFour>
9096
</Column>
@@ -96,9 +102,9 @@ export const ChannelRowHeader: React.FC = () => {
96102
<Column cols={1}>
97103
<HeaderFour>{l('upTime')}</HeaderFour>
98104
</Column>
99-
<Column cols={2}>
105+
<WideColumn cols={2}>
100106
<HeaderFour>{l('peer')}</HeaderFour>
101-
</Column>
107+
</WideColumn>
102108
<Column right last>
103109
<HeaderFour>{l('capacity')}</HeaderFour>
104110
</Column>
@@ -123,41 +129,43 @@ const ChannelRow: React.FC<Props> = ({ channel, style }) => {
123129
store.buildSwapStore.toggleSelectedChannel(channel.chanId);
124130
};
125131

126-
const { Row, Column, StatusIcon, Check, Balance } = Styled;
132+
const { Row, Column, ActionColumn, WideColumn, StatusIcon, Check, Balance } = Styled;
127133
return (
128134
<Row
129135
dimmed={dimmed}
130136
style={style}
131137
selectable={editable && !disabled}
132138
onClick={editable && !disabled ? handleRowChecked : undefined}
133139
>
134-
<Column right>
140+
<ActionColumn>
135141
{editable ? (
136142
<Check checked={checked} disabled={disabled} />
137143
) : (
138144
<StatusIcon>
139145
<ChannelIcon channel={channel} />
140146
</StatusIcon>
141147
)}
148+
</ActionColumn>
149+
<Column right>
142150
<Unit sats={channel.remoteBalance} suffix={false} />
143151
</Column>
144-
<Column cols={2} colsXl={3}>
152+
<WideColumn cols={2} colsXl={3}>
145153
<Balance channel={channel} />
146-
</Column>
154+
</WideColumn>
147155
<Column>
148156
<Unit sats={channel.localBalance} suffix={false} />
149157
</Column>
150158
<Column cols={1}>{channel.remoteFeeRate}</Column>
151159
<Column cols={1}>{channel.uptimePercent}</Column>
152-
<Column cols={2} ellipse>
160+
<WideColumn cols={2}>
153161
<Tip
154162
overlay={<ChannelAliasTip channel={channel} />}
155163
placement="left"
156164
capitalize={false}
157165
>
158166
<span>{channel.aliasLabel}</span>
159167
</Tip>
160-
</Column>
168+
</WideColumn>
161169
<Column right>
162170
<Unit sats={channel.capacity} suffix={false} />
163171
</Column>

0 commit comments

Comments
 (0)