Skip to content

Commit

Permalink
feat: making new and removing old tooltip component
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian committed Aug 6, 2021
1 parent f463ac9 commit 73a1450
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
16 changes: 0 additions & 16 deletions src/Common/Icon/FBtooltip.js

This file was deleted.

9 changes: 7 additions & 2 deletions src/Common/Icon/Icon.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import QuestionIcon from './Icons/QuestionIcon'
/** @jsx jsx */
/** @jsxRuntime classic */
import QuestionIcon from './Icons/QuestionIcon'
import { jsx } from 'theme-ui'
import style from './icon.module.css'

const Icon = (props) => {
const { name, ...iconProperties } = props.icon
const { config, textStyle } = props.tooltip

return (
<div data-event='click focus' data-tip='custom show'>
<div className={style.tooltip}>
{{
'question-circle': <QuestionIcon {...iconProperties} />
}[name] || <p>Icon Not found</p>}
<div className={style.top} style={{ ...config }}>
<p sx={{ ...textStyle }}>{props.tooltip.text}</p>
</div>
</div>
)
}
Expand Down
10 changes: 5 additions & 5 deletions src/Questions/Input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import ErrorMessage from '../../Fields/Error'
import Input from '../../Fields/Input'
import Label from '../../Fields/Label'
import Icon from '../../Common/Icon/Icon'
import FBtooltip from '../../Common/Icon/FBtooltip'

/** @jsx jsx */
/** @jsxRuntime classic */
Expand Down Expand Up @@ -35,10 +34,11 @@ const QuestionInput = ({ question, useForm, component }) => {

{question.icon && (
<div>
<Icon icon={question.icon} sx={{ variant: 'forms.icon' }} />
{question.tooltip && question.tooltip.text && (
<FBtooltip tooltip={question.tooltip} />
)}
<Icon
icon={question.icon}
tooltip={question.tooltip}
sx={{ variant: 'forms.icon' }}
/>
</div>
)}
</div>
Expand Down

0 comments on commit 73a1450

Please sign in to comment.