-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add QualificationIconStack component
- Loading branch information
Showing
3 changed files
with
103 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
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,11 @@ | ||
```jsx | ||
import QualificationIconStack from 'cozy-ui/transpiled/react/QualificationIconStack' | ||
|
||
; | ||
|
||
<> | ||
<QualificationIconStack qualification="isp_invoice" /> | ||
<QualificationIconStack qualification="phone_invoice" /> | ||
<QualificationIconStack qualification="family_record_book" /> | ||
</> | ||
``` |
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,91 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
|
||
import { getIconByLabel } from 'cozy-client/dist/models/document/qualification' | ||
|
||
import Icon from '../Icon' | ||
import IconStack from '../IconStack' | ||
import BankIcon from '../Icons/Bank' | ||
import BankCheckIcon from '../Icons/BankCheck' | ||
import BenefitIcon from '../Icons/Benefit' | ||
import BillIcon from '../Icons/Bill' | ||
import CarIcon from '../Icons/Car' | ||
import ChildIcon from '../Icons/Child' | ||
import EmailIcon from '../Icons/Email' | ||
import EuroIcon from '../Icons/Euro' | ||
import ExchangeIcon from '../Icons/Exchange' | ||
import FileDuotoneIcon from '../Icons/FileDuotone' | ||
import FileTypeNoteIcon from '../Icons/FileTypeNote' | ||
import FitnessIcon from '../Icons/Fitness' | ||
import GlobeIcon from '../Icons/Globe' | ||
import GouvIcon from '../Icons/Gouv' | ||
import HeartIcon from '../Icons/Heart' | ||
import HomeIcon from '../Icons/Home' | ||
import ImageIcon from '../Icons/Image' | ||
import JusticeIcon from '../Icons/Justice' | ||
import LaudryIcon from '../Icons/Laudry' | ||
import LightningIcon from '../Icons/Lightning' | ||
import PeopleIcon from '../Icons/People' | ||
import PlaneIcon from '../Icons/Plane' | ||
import RemboursementIcon from '../Icons/Remboursement' | ||
import RestaurantIcon from '../Icons/Restaurant' | ||
import SchoolIcon from '../Icons/School' | ||
import ShopIcon from '../Icons/Shop' | ||
import TeamIcon from '../Icons/Team' | ||
import TelecomIcon from '../Icons/Telecom' | ||
import TelephoneIcon from '../Icons/Telephone' | ||
import WaterIcon from '../Icons/Water' | ||
import WorkIcon from '../Icons/Work' | ||
|
||
const qualificationIcon = { | ||
'bank-check': BankCheckIcon, | ||
bank: BankIcon, | ||
benefit: BenefitIcon, | ||
bill: BillIcon, | ||
car: CarIcon, | ||
child: ChildIcon, | ||
email: EmailIcon, | ||
euro: EuroIcon, | ||
exchange: ExchangeIcon, | ||
'file-type-note': FileTypeNoteIcon, | ||
fitness: FitnessIcon, | ||
globe: GlobeIcon, | ||
gouv: GouvIcon, | ||
heart: HeartIcon, | ||
home: HomeIcon, | ||
image: ImageIcon, | ||
justice: JusticeIcon, | ||
laudry: LaudryIcon, | ||
lightning: LightningIcon, | ||
people: PeopleIcon, | ||
plane: PlaneIcon, | ||
remboursement: RemboursementIcon, | ||
restaurant: RestaurantIcon, | ||
school: SchoolIcon, | ||
shop: ShopIcon, | ||
team: TeamIcon, | ||
telecom: TelecomIcon, | ||
telephone: TelephoneIcon, | ||
water: WaterIcon, | ||
work: WorkIcon | ||
} | ||
|
||
const QualificationIconStack = ({ qualification }) => { | ||
const QualificationIcon = qualificationIcon[getIconByLabel(qualification)] | ||
|
||
return ( | ||
<IconStack | ||
backgroundIcon={<Icon icon={FileDuotoneIcon} color="#E049BF" size={32} />} | ||
foregroundIcon={ | ||
<Icon icon={QualificationIcon} color="#E049BF" size={16} /> | ||
} | ||
/> | ||
) | ||
} | ||
|
||
QualificationIconStack.propTypes = { | ||
/** The name of the qualification (isp\_invoice, family\_record\_book, etc.) */ | ||
qualification: PropTypes.string | ||
} | ||
|
||
export default QualificationIconStack |