Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI core library] Tooltip #13

Closed
aigoncharov opened this issue Oct 9, 2020 · 1 comment · Fixed by #27
Closed

[UI core library] Tooltip #13

aigoncharov opened this issue Oct 9, 2020 · 1 comment · Fixed by #27
Assignees
Labels
Milestone

Comments

@aigoncharov
Copy link
Contributor

aigoncharov commented Oct 9, 2020

https://www.figma.com/file/kaC3jgqMSgqMEgnv7TIse1/%F0%9F%93%90Sign-in-flow?node-id=118%3A2349

Implement only the desktop version

  1. Create a component with API (match existing HzTooltip)
    1. overlay
    2. visible
@aigoncharov
Copy link
Contributor Author

Previous implementation

import React, { FC, ReactElement } from 'react'
import Tooltip from 'rc-tooltip'
import { TooltipProps } from 'rc-tooltip/lib/Tooltip'

import 'rc-tooltip/assets/bootstrap.css'

import styles from './HzTooltip.module.scss'

export type HzTooltipProps = TooltipProps & {
  wrapMaxWidth?: boolean
  wrapElement?: boolean
}

export const HzTooltip: FC<
  HzTooltipProps & {
    children: ReactElement
  }
> = ({
  overlay,
  wrapMaxWidth = true,
  wrapElement = false,
  children,
  ...props
}) => {
  return overlay ? (
    <Tooltip
      overlay={
        wrapMaxWidth ? <div className={styles.wrapper}>{overlay}</div> : overlay
      }
      {...props}
    >
      {wrapElement ? (
        // TODO: remove once https://github.com/react-component/tooltip/issues/18#issuecomment-411476678 has been resolved
        <div style={{ display: 'inline-block' }}>{children}</div>
      ) : (
        children
      )}
    </Tooltip>
  ) : (
    children
  )
}
.wrapper {
  max-width: 550px;
  word-wrap: break-word;
}

@jozefhruska jozefhruska mentioned this issue Oct 15, 2020
3 tasks
aigoncharov pushed a commit that referenced this issue Nov 3, 2020
@aigoncharov aigoncharov added this to the 1.0.0 milestone Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants