|
@ -28,10 +28,14 @@ const T = styled(Box).attrs({ |
|
|
white-space: pre; |
|
|
white-space: pre; |
|
|
` |
|
|
` |
|
|
|
|
|
|
|
|
const I = ({ color, children }: { color: string, children: any }) => ( |
|
|
const I = ({ color, children }: { color?: string, children: any }) => ( |
|
|
<Box color={color}>{children}</Box> |
|
|
<Box color={color}>{children}</Box> |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
I.defaultProps = { |
|
|
|
|
|
color: undefined, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const mapStateToProps = state => ({ |
|
|
const mapStateToProps = state => ({ |
|
|
settings: state.settings, |
|
|
settings: state.settings, |
|
|
}) |
|
|
}) |
|
@ -43,14 +47,14 @@ type Props = { |
|
|
disableRounding?: boolean, |
|
|
disableRounding?: boolean, |
|
|
fiat?: string | null, |
|
|
fiat?: string | null, |
|
|
isPercent?: boolean, |
|
|
isPercent?: boolean, |
|
|
settings: Settings, |
|
|
settings?: Settings, |
|
|
showCode?: boolean, |
|
|
showCode?: boolean, |
|
|
unit?: Unit | null, |
|
|
unit?: Unit | null, |
|
|
val: number, |
|
|
val: number, |
|
|
withIcon?: boolean, |
|
|
withIcon?: boolean, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function FormattedVal(props: Props) { |
|
|
export function FormattedVal(props: Props) { |
|
|
const { |
|
|
const { |
|
|
animateTicker, |
|
|
animateTicker, |
|
|
disableRounding, |
|
|
disableRounding, |
|
@ -97,25 +101,21 @@ function FormattedVal(props: Props) { |
|
|
text = <Ticker text={text} /> |
|
|
text = <Ticker text={text} /> |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const marketColor = getMarketColor({ |
|
|
const marketColor = settings |
|
|
|
|
|
? getMarketColor({ |
|
|
marketIndicator: settings.marketIndicator, |
|
|
marketIndicator: settings.marketIndicator, |
|
|
isNegative, |
|
|
isNegative, |
|
|
}) |
|
|
}) |
|
|
|
|
|
: undefined |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<T color={color || marketColor} withIcon={withIcon} {...p}> |
|
|
<T color={color || marketColor} withIcon={withIcon} {...p}> |
|
|
{withIcon ? ( |
|
|
{withIcon ? ( |
|
|
<Box horizontal alignItems="center" flow={1}> |
|
|
<Box horizontal alignItems="center" flow={1}> |
|
|
<Box> |
|
|
<Box> |
|
|
{isNegative ? ( |
|
|
|
|
|
<I color={marketColor}> |
|
|
<I color={marketColor}> |
|
|
<IconBottom size={16} /> |
|
|
{isNegative ? <IconBottom size={16} /> : <IconTop size={16} />} |
|
|
</I> |
|
|
</I> |
|
|
) : ( |
|
|
|
|
|
<I color={marketColor}> |
|
|
|
|
|
<IconTop size={16} /> |
|
|
|
|
|
</I> |
|
|
|
|
|
)} |
|
|
|
|
|
</Box> |
|
|
</Box> |
|
|
<Box horizontal alignItems="center"> |
|
|
<Box horizontal alignItems="center"> |
|
|
{text} |
|
|
{text} |
|
@ -135,6 +135,7 @@ FormattedVal.defaultProps = { |
|
|
disableRounding: false, |
|
|
disableRounding: false, |
|
|
fiat: null, |
|
|
fiat: null, |
|
|
isPercent: false, |
|
|
isPercent: false, |
|
|
|
|
|
settings: undefined, |
|
|
showCode: false, |
|
|
showCode: false, |
|
|
unit: null, |
|
|
unit: null, |
|
|
withIcon: false, |
|
|
withIcon: false, |
|
|