File tree Expand file tree Collapse file tree 6 files changed +93
-1
lines changed Expand file tree Collapse file tree 6 files changed +93
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.1.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 1.7.0]
9+
10+ ### Added
11+
12+ - Added ` SummaryCard ` component.
13+
814## [ 1.6.7]
915
1016### Refactor
Original file line number Diff line number Diff line change 11{
22 "name" : " 1byte-react-design" ,
3- "version" : " 1.6.7 " ,
3+ "version" : " 1.7.0 " ,
44 "description" : " A simple React UI library" ,
55 "main" : " dist/index.js" ,
66 "module" : " dist/index.js" ,
Original file line number Diff line number Diff line change 1+ import { Typography } from '../..' ;
2+ import { Space } from '../../molecules' ;
3+ import { SummaryCardWrapper } from './styles' ;
4+ import { RdSummaryCardProps } from './types' ;
5+
6+ export const SummaryCard : React . FC < RdSummaryCardProps > = props => {
7+ const {
8+ format = 'number' ,
9+ value,
10+ subValue = null ,
11+ label = 'Total' ,
12+ subLabel = null ,
13+ ...cardProps
14+ } = props ;
15+
16+ return (
17+ < SummaryCardWrapper { ...cardProps } >
18+ < Space direction = "vertical" block size = { 0 } >
19+ < Typography . Text strong type = "secondary" >
20+ { label }
21+ </ Typography . Text >
22+ < Space align = "baseline" >
23+ < Typography . Title level = { 1 } disableMargin >
24+ { value }
25+ </ Typography . Title >
26+ </ Space >
27+
28+ { ( subLabel || subValue ) && (
29+ < Space >
30+ { subLabel && (
31+ < Typography . Text strong type = "secondary" >
32+ { subLabel }
33+ </ Typography . Text >
34+ ) }
35+ { subValue && < Typography . Text strong > { subValue } </ Typography . Text > }
36+ </ Space >
37+ ) }
38+ </ Space >
39+ </ SummaryCardWrapper >
40+ ) ;
41+ } ;
Original file line number Diff line number Diff line change 1+ import styled from '@emotion/styled' ;
2+ import { Card } from '../../molecules' ;
3+
4+ export const SummaryCardWrapper = styled ( Card ) `` ;
Original file line number Diff line number Diff line change 1+ import { ReactNode } from 'react' ;
2+ import { RdCardProps } from '../../molecules' ;
3+
4+ export interface RdSummaryCardProps extends RdCardProps {
5+ /**
6+ * Determines the display format of values.
7+ *
8+ * - `"number"` → renders plain number format.
9+ * - `"currency"` → renders values as currency.
10+ *
11+ * @default "number"
12+ */
13+ format ?: 'number' | 'currency' ;
14+
15+ /**
16+ * The main numeric value to display.
17+ * Usually represents the total amount or main KPI.
18+ */
19+ value : ReactNode ;
20+
21+ /**
22+ * The secondary numeric value to display.
23+ * Typically represents today's or a breakdown value.
24+ */
25+ subValue ?: ReactNode ;
26+
27+ /**
28+ * Label displayed above the main value.
29+ *
30+ * @default "Total"
31+ */
32+ label ?: string ;
33+
34+ /**
35+ * Label displayed next to the sub value.
36+ *
37+ * @default "Today total"
38+ */
39+ subLabel ?: string ;
40+ }
Original file line number Diff line number Diff line change 11export * from './App' ;
22export * from './ConfigProvider' ;
3+ export * from './SummaryCard'
You can’t perform that action at this time.
0 commit comments