first commit

This commit is contained in:
jerryjzhang
2023-06-12 18:44:01 +08:00
commit dc4fc69b57
879 changed files with 573090 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
.normalState {
position: static;
height: 100%;
.backNormal {
display: none;
}
}
.maxState {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 999;
.innerWrap {
position: absolute;
right: 0;
bottom: 0;
left: 0;
background: #fff;
}
.backNormal {
display: block;
height: 30px;
padding-right: 20px;
color: #02a7f0;
font-size: 22px;
line-height: 30px;
text-align: right;
.fullscreenExitIcon {
cursor: pointer;
}
}
}

View File

@@ -0,0 +1,69 @@
import type { ReactNode, FC } from 'react';
import { useEffect } from 'react';
import { useImperativeHandle, useState } from 'react';
import { FullscreenExitOutlined } from '@ant-design/icons';
import styles from './index.less';
export interface IProps {
children: ReactNode;
maxRef?: any;
top?: string;
isFullScreen: boolean;
triggerBackToNormal: () => void;
}
const FullScreen: FC<IProps> = ({
children,
maxRef,
top = '50px',
isFullScreen,
triggerBackToNormal,
}) => {
const [wrapCls, setWrapCls] = useState(styles.normalState);
const changeToMax = () => {
setWrapCls(styles.maxState);
};
const changeToNormal = () => {
setWrapCls(styles.normalState);
};
const handleBackToNormal = () => {
if (typeof triggerBackToNormal === 'function') {
triggerBackToNormal();
}
};
useEffect(() => {
if (isFullScreen) {
changeToMax();
} else {
changeToNormal();
}
}, [isFullScreen]);
useImperativeHandle(maxRef, () => ({
changeToMax,
changeToNormal,
}));
return (
<div className={wrapCls} style={wrapCls === styles.maxState ? { paddingTop: top } : {}}>
<div
className={styles.innerWrap}
style={wrapCls === styles.maxState ? { top } : { height: '100%' }}
>
<div className={styles.backNormal}>
<FullscreenExitOutlined
className={styles.fullscreenExitIcon}
title="退出全屏"
onClick={handleBackToNormal}
/>
</div>
{children}
</div>
</div>
);
};
export default FullScreen;