-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mespapiers): Add ScanResultInfo component
This component is used to display a kind of tooltip with an image and a text.
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions
50
packages/cozy-mespapiers-lib/src/components/ModelSteps/ScanResultInfo.jsx
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,50 @@ | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
|
||
import Icon from 'cozy-ui/transpiled/react/Icon' | ||
import { iconPropType } from 'cozy-ui/transpiled/react/Icon' | ||
import Typography from 'cozy-ui/transpiled/react/Typography' | ||
|
||
import Spike from '../../assets/icons/Spike.svg' | ||
import CompositeHeaderImage from '../CompositeHeader/CompositeHeaderImage' | ||
|
||
const ScanResultInfo = ({ icon, text, className }) => { | ||
return ( | ||
<div | ||
className={cx( | ||
'u-flex u-flex-items-center u-flex-justify-center u-p-1 u-bdrs-4', | ||
className | ||
)} | ||
style={{ | ||
backgroundColor: 'var(--defaultBackgroundColor)', | ||
gap: '1rem', | ||
position: 'relative' | ||
}} | ||
> | ||
<CompositeHeaderImage icon={icon} iconSize="small" /> | ||
<Typography variant="body2">{text}</Typography> | ||
<Icon | ||
icon={Spike} | ||
size={24} | ||
style={{ | ||
position: 'absolute', | ||
color: 'var(--defaultBackgroundColor)', | ||
bottom: -17, | ||
left: 0, | ||
right: 0, | ||
marginLeft: 'auto', | ||
marginRight: 'auto' | ||
}} | ||
aria-hidden="true" | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
ScanResultInfo.propTypes = { | ||
icon: iconPropType, | ||
text: PropTypes.string | ||
} | ||
|
||
export default ScanResultInfo |