Skip to content

Commit

Permalink
feat(neuron-ui): disable fadein animation on details list
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Aug 5, 2019
1 parent 5fa5af5 commit cb3153d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/neuron-ui/src/components/Addresses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { StateWithDispatch } from 'states/stateProvider/reducer'
import { useLocalDescription } from 'utils/hooks'
import { MIN_CELL_WIDTH, Routes } from 'utils/const'
import { localNumberFormatter, shannonToCKBFormatter } from 'utils/formatters'
import { onRenderRow } from 'utils/fabricUIRender'

const Addresses = ({
app: {
Expand Down Expand Up @@ -180,6 +181,7 @@ const Addresses = ({
contextMenu({ type: 'addressList', id: item.identifier })
}}
className="listWithDesc"
onRenderRow={onRenderRow}
/>
)
}
Expand Down
7 changes: 6 additions & 1 deletion packages/neuron-ui/src/components/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,14 @@ const Overview = ({

const onTransactionRowRender = useCallback((props?: IDetailsRowProps) => {
if (props) {
const customStyles: Partial<IDetailsRowStyles> = {}
const customStyles: Partial<IDetailsRowStyles> = {
root: {
animationDuration: '0!important',
},
}
if (props.item.status === 'failed') {
customStyles.root = {
animationDuration: '0!important',
color: 'red',
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/neuron-ui/src/components/TransactionList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { contextMenu, showTransactionDetails } from 'services/remote'

import { useLocalDescription } from 'utils/hooks'
import { shannonToCKBFormatter, uniformTimeFormatter as timeFormatter, uniformTimeFormatter } from 'utils/formatters'
import { onRenderRow } from 'utils/fabricUIRender'

const theme = getTheme()

Expand Down Expand Up @@ -212,6 +213,7 @@ const TransactionList = ({
}
}}
className="listWithDesc"
onRenderRow={onRenderRow}
/>
)
}
Expand Down
19 changes: 19 additions & 0 deletions packages/neuron-ui/src/utils/fabricUIRender.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import { DetailsRow, IDetailsRowProps } from 'office-ui-fabric-react'

export const onRenderRow = (rowProps?: IDetailsRowProps) => {
return rowProps ? (
<DetailsRow
{...rowProps}
styles={{
root: {
animationDuration: '0!important',
},
}}
/>
) : null
}

export default {
onRenderRow,
}

0 comments on commit cb3153d

Please sign in to comment.