mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 07:04:45 -04:00
Fix react 18 changes
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
833a5d35a4
commit
931302cbec
20 changed files with 47 additions and 22 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { Suspense } from 'react'
|
import React, { Suspense } from 'react'
|
||||||
import { useBackendBaseUrl } from '../../hooks/common/use-backend-base-url'
|
import { useBackendBaseUrl } from '../../hooks/common/use-backend-base-url'
|
||||||
import { createSetUpTaskList } from './initializers'
|
import { createSetUpTaskList } from './initializers'
|
||||||
|
@ -15,7 +16,7 @@ import { ApplicationLoaderError } from './application-loader-error'
|
||||||
|
|
||||||
const log = new Logger('ApplicationLoader')
|
const log = new Logger('ApplicationLoader')
|
||||||
|
|
||||||
export const ApplicationLoader: React.FC = ({ children }) => {
|
export const ApplicationLoader: React.FC<PropsWithChildren<unknown>> = ({ children }) => {
|
||||||
const backendBaseUrl = useBackendBaseUrl()
|
const backendBaseUrl = useBackendBaseUrl()
|
||||||
const customizeAssetsUrl = useCustomizeAssetsUrl()
|
const customizeAssetsUrl = useCustomizeAssetsUrl()
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
import { WaitSpinner } from './wait-spinner/wait-spinner'
|
import { WaitSpinner } from './wait-spinner/wait-spinner'
|
||||||
|
@ -24,7 +25,7 @@ export interface AsyncLoadingBoundaryProps {
|
||||||
* @param componentName The name of the component that is currently loading. It will be shown in the error message.
|
* @param componentName The name of the component that is currently loading. It will be shown in the error message.
|
||||||
* @param children The child {@link ReactElement elements} that are only shown if the component isn't in loading or error state
|
* @param children The child {@link ReactElement elements} that are only shown if the component isn't in loading or error state
|
||||||
*/
|
*/
|
||||||
export const AsyncLoadingBoundary: React.FC<AsyncLoadingBoundaryProps> = ({
|
export const AsyncLoadingBoundary: React.FC<PropsWithChildren<AsyncLoadingBoundaryProps>> = ({
|
||||||
loading,
|
loading,
|
||||||
error,
|
error,
|
||||||
componentName,
|
componentName,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { Modal } from 'react-bootstrap'
|
import { Modal } from 'react-bootstrap'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
|
@ -29,7 +30,7 @@ export interface ModalContentProps {
|
||||||
|
|
||||||
export type CommonModalProps = PropsWithDataCypressId & ModalVisibilityProps & ModalContentProps
|
export type CommonModalProps = PropsWithDataCypressId & ModalVisibilityProps & ModalContentProps
|
||||||
|
|
||||||
export const CommonModal: React.FC<CommonModalProps> = ({
|
export const CommonModal: React.FC<PropsWithChildren<CommonModalProps>> = ({
|
||||||
show,
|
show,
|
||||||
onHide,
|
onHide,
|
||||||
title,
|
title,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Button, Modal } from 'react-bootstrap'
|
import { Button, Modal } from 'react-bootstrap'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
|
@ -16,7 +17,7 @@ export interface DeletionModalProps extends CommonModalProps {
|
||||||
deletionButtonI18nKey: string
|
deletionButtonI18nKey: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DeletionModal: React.FC<DeletionModalProps> = ({
|
export const DeletionModal: React.FC<PropsWithChildren<DeletionModalProps>> = ({
|
||||||
show,
|
show,
|
||||||
onHide,
|
onHide,
|
||||||
title,
|
title,
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { Fragment, useEffect } from 'react'
|
import React, { Fragment, useEffect } from 'react'
|
||||||
|
|
||||||
export interface PagerPageProps {
|
export interface PagerPageProps {
|
||||||
|
@ -12,7 +13,7 @@ export interface PagerPageProps {
|
||||||
onLastPageIndexChange: (lastPageIndex: number) => void
|
onLastPageIndexChange: (lastPageIndex: number) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Pager: React.FC<PagerPageProps> = ({
|
export const Pager: React.FC<PropsWithChildren<PagerPageProps>> = ({
|
||||||
children,
|
children,
|
||||||
numberOfElementsPerPage,
|
numberOfElementsPerPage,
|
||||||
pageIndex,
|
pageIndex,
|
||||||
|
|
|
@ -4,10 +4,11 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { LandingLayout } from '../../landing-layout/landing-layout'
|
import { LandingLayout } from '../../landing-layout/landing-layout'
|
||||||
|
|
||||||
export const NotFoundErrorScreen: React.FC = () => {
|
export const NotFoundErrorScreen: React.FC<PropsWithChildren<unknown>> = () => {
|
||||||
return (
|
return (
|
||||||
<LandingLayout>
|
<LandingLayout>
|
||||||
<div className='text-light d-flex align-items-center justify-content-center my-5'>
|
<div className='text-light d-flex align-items-center justify-content-center my-5'>
|
||||||
|
|
|
@ -4,12 +4,13 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
|
||||||
export interface ShowIfProps {
|
export interface ShowIfProps {
|
||||||
condition: boolean
|
condition: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ShowIf: React.FC<ShowIfProps> = ({ children, condition }) => {
|
export const ShowIf: React.FC<PropsWithChildren<ShowIfProps>> = ({ children, condition }) => {
|
||||||
return condition ? <Fragment>{children}</Fragment> : null
|
return condition ? <Fragment>{children}</Fragment> : null
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { useCallback, useState } from 'react'
|
import React, { useCallback, useState } from 'react'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
import { ShowIf } from '../../../common/show-if/show-if'
|
import { ShowIf } from '../../../common/show-if/show-if'
|
||||||
|
@ -20,7 +21,7 @@ import { cypressId } from '../../../../utils/cypress-attribute'
|
||||||
* Creates a new info line for the document information dialog that holds the
|
* Creates a new info line for the document information dialog that holds the
|
||||||
* word count of the note, based on counting in the rendered output.
|
* word count of the note, based on counting in the rendered output.
|
||||||
*/
|
*/
|
||||||
export const DocumentInfoLineWordCount: React.FC = () => {
|
export const DocumentInfoLineWordCount: React.FC<PropsWithChildren<unknown>> = () => {
|
||||||
useTranslation()
|
useTranslation()
|
||||||
const editorToRendererCommunicator = useEditorToRendererCommunicator()
|
const editorToRendererCommunicator = useEditorToRendererCommunicator()
|
||||||
const [wordCount, setWordCount] = useState<number | null>(null)
|
const [wordCount, setWordCount] = useState<number | null>(null)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||||
import type { IconName } from '../../../common/fork-awesome/types'
|
import type { IconName } from '../../../common/fork-awesome/types'
|
||||||
|
@ -13,7 +14,7 @@ export interface DocumentInfoLineProps {
|
||||||
size?: '2x' | '3x' | '4x' | '5x' | undefined
|
size?: '2x' | '3x' | '4x' | '5x' | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DocumentInfoLine: React.FC<DocumentInfoLineProps> = ({ icon, size, children }) => {
|
export const DocumentInfoLine: React.FC<PropsWithChildren<DocumentInfoLineProps>> = ({ icon, size, children }) => {
|
||||||
return (
|
return (
|
||||||
<span className={'d-flex align-items-center'}>
|
<span className={'d-flex align-items-center'}>
|
||||||
<ForkAwesomeIcon icon={icon} size={size} fixedWidth={true} className={'mx-2'} />
|
<ForkAwesomeIcon icon={icon} size={size} fixedWidth={true} className={'mx-2'} />
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { createContext, useContext, useEffect, useMemo } from 'react'
|
import React, { createContext, useContext, useEffect, useMemo } from 'react'
|
||||||
import { EditorToRendererCommunicator } from '../../render-page/window-post-message-communicator/editor-to-renderer-communicator'
|
import { EditorToRendererCommunicator } from '../../render-page/window-post-message-communicator/editor-to-renderer-communicator'
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ export const useEditorToRendererCommunicator: () => EditorToRendererCommunicator
|
||||||
/**
|
/**
|
||||||
* Provides a {@link EditorToRendererCommunicator editor to renderer communicator} for the child components via Context.
|
* Provides a {@link EditorToRendererCommunicator editor to renderer communicator} for the child components via Context.
|
||||||
*/
|
*/
|
||||||
export const EditorToRendererCommunicatorContextProvider: React.FC = ({ children }) => {
|
export const EditorToRendererCommunicatorContextProvider: React.FC<PropsWithChildren<unknown>> = ({ children }) => {
|
||||||
const communicator = useMemo<EditorToRendererCommunicator>(() => new EditorToRendererCommunicator(), [])
|
const communicator = useMemo<EditorToRendererCommunicator>(() => new EditorToRendererCommunicator(), [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { createContext, useContext, useEffect, useMemo } from 'react'
|
import React, { createContext, useContext, useEffect, useMemo } from 'react'
|
||||||
import { RendererToEditorCommunicator } from '../../render-page/window-post-message-communicator/renderer-to-editor-communicator'
|
import { RendererToEditorCommunicator } from '../../render-page/window-post-message-communicator/renderer-to-editor-communicator'
|
||||||
import { CommunicationMessageType } from '../../render-page/window-post-message-communicator/rendering-message'
|
import { CommunicationMessageType } from '../../render-page/window-post-message-communicator/rendering-message'
|
||||||
|
@ -25,7 +26,7 @@ export const useRendererToEditorCommunicator: () => RendererToEditorCommunicator
|
||||||
return communicatorFromContext
|
return communicatorFromContext
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RendererToEditorCommunicatorContextProvider: React.FC = ({ children }) => {
|
export const RendererToEditorCommunicatorContextProvider: React.FC<PropsWithChildren<unknown>> = ({ children }) => {
|
||||||
const editorOrigin = useOriginFromConfig(ORIGIN_TYPE.EDITOR)
|
const editorOrigin = useOriginFromConfig(ORIGIN_TYPE.EDITOR)
|
||||||
const communicator = useMemo<RendererToEditorCommunicator>(() => new RendererToEditorCommunicator(), [])
|
const communicator = useMemo<RendererToEditorCommunicator>(() => new RendererToEditorCommunicator(), [])
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { Fragment, useCallback, useState } from 'react'
|
import React, { Fragment, useCallback, useState } from 'react'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
import { SidebarButton } from '../sidebar-button/sidebar-button'
|
import { SidebarButton } from '../sidebar-button/sidebar-button'
|
||||||
|
@ -21,7 +22,7 @@ import { ShowIf } from '../../../common/show-if/show-if'
|
||||||
* @param hide {@code true} if the entry shouldn't be visible
|
* @param hide {@code true} if the entry shouldn't be visible
|
||||||
* @param className Additional css class names for the sidebar entry
|
* @param className Additional css class names for the sidebar entry
|
||||||
*/
|
*/
|
||||||
export const DeleteNoteSidebarEntry: React.FC<SpecificSidebarEntryProps> = ({ hide, className }) => {
|
export const DeleteNoteSidebarEntry: React.FC<PropsWithChildren<SpecificSidebarEntryProps>> = ({ hide, className }) => {
|
||||||
useTranslation()
|
useTranslation()
|
||||||
const [showDialog, setShowDialog] = useState(false)
|
const [showDialog, setShowDialog] = useState(false)
|
||||||
const noteId = useApplicationState((state) => state.noteDetails.id)
|
const noteId = useApplicationState((state) => state.noteDetails.id)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||||
import type { IconName } from '../../../common/fork-awesome/types'
|
import type { IconName } from '../../../common/fork-awesome/types'
|
||||||
|
@ -19,14 +20,14 @@ export interface SidebarButton extends SidebarEntryProps {
|
||||||
* A button that should be rendered in the sidebar.
|
* A button that should be rendered in the sidebar.
|
||||||
*
|
*
|
||||||
* @param children The react elements in the button
|
* @param children The react elements in the button
|
||||||
* @param icon The icon at the left side of the button
|
* @param icon The icon on the left side of the button
|
||||||
* @param className Additional css class names
|
* @param className Additional css class names
|
||||||
* @param buttonRef A reference to the button
|
* @param buttonRef A reference to the button
|
||||||
* @param hide Should be {@code true} if the button should be invisible
|
* @param hide Should be {@code true} if the button should be invisible
|
||||||
* @param variant An alternative theme for the button
|
* @param variant An alternative theme for the button
|
||||||
* @param props Other button props
|
* @param props Other button props
|
||||||
*/
|
*/
|
||||||
export const SidebarButton: React.FC<SidebarButton> = ({
|
export const SidebarButton: React.FC<PropsWithChildren<SidebarButton>> = ({
|
||||||
children,
|
children,
|
||||||
icon,
|
icon,
|
||||||
className,
|
className,
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import type { SidebarMenuProps } from '../types'
|
import type { SidebarMenuProps } from '../types'
|
||||||
import styles from './sidebar-menu.module.scss'
|
import styles from './sidebar-menu.module.scss'
|
||||||
|
|
||||||
export const SidebarMenu: React.FC<SidebarMenuProps> = ({ children, expand }) => {
|
export const SidebarMenu: React.FC<PropsWithChildren<SidebarMenuProps>> = ({ children, expand }) => {
|
||||||
return (
|
return (
|
||||||
<div className={`${styles['sidebar-menu']} ${expand ? styles['show'] : ''}`}>
|
<div className={`${styles['sidebar-menu']} ${expand ? styles['show'] : ''}`}>
|
||||||
<div className={`d-flex flex-column`}>{children}</div>
|
<div className={`d-flex flex-column`}>{children}</div>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ErrorInfo, ReactNode } from 'react'
|
import type { ErrorInfo, PropsWithChildren, ReactNode } from 'react'
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Button, Container } from 'react-bootstrap'
|
import { Button, Container } from 'react-bootstrap'
|
||||||
import links from '../../links.json'
|
import links from '../../links.json'
|
||||||
|
@ -15,7 +15,7 @@ import { Logger } from '../../utils/logger'
|
||||||
|
|
||||||
const log = new Logger('ErrorBoundary')
|
const log = new Logger('ErrorBoundary')
|
||||||
|
|
||||||
export class ErrorBoundary extends Component {
|
export class ErrorBoundary extends Component<PropsWithChildren<unknown>> {
|
||||||
state: {
|
state: {
|
||||||
hasError: boolean
|
hasError: boolean
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { createContext, useState } from 'react'
|
import React, { createContext, useState } from 'react'
|
||||||
import type { HistoryToolbarStateWithDispatcher } from './toolbar-context'
|
import type { HistoryToolbarStateWithDispatcher } from './toolbar-context'
|
||||||
import { SortModeEnum } from '../../sort-button/sort-button'
|
import { SortModeEnum } from '../../sort-button/sort-button'
|
||||||
|
@ -19,7 +20,7 @@ export const historyToolbarStateContext = createContext<HistoryToolbarStateWithD
|
||||||
*
|
*
|
||||||
* @param children The children that should receive the toolbar state via context.
|
* @param children The children that should receive the toolbar state via context.
|
||||||
*/
|
*/
|
||||||
export const HistoryToolbarStateContextProvider: React.FC = ({ children }) => {
|
export const HistoryToolbarStateContextProvider: React.FC<PropsWithChildren<unknown>> = ({ children }) => {
|
||||||
const urlParameterSearch = useSingleStringUrlParameter('search', '')
|
const urlParameterSearch = useSingleStringUrlParameter('search', '')
|
||||||
const urlParameterSelectedTags = useArrayStringUrlParameter('selectedTags')
|
const urlParameterSelectedTags = useArrayStringUrlParameter('selectedTags')
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
import { Container } from 'react-bootstrap'
|
import { Container } from 'react-bootstrap'
|
||||||
import { MotdModal } from '../common/motd-modal/motd-modal'
|
import { MotdModal } from '../common/motd-modal/motd-modal'
|
||||||
|
@ -11,7 +12,7 @@ import { Footer } from './footer/footer'
|
||||||
import { HeaderBar } from './navigation/header-bar/header-bar'
|
import { HeaderBar } from './navigation/header-bar/header-bar'
|
||||||
import { UiNotifications } from '../notifications/ui-notifications'
|
import { UiNotifications } from '../notifications/ui-notifications'
|
||||||
|
|
||||||
export const LandingLayout: React.FC = ({ children }) => {
|
export const LandingLayout: React.FC<PropsWithChildren<unknown>> = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<UiNotifications />
|
<UiNotifications />
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo } from 'react'
|
||||||
import { Nav } from 'react-bootstrap'
|
import { Nav } from 'react-bootstrap'
|
||||||
import type { PropsWithDataCypressId } from '../../../../utils/cypress-attribute'
|
import type { PropsWithDataCypressId } from '../../../../utils/cypress-attribute'
|
||||||
|
@ -23,7 +24,7 @@ export interface HeaderNavLinkProps extends PropsWithDataCypressId {
|
||||||
* @param children The react elements inside of link for more description
|
* @param children The react elements inside of link for more description
|
||||||
* @param props Other navigation item props
|
* @param props Other navigation item props
|
||||||
*/
|
*/
|
||||||
export const HeaderNavLink: React.FC<HeaderNavLinkProps> = ({ to, children, ...props }) => {
|
export const HeaderNavLink: React.FC<PropsWithChildren<HeaderNavLinkProps>> = ({ to, children, ...props }) => {
|
||||||
const { route } = useRouter()
|
const { route } = useRouter()
|
||||||
|
|
||||||
const activeClass = useMemo(() => {
|
const activeClass = useMemo(() => {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
|
||||||
import type { IconName } from '../../../common/fork-awesome/types'
|
import type { IconName } from '../../../common/fork-awesome/types'
|
||||||
|
@ -16,7 +17,13 @@ export interface SocialButtonProps {
|
||||||
title?: string
|
title?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SocialLinkButton: React.FC<SocialButtonProps> = ({ title, backgroundClass, href, icon, children }) => {
|
export const SocialLinkButton: React.FC<PropsWithChildren<SocialButtonProps>> = ({
|
||||||
|
title,
|
||||||
|
backgroundClass,
|
||||||
|
href,
|
||||||
|
icon,
|
||||||
|
children
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={href}
|
href={href}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import type { PropsWithChildren } from 'react'
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
import type { IconName } from '../../../common/fork-awesome/types'
|
import type { IconName } from '../../../common/fork-awesome/types'
|
||||||
|
@ -38,7 +39,7 @@ interface ClickShieldProps extends PropsWithDataCypressId {
|
||||||
* @param fallbackBackgroundColor A color that should be used if no background image was provided or could be loaded.
|
* @param fallbackBackgroundColor A color that should be used if no background image was provided or could be loaded.
|
||||||
* @param children The children element that should be shielded.
|
* @param children The children element that should be shielded.
|
||||||
*/
|
*/
|
||||||
export const ClickShield: React.FC<ClickShieldProps> = ({
|
export const ClickShield: React.FC<PropsWithChildren<ClickShieldProps>> = ({
|
||||||
containerClassName,
|
containerClassName,
|
||||||
onImageFetch,
|
onImageFetch,
|
||||||
fallbackPreviewImageUrl,
|
fallbackPreviewImageUrl,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue