Skip to content

Commit

Permalink
feat: Add QualificationIconStack component
Browse files Browse the repository at this point in the history
  • Loading branch information
JF-Cozy committed Dec 4, 2024
1 parent 4a2e976 commit 709bb71
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ module.exports = {
'../react/Sidebar',
'../react/SquareAppIcon',
'../react/QualificationGrid',
'../react/QualificationIconStack',
'../react/QualificationItem',
'../react/UploadQueue'
]
Expand Down
11 changes: 11 additions & 0 deletions react/QualificationIconStack/Readme.md
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" />
</>
```
91 changes: 91 additions & 0 deletions react/QualificationIconStack/index.jsx
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

0 comments on commit 709bb71

Please sign in to comment.