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:
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "owncast",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
||||||
@@ -79,8 +79,8 @@ export const ChatContainer: FC<ChatContainerProps> = ({
|
|||||||
usernameToHighlight,
|
usernameToHighlight,
|
||||||
chatUserId,
|
chatUserId,
|
||||||
isModerator,
|
isModerator,
|
||||||
showInput,
|
showInput = true,
|
||||||
height,
|
height = 'auto',
|
||||||
chatAvailable: chatEnabled,
|
chatAvailable: chatEnabled,
|
||||||
desktop,
|
desktop,
|
||||||
focusInput = true,
|
focusInput = true,
|
||||||
@@ -377,8 +377,3 @@ export const ChatContainer: FC<ChatContainerProps> = ({
|
|||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatContainer.defaultProps = {
|
|
||||||
showInput: true,
|
|
||||||
height: 'auto',
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export const CrossfadeImage: FC<CrossfadeImageProps> = ({
|
|||||||
src = '',
|
src = '',
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
objectFit = 'fill',
|
objectFit = 'fill', // default value for objectFit
|
||||||
duration = '1s',
|
duration = '3s', // default value for duration
|
||||||
className,
|
className,
|
||||||
}) => {
|
}) => {
|
||||||
const spanStyle: React.CSSProperties = useMemo(
|
const spanStyle: React.CSSProperties = useMemo(
|
||||||
@@ -70,8 +70,3 @@ export const CrossfadeImage: FC<CrossfadeImageProps> = ({
|
|||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
CrossfadeImage.defaultProps = {
|
|
||||||
objectFit: 'fill',
|
|
||||||
duration: '3s',
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ export type ModalProps = {
|
|||||||
|
|
||||||
export const Modal: FC<ModalProps> = ({
|
export const Modal: FC<ModalProps> = ({
|
||||||
title,
|
title,
|
||||||
url,
|
url = undefined,
|
||||||
open,
|
open,
|
||||||
handleOk,
|
handleOk = undefined,
|
||||||
handleCancel,
|
handleCancel = undefined,
|
||||||
afterClose,
|
afterClose = undefined,
|
||||||
height,
|
height,
|
||||||
width,
|
width,
|
||||||
children,
|
children = undefined,
|
||||||
}) => {
|
}) => {
|
||||||
const [loading, setLoading] = useState(!!url);
|
const [loading, setLoading] = useState(!!url);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import classNames from 'classnames';
|
|||||||
import styles from './Statusbar.module.scss';
|
import styles from './Statusbar.module.scss';
|
||||||
|
|
||||||
// Lazy loaded components
|
// Lazy loaded components
|
||||||
|
|
||||||
const EyeFilled = dynamic(() => import('@ant-design/icons/EyeFilled'), {
|
const EyeFilled = dynamic(() => import('@ant-design/icons/EyeFilled'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
});
|
});
|
||||||
@@ -40,8 +39,8 @@ function makeDurationString(lastConnectTime: Date): string {
|
|||||||
|
|
||||||
export const Statusbar: FC<StatusbarProps> = ({
|
export const Statusbar: FC<StatusbarProps> = ({
|
||||||
online,
|
online,
|
||||||
lastConnectTime,
|
lastConnectTime = null,
|
||||||
lastDisconnectTime,
|
lastDisconnectTime = null,
|
||||||
viewerCount,
|
viewerCount,
|
||||||
className,
|
className,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -84,8 +83,3 @@ export const Statusbar: FC<StatusbarProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
Statusbar.defaultProps = {
|
|
||||||
lastConnectTime: null,
|
|
||||||
lastDisconnectTime: null,
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user