Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLAY-221] ♻️ Typescript Conversion: Dashboard Value #2316

Merged
merged 2 commits into from Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,3 @@
/* @flow */

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
Expand All @@ -11,22 +9,22 @@ import StatValue from '../pb_stat_value/_stat_value'

type DashboardValueProps = {
align?: 'left' | 'center' | 'right',
aria?: object,
aria?: { [key: string]: string },
className?: string,
data?: object,
data?: { [key: string]: string },
id?: string,
statChange?: {
change?: string,
value?: string | Number
change? : 'increase' | 'decrease' | 'neutral',
value?: string | number
},
statLabel?: string,
statValue?: {
unit?: string,
value?: string | Number
value?: string | number
}
}

const DashboardValue = (props: DashboardValueProps) => {
const DashboardValue = (props: DashboardValueProps): React.ReactElement => {
const {
align = 'left',
aria = {},
Expand All @@ -53,21 +51,21 @@ const DashboardValue = (props: DashboardValueProps) => {
className={classes}
id={id}
>
<If condition={statLabel}>
{ statLabel &&
<Body color="light">{statLabel}</Body>
</If>
<If condition={statValue}>
}
{ statValue &&
<StatValue
unit={statValue.unit}
value={statValue.value}
/>
</If>
<If condition={statChange}>
}
{ statChange &&
<StatChange
change={statChange.change}
value={statChange.value}
/>
</If>
}
</div>
)
}
Expand Down