Skip to content

Commit

Permalink
feat: Decimal support Progress Table Cell Type h2oai#824
Browse files Browse the repository at this point in the history
  • Loading branch information
arshar2411 committed Dec 9, 2023
1 parent 7887ef6 commit 5bf77d5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ui/src/progress_table_cell_type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import * as Fluent from '@fluentui/react'
import { F, S } from './core'
import { F, S, B } from './core'
import React from 'react'
import { stylesheet } from 'typestyle'
import { ProgressArc } from './parts/progress_arc'
Expand Down Expand Up @@ -46,11 +46,17 @@ export interface ProgressTableCellType {
name?: S
}

export const XProgressTableCellType = ({ model: m, progress }: { model: ProgressTableCellType, progress: F }) => (
export const XProgressTableCellType = ({ model: m, progress, decimals }: { model: ProgressTableCellType, progress: F, decimals?: B }) => (
<div data-test={m.name} className={css.container}>
<ProgressArc thickness={2} color={cssVar(m.color || '$red')} value={progress} />
<Fluent.Stack horizontalAlign='center' verticalAlign='center' className={clas(css.percentContainer, 'wave-s12')}>
<div className={css.percent}>{`${Math.round(progress * 100)}%`}</div>
<div className={css.percent}>
{decimals ? (
`${Math.round(progress *10000)/ 100}%`
) : (
`${Math.round(progress * 100)}%`
)}
</div>
</Fluent.Stack>
</div >
)

0 comments on commit 5bf77d5

Please sign in to comment.