diff --git a/frontend/components/CopyField.tsx b/frontend/components/CopyField.tsx index 4ce7d0b..5aac77d 100644 --- a/frontend/components/CopyField.tsx +++ b/frontend/components/CopyField.tsx @@ -25,21 +25,21 @@ import { Overlay, Tooltip } from 'react-bootstrap'; import type { IconProp } from '@fortawesome/fontawesome-svg-core'; import { FormattedMessage } from './localization'; -const CopyField = ({ +function CopyField({ children, - copyIcon = 'copy', - icon = null, + copyIcon, + icon, }: { children: string, copyIcon?: IconProp, icon?: IconProp, -}) => { +}) { const [show, setShow] = useState(false); const target = useRef(null); const textbox = useRef(null); let timer: NodeJS.Timeout = null; - function doCopy() { + const doCopy = () => { if (timer !== null) { clearTimeout(timer); } @@ -52,7 +52,7 @@ const CopyField = ({ setShow(false); }, 3000); return false; - } + }; return ( @@ -83,6 +83,11 @@ const CopyField = ({ ); +} + +CopyField.defaultProps = { + copyIcon: 'copy', + icon: null, }; export default CopyField; diff --git a/frontend/components/DarkToggler.tsx b/frontend/components/DarkToggler.tsx index c4cb26b..c94b089 100644 --- a/frontend/components/DarkToggler.tsx +++ b/frontend/components/DarkToggler.tsx @@ -25,10 +25,10 @@ import { import { FormattedMessage } from './localization'; export default function DarkToggler({ - isDarkEnabled = false, - onChangeDarkMode = null, - disabled = false, - showLoading = false, + isDarkEnabled, + onChangeDarkMode, + disabled, + showLoading, }: { isDarkEnabled?: boolean, onChangeDarkMode?: (value: boolean) => void, @@ -55,3 +55,10 @@ export default function DarkToggler({ ); } + +DarkToggler.defaultProps = { + isDarkEnabled: false, + onChangeDarkMode: null, + disabled: false, + showLoading: false, +}; diff --git a/frontend/components/DownloadButton.tsx b/frontend/components/DownloadButton.tsx index d49188e..d7bf337 100644 --- a/frontend/components/DownloadButton.tsx +++ b/frontend/components/DownloadButton.tsx @@ -23,7 +23,7 @@ import { getDownloadURL } from 'util/api'; import { FormattedMessage } from './localization'; export default function DownloadButton({ - icon = 'download', + icon, id, fileName, }: { @@ -42,3 +42,7 @@ export default function DownloadButton({ ); } + +DownloadButton.defaultProps = { + icon: 'download', +}; diff --git a/frontend/components/Filter.tsx b/frontend/components/Filter.tsx index 618f7db..c59ba46 100644 --- a/frontend/components/Filter.tsx +++ b/frontend/components/Filter.tsx @@ -21,7 +21,7 @@ import React from 'react'; export default function Filter({ items, query = '', - isCaseSensitive = false, + isCaseSensitive, keys, output, }: { @@ -50,3 +50,7 @@ export default function Filter({ ); } + +Filter.defaultProps = { + isCaseSensitive: false, +}; diff --git a/frontend/components/LocaleSwitcher.tsx b/frontend/components/LocaleSwitcher.tsx index ff4bcdc..f6c9b17 100644 --- a/frontend/components/LocaleSwitcher.tsx +++ b/frontend/components/LocaleSwitcher.tsx @@ -24,10 +24,10 @@ import { FormattedMessage } from './localization'; import { availableLocales, defaultLocale, localeDescriptions } from '../util/localization'; export default function LocaleSwitcher({ - locale = defaultLocale, - onChangeLocale = null, - disabled = false, - showLoading = false, + locale, + onChangeLocale, + disabled, + showLoading, }: { locale?: string, onChangeLocale?: (value: string) => void, @@ -76,3 +76,10 @@ export default function LocaleSwitcher({ ); } + +LocaleSwitcher.defaultProps = { + locale: defaultLocale, + onChangeLocale: null, + disabled: false, + showLoading: false, +};