Skip to content

Commit 35d8b87

Browse files
committed
feat(neuron-ui): update history list to make it more compact
1 parent 0e1c4b3 commit 35d8b87

3 files changed

Lines changed: 61 additions & 24 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react'
2+
import { Stack, Text, getTheme } from 'office-ui-fabric-react'
3+
4+
const {
5+
palette: { neutralLighterAlt, neutralSecondary, neutralLighter },
6+
} = getTheme()
7+
8+
const GroupHeader = ({ group }: any) => {
9+
const { name } = group
10+
return (
11+
<Stack
12+
tokens={{ padding: 15 }}
13+
styles={{
14+
root: {
15+
background: neutralLighterAlt,
16+
borderTop: `1px solid ${neutralSecondary}`,
17+
borderBottom: `1px solid ${neutralLighter}`,
18+
padding: `15px 12px 5px`,
19+
minWidth: '100%!important',
20+
},
21+
}}
22+
>
23+
<Text variant="medium">{name}</Text>
24+
</Stack>
25+
)
26+
}
27+
export default GroupHeader
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import { DetailsRow, IDetailsRowProps } from 'office-ui-fabric-react'
3+
4+
const HistoryRow = (props?: IDetailsRowProps) => {
5+
return props ? (
6+
<DetailsRow
7+
{...props}
8+
styles={{
9+
root: {
10+
animationDuration: '0!important',
11+
minWidth: '100%!important',
12+
},
13+
cell: {
14+
paddingTop: 0,
15+
paddingBottom: 0,
16+
},
17+
}}
18+
/>
19+
) : null
20+
}
21+
22+
export default HistoryRow

packages/neuron-ui/src/components/TransactionList/index.tsx

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import React, { useMemo } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import {
4-
Stack,
5-
Text,
64
ShimmeredDetailsList,
75
TextField,
86
IconButton,
97
IColumn,
108
IGroup,
119
CheckboxVisibility,
10+
CollapseAllVisibility,
1211
getTheme,
1312
} from 'office-ui-fabric-react'
1413

14+
import GroupHeader from 'components/CustomRows/GroupHeader'
15+
import HistoryRow from 'components/CustomRows/HistoryRow'
16+
1517
import { StateDispatch } from 'states/stateProvider/reducer'
1618
import { contextMenu, showTransactionDetails } from 'services/remote'
1719

@@ -22,7 +24,6 @@ import {
2224
uniformTimeFormatter,
2325
localNumberFormatter,
2426
} from 'utils/formatters'
25-
import { onRenderRow } from 'utils/fabricUIRender'
2627
import { CONFIRMATION_THRESHOLD } from 'utils/const'
2728

2829
const theme = getTheme()
@@ -32,24 +33,6 @@ interface FormatTransaction extends State.Transaction {
3233
date: string
3334
}
3435

35-
const onRenderHeader = ({ group }: any) => {
36-
const { name } = group
37-
return (
38-
<Stack
39-
tokens={{ padding: 15 }}
40-
styles={{
41-
root: {
42-
background: theme.palette.neutralLighterAlt,
43-
borderTop: `1px solid ${theme.palette.neutralSecondary}`,
44-
borderBottom: `1px solid ${theme.palette.neutralLighter}`,
45-
},
46-
}}
47-
>
48-
<Text variant="large">{name}</Text>
49-
</Stack>
50-
)
51-
}
52-
5336
const TransactionList = ({
5437
isLoading = false,
5538
items = [],
@@ -185,6 +168,10 @@ const TransactionList = ({
185168
borderless
186169
readOnly={!isSelected}
187170
styles={{
171+
root: {
172+
flex: '1',
173+
paddingRight: '15px',
174+
},
188175
fieldGroup: {
189176
backgroundColor: isSelected ? '#fff' : 'transparent',
190177
borderColor: 'transparent',
@@ -268,9 +255,10 @@ const TransactionList = ({
268255
enableShimmer={isLoading}
269256
columns={transactionColumns}
270257
items={txs}
271-
groups={groups.filter(group => group.count !== 0)}
258+
groups={groups}
272259
groupProps={{
273-
onRenderHeader,
260+
collapseAllVisibility: CollapseAllVisibility.hidden,
261+
onRenderHeader: GroupHeader,
274262
}}
275263
checkboxVisibility={CheckboxVisibility.hidden}
276264
onItemInvoked={item => {
@@ -282,7 +270,7 @@ const TransactionList = ({
282270
}
283271
}}
284272
className="listWithDesc"
285-
onRenderRow={onRenderRow}
273+
onRenderRow={HistoryRow}
286274
/>
287275
)
288276
}

0 commit comments

Comments
 (0)