Skip to content

Commit 4440c86

Browse files
kazup01Davy-c
authored andcommitted
Add tooltip for edit button on doc preview
1 parent 0f4c670 commit 4440c86

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/cloud/components/DocPreview/index.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import {
3030
modalEventEmitter,
3131
togglePreviewModeEventEmitter,
3232
} from '../../lib/utils/events'
33+
import WithTooltip from '../../../design/components/atoms/WithTooltip'
34+
import { osName } from '../../../design/lib/platform'
3335
import { getDocTitle } from '../../lib/utils/patterns'
3436
import DocProperties from '../DocProperties'
3537
import { getDocLinkHref } from '../Link/DocLink'
@@ -168,15 +170,20 @@ const DocPreviewModal = ({ doc, team, fallbackUrl }: DocPreviewModalProps) => {
168170
<Flexbox className='doc-preview__actions'>
169171
{renderHeader}
170172
{currentUserIsCoreMember && (
171-
<Button
172-
variant='icon'
173-
iconPath={mode === 'preview' ? mdiPencil : mdiEyeOutline}
174-
onClick={() =>
175-
setMode((prev) => (prev === 'preview' ? 'editor' : 'preview'))
176-
}
177-
id='doc-preview__edit'
178-
size='sm'
179-
/>
173+
<WithTooltip
174+
tooltip={osName == 'macos' ? 'Cmd+E' : 'Ctrl+E'}
175+
side='bottom'
176+
>
177+
<Button
178+
variant='icon'
179+
iconPath={mode === 'preview' ? mdiPencil : mdiEyeOutline}
180+
onClick={() =>
181+
setMode((prev) => (prev === 'preview' ? 'editor' : 'preview'))
182+
}
183+
id='doc-preview__edit'
184+
size='sm'
185+
/>
186+
</WithTooltip>
180187
)}
181188
<Button
182189
variant='icon'
@@ -281,7 +288,8 @@ const Container = styled.div`
281288
282289
.doc-preview__content {
283290
padding: ${({ theme }) => theme.sizes.spaces.df}px
284-
${({ theme }) => theme.sizes.spaces.xl}px 0 ${({ theme }) => theme.sizes.spaces.xl}px;
291+
${({ theme }) => theme.sizes.spaces.xl}px 0
292+
${({ theme }) => theme.sizes.spaces.xl}px;
285293
}
286294
287295
.doc-preview__title__wrapper {

0 commit comments

Comments
 (0)