Skip to content

Commit 20bbf33

Browse files
committed
feat(neuron-ui): use the same style of overview on nervos dao overview
1 parent 1784095 commit 20bbf33

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useCallback, useMemo } from 'react'
22
import { RouteComponentProps } from 'react-router-dom'
33
import { useTranslation } from 'react-i18next'
44
import { Stack, Text, DefaultButton, Icon, TooltipHost, Spinner } from 'office-ui-fabric-react'
5+
import PropertyList from 'widgets/PropertyList'
56

67
import appState from 'states/initStates/app'
78
import { AppActions, StateWithDispatch } from 'states/stateProvider/reducer'
@@ -282,6 +283,17 @@ const NervosDAO = ({
282283
)
283284
}, [epoch])
284285

286+
const lockAndFreeProperties = [
287+
{
288+
label: t('nervos-dao.free'),
289+
value: `${shannonToCKBFormatter(`${free}`)} CKB`,
290+
},
291+
{
292+
label: t('nervos-dao.locked'),
293+
value: `${shannonToCKBFormatter(`${locked}`)} CKB`,
294+
},
295+
]
296+
285297
return (
286298
<>
287299
<Stack tokens={{ childrenGap: 15 }} horizontalAlign="stretch">
@@ -290,14 +302,7 @@ const NervosDAO = ({
290302
</Text>
291303
<Stack horizontal tokens={{ childrenGap: 15 }}>
292304
<Stack style={{ minWidth: '250px' }} tokens={{ childrenGap: 10 }}>
293-
<Stack horizontalAlign="space-between" horizontal>
294-
<Text>{`${t('nervos-dao.free')}: `}</Text>
295-
<Text>{`${shannonToCKBFormatter(`${free}`)} CKB`}</Text>
296-
</Stack>
297-
<Stack horizontalAlign="space-between" horizontal>
298-
<Text>{`${t('nervos-dao.locked')}: `}</Text>
299-
<Text>{`${shannonToCKBFormatter(`${locked}`)} CKB`}</Text>
300-
</Stack>
305+
<PropertyList properties={lockAndFreeProperties} />
301306
</Stack>
302307
<Stack horizontal verticalAlign="center" tokens={{ childrenGap: 15 }}>
303308
<DefaultButton

packages/neuron-ui/src/widgets/PropertyList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const onRenderCell = (item?: Property & CellStyles) =>
2828
</span>
2929
<span
3030
className={styles.value}
31-
style={{ width: item.valueWidth || 'auto', fontSize: theme.fonts.small.fontSize }}
31+
style={{ width: item.valueWidth || 'auto', fontSize: theme.fonts.small.fontSize, textAlign: 'right' }}
3232
title={`${item.value}`}
3333
aria-label={item.label}
3434
>

0 commit comments

Comments
 (0)