Skip to content

Commit f244f11

Browse files
committed
refactor: update widgets
1 parent 00d5e7a commit f244f11

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/components/widgets/CWidgetDropdown.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { CCardBody } from '../card/CCardBody'
99

1010
export interface CWidgetDropdownProps extends HTMLAttributes<HTMLDivElement> {
1111
action?: string | ReactNode
12+
change?: string | ReactNode
1213
chart?: string | ReactNode
1314
/**
1415
* A string of all className you want applied to the base component. [docs]
@@ -25,7 +26,7 @@ export interface CWidgetDropdownProps extends HTMLAttributes<HTMLDivElement> {
2526
}
2627

2728
export const CWidgetDropdown = forwardRef<HTMLDivElement, CWidgetDropdownProps>(
28-
({ action, chart, className, color, title, value, ...rest }, ref) => {
29+
({ action, change, chart, className, color, title, value, ...rest }, ref) => {
2930
const _className = classNames(
3031
{ [`bg-${color}`]: color, 'text-high-emphasis-inverse': color },
3132
className,
@@ -35,7 +36,11 @@ export const CWidgetDropdown = forwardRef<HTMLDivElement, CWidgetDropdownProps>(
3536
<CCard className={_className} {...rest} ref={ref}>
3637
<CCardBody className="pb-0 d-flex justify-content-between align-items-start">
3738
<div>
38-
{value && <div className="fs-4 fw-semibold">{value}</div>}
39+
{value && (
40+
<div className="fs-4 fw-semibold">
41+
{value} {change && <span className="fs-6 fw-normal">{change}</span>}
42+
</div>
43+
)}
3944
{title && <div>{title}</div>}
4045
</div>
4146
{action}
@@ -48,6 +53,7 @@ export const CWidgetDropdown = forwardRef<HTMLDivElement, CWidgetDropdownProps>(
4853

4954
CWidgetDropdown.propTypes = {
5055
action: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
56+
change: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
5157
chart: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
5258
className: PropTypes.string,
5359
color: colorPropType,

src/components/widgets/CWidgetProgress.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@ export const CWidgetProgress = forwardRef<HTMLDivElement, CWidgetProgressProps>(
6565
value={progressValue}
6666
white={progressWhite}
6767
/>
68-
{text && <small className="text-medium-emphasis">{text}</small>}
68+
{text && (
69+
<small
70+
className={
71+
textColor === 'white' ? 'text-medium-emphasis-inverse' : 'text-medium-emphasis'
72+
}
73+
>
74+
{text}
75+
</small>
76+
)}
6977
</CCardBody>
7078
</CCard>
7179
)

0 commit comments

Comments
 (0)