-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* adds reusable stats card * refactors the code * adds missing exports in index.ts file
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/components/primitive/stats-card/stats-card.component.props.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { TextComponentProps } from './../text/text.component.props'; | ||
import { AvatarComponentProps } from './../avatar/avatar.component.props'; | ||
|
||
export interface StatsComponentProps { | ||
/** | ||
* Name of the Icon. | ||
*/ | ||
iconName: AvatarComponentProps; | ||
|
||
/** | ||
* Headline for Stats Card. | ||
*/ | ||
heading: TextComponentProps; | ||
|
||
/** | ||
* Count for Stats Card. | ||
*/ | ||
count?: TextComponentProps; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/components/primitive/stats-card/stats-card.component.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import styled from 'styled-components'; | ||
|
||
/** | ||
* Styles for Stats Container. | ||
*/ | ||
export const StatsContainer = styled.div` | ||
display: flex; | ||
gap: 1.6rem; | ||
width: fit-content; | ||
`; | ||
|
||
/** | ||
* Styles for CountContainer. | ||
*/ | ||
export const CountContainer = styled.span` | ||
display: inline-flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
`; |
17 changes: 17 additions & 0 deletions
17
src/components/primitive/stats-card/stats-card.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Avatar, Text } from 'components/primitive'; | ||
import { StatsComponentProps } from './stats-card.component.props'; | ||
import { StatsContainer, CountContainer } from './stats-card.component.styles'; | ||
|
||
export const StatsCard: React.FC<StatsComponentProps> = (props) => { | ||
const { heading, count, iconName } = props; | ||
|
||
return ( | ||
<StatsContainer> | ||
<Avatar size='large' flat {...iconName} /> | ||
<CountContainer> | ||
<Text variant='small' color='textLight' {...heading} /> | ||
<Text variant='contentHeader' {...count} /> | ||
</CountContainer> | ||
</StatsContainer> | ||
); | ||
}; |