mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-09 13:51:57 -04:00
feature: add button to open cheatsheet in a new tab
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
438a5466e0
commit
9b9eafc948
7 changed files with 108 additions and 39 deletions
|
@ -15,7 +15,6 @@ import type { Icon } from 'react-bootstrap-icons'
|
|||
|
||||
export interface IconButtonProps extends ButtonProps, PropsWithDataTestId {
|
||||
icon: Icon
|
||||
onClick?: () => void
|
||||
border?: boolean
|
||||
iconSize?: number | string
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import { cypressId } from '../../../utils/cypress-attribute'
|
|||
import { testId } from '../../../utils/test-id'
|
||||
import { UiIcon } from '../icons/ui-icon'
|
||||
import { ShowIf } from '../show-if/show-if'
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import React, { useMemo } from 'react'
|
||||
import type { PropsWithChildren, ReactElement } from 'react'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
import { Modal } from 'react-bootstrap'
|
||||
import type { Icon } from 'react-bootstrap-icons'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
|
@ -26,6 +26,7 @@ export interface ModalContentProps {
|
|||
titleIcon?: Icon
|
||||
modalSize?: 'lg' | 'sm' | 'xl'
|
||||
additionalClasses?: string
|
||||
additionalTitleElement?: ReactElement
|
||||
}
|
||||
|
||||
export type CommonModalProps = PropsWithDataCypressId & ModalVisibilityProps & ModalContentProps
|
||||
|
@ -42,6 +43,7 @@ export type CommonModalProps = PropsWithDataCypressId & ModalVisibilityProps & M
|
|||
* @param modalSize The modal size
|
||||
* @param children The children to render into the modal.
|
||||
* @param titleIsI18nKey If the title is a i18n key and should be used as such
|
||||
* @param additionalTitleElement additional optional element that should be shown in the header
|
||||
* @param props Additional props directly given to the modal
|
||||
*/
|
||||
export const CommonModal: React.FC<PropsWithChildren<CommonModalProps>> = ({
|
||||
|
@ -54,6 +56,7 @@ export const CommonModal: React.FC<PropsWithChildren<CommonModalProps>> = ({
|
|||
additionalClasses,
|
||||
modalSize,
|
||||
children,
|
||||
additionalTitleElement,
|
||||
...props
|
||||
}) => {
|
||||
useTranslation()
|
||||
|
@ -77,6 +80,7 @@ export const CommonModal: React.FC<PropsWithChildren<CommonModalProps>> = ({
|
|||
<UiIcon icon={titleIcon} nbsp={true} />
|
||||
{titleElement}
|
||||
</Modal.Title>
|
||||
{additionalTitleElement ?? <Fragment />}
|
||||
</Modal.Header>
|
||||
{children}
|
||||
</Modal>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue