Remove use of default props (#4118)

* refactor: replace defaultProps with function parameters in Modal, Statusbar, ChatContainer, and CrossfadeImage components

* New commit for Default properties of React components after syncing fork and rebasing

* fix: fix linter warning

---------

Co-authored-by: swarup <swarupnarkhede999@gmail.com>
This commit is contained in:
Gabe Kangas
2025-01-15 16:12:54 -08:00
committed by GitHub
parent 67ef2b45d9
commit 2e8e61309a
6 changed files with 17 additions and 27 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

6
package-lock.json generated Normal file
View File

@@ -0,0 +1,6 @@
{
"name": "owncast",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

View File

@@ -79,8 +79,8 @@ export const ChatContainer: FC<ChatContainerProps> = ({
usernameToHighlight,
chatUserId,
isModerator,
showInput,
height,
showInput = true,
height = 'auto',
chatAvailable: chatEnabled,
desktop,
focusInput = true,
@@ -377,8 +377,3 @@ export const ChatContainer: FC<ChatContainerProps> = ({
</ErrorBoundary>
);
};
ChatContainer.defaultProps = {
showInput: true,
height: 'auto',
};

View File

@@ -21,8 +21,8 @@ export const CrossfadeImage: FC<CrossfadeImageProps> = ({
src = '',
width,
height,
objectFit = 'fill',
duration = '1s',
objectFit = 'fill', // default value for objectFit
duration = '3s', // default value for duration
className,
}) => {
const spanStyle: React.CSSProperties = useMemo(
@@ -70,8 +70,3 @@ export const CrossfadeImage: FC<CrossfadeImageProps> = ({
</span>
);
};
CrossfadeImage.defaultProps = {
objectFit: 'fill',
duration: '3s',
};

View File

@@ -18,14 +18,14 @@ export type ModalProps = {
export const Modal: FC<ModalProps> = ({
title,
url,
url = undefined,
open,
handleOk,
handleCancel,
afterClose,
handleOk = undefined,
handleCancel = undefined,
afterClose = undefined,
height,
width,
children,
children = undefined,
}) => {
const [loading, setLoading] = useState(!!url);

View File

@@ -5,7 +5,6 @@ import classNames from 'classnames';
import styles from './Statusbar.module.scss';
// Lazy loaded components
const EyeFilled = dynamic(() => import('@ant-design/icons/EyeFilled'), {
ssr: false,
});
@@ -40,8 +39,8 @@ function makeDurationString(lastConnectTime: Date): string {
export const Statusbar: FC<StatusbarProps> = ({
online,
lastConnectTime,
lastDisconnectTime,
lastConnectTime = null,
lastDisconnectTime = null,
viewerCount,
className,
}) => {
@@ -84,8 +83,3 @@ export const Statusbar: FC<StatusbarProps> = ({
</div>
);
};
Statusbar.defaultProps = {
lastConnectTime: null,
lastDisconnectTime: null,
};