feat: custom tooltip instead of browser tooltip

fix: remove default browser tooltip
fix: rename HelpTooltip into Tooltip
feat: allow custom tooltip element
fix: open cashout fudgefactor help tooltip on click
feat: edit and delete (editabletable) custom tooltip
feat: custom tooltip on single field editables
feat: SingleRowTable custom tooltip
feat: custom tooltip on modal close button
fix: operatorinfo custom tooltip
feat: confirmdialog custom close tooltip
fix: remove browser default tooltip from action buttons
fix: eslint
This commit is contained in:
Mauricio Navarro Miranda 2020-08-13 04:26:42 -05:00 committed by Josh Harvey
parent f700b29b3d
commit 653f939856
18 changed files with 250 additions and 145 deletions

View file

@ -3,10 +3,11 @@ import { Field, useFormikContext } from 'formik'
import * as R from 'ramda'
import React, { useContext } from 'react'
import Tooltip from 'src/components/Tooltip'
import { Link, IconButton } from 'src/components/buttons'
import { Td, Tr } from 'src/components/fake-table/Table'
import { Switch } from 'src/components/inputs'
import { TL2 } from 'src/components/typography'
import { TL2, P } from 'src/components/typography'
import { ReactComponent as DisabledDeleteIcon } from 'src/styling/icons/action/delete/disabled.svg'
import { ReactComponent as DeleteIcon } from 'src/styling/icons/action/delete/enabled.svg'
import { ReactComponent as DisabledEditIcon } from 'src/styling/icons/action/edit/disabled.svg'
@ -54,19 +55,46 @@ const ActionCol = ({ disabled, editing }) => {
)}
{!editing && enableEdit && (
<Td textAlign="center" width={editWidth}>
<IconButton
disabled={disableEdit}
className={classes.editButton}
onClick={() => onEdit && onEdit(values.id)}>
{disableEdit ? <DisabledEditIcon /> : <EditIcon />}
</IconButton>
{!disableEdit && (
<Tooltip
enableOver
element={
<IconButton
className={classes.editButton}
onClick={() => onEdit && onEdit(values.id)}>
<EditIcon />
</IconButton>
}>
<P>Modify row contents</P>
</Tooltip>
)}
{disableEdit && (
<IconButton disabled className={classes.editButton}>
<DisabledEditIcon />
</IconButton>
)}
</Td>
)}
{!editing && enableDelete && (
<Td textAlign="center" width={deleteWidth}>
<IconButton disabled={disabled} onClick={() => onDelete(values.id)}>
{disabled ? <DisabledDeleteIcon /> : <DeleteIcon />}
</IconButton>
{!disabled && (
<Tooltip
enableOver
element={
<IconButton onClick={() => onDelete(values.id)}>
<DeleteIcon />
</IconButton>
}>
<P>Delete row</P>
</Tooltip>
)}
{disabled && (
<IconButton disabled>
<DisabledDeleteIcon />
</IconButton>
)}
</Td>
)}
{!editing && enableToggle && (