mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3927 from overleaf/msm-react-navbar-rename-tooltip
React navbar rename tooltip GitOrigin-RevId: a933aa8654e0c5b0e22cfc72f6262cc75da0ccf7
This commit is contained in:
parent
1436731053
commit
82d7d6681e
2 changed files with 15 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
|||
import React, { useEffect, useState, useRef } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { OverlayTrigger, Tooltip } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import classNames from 'classnames'
|
||||
import Icon from '../../../shared/components/icon'
|
||||
|
||||
|
@ -9,6 +11,8 @@ function ProjectNameEditableLabel({
|
|||
onChange,
|
||||
className,
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const [isRenaming, setIsRenaming] = useState(false)
|
||||
|
||||
const canRename = userIsAdmin && !isRenaming
|
||||
|
@ -63,10 +67,16 @@ function ProjectNameEditableLabel({
|
|||
/>
|
||||
)}
|
||||
{canRename && (
|
||||
// eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus
|
||||
<a className="rename" role="button" onClick={startRenaming}>
|
||||
<Icon type="pencil" modifier="fw" />
|
||||
</a>
|
||||
<OverlayTrigger
|
||||
placement="bottom"
|
||||
trigger={['hover', 'focus']}
|
||||
overlay={<Tooltip id="tooltip-online-user">{t('rename')}</Tooltip>}
|
||||
>
|
||||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid, jsx-a11y/click-events-have-key-events, jsx-a11y/interactive-supports-focus */}
|
||||
<a className="rename" role="button" onClick={startRenaming}>
|
||||
<Icon type="pencil" modifier="fw" />
|
||||
</a>
|
||||
</OverlayTrigger>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -225,6 +225,7 @@
|
|||
color: @project-rename-link-color;
|
||||
padding: 5px;
|
||||
border-radius: @border-radius-small;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
|
||||
color: @project-rename-link-color-hover;
|
||||
|
|
Loading…
Reference in a new issue