mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
refactor(core): desktop project struct (#8334)
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
import { cssVar } from '@toeverything/theme';
|
||||
import { style } from '@vanilla-extract/css';
|
||||
export const globalLoadingWrapperStyle = style({
|
||||
position: 'fixed',
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: '100%',
|
||||
zIndex: 5,
|
||||
backgroundColor: cssVar('backgroundModalColor'),
|
||||
opacity: 0,
|
||||
transition: 'opacity .3s',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
color: cssVar('processingColor'),
|
||||
'@media': {
|
||||
print: {
|
||||
display: 'none',
|
||||
zIndex: -1,
|
||||
},
|
||||
},
|
||||
selectors: {
|
||||
'&[data-loading="true"]': {
|
||||
right: 0,
|
||||
opacity: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -1,35 +1,5 @@
|
||||
import { useAtomValue } from 'jotai';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { Loading } from '../../ui/loading';
|
||||
import * as styles from './index.css';
|
||||
import { globalLoadingEventsAtom } from './index.jotai';
|
||||
|
||||
export {
|
||||
type GlobalLoadingEvent,
|
||||
pushGlobalLoadingEventAtom,
|
||||
resolveGlobalLoadingEventAtom,
|
||||
} from './index.jotai';
|
||||
|
||||
export function GlobalLoading(): ReactNode {
|
||||
const globalLoadingEvents = useAtomValue(globalLoadingEventsAtom);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (globalLoadingEvents.length) {
|
||||
setLoading(true);
|
||||
} else {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [globalLoadingEvents]);
|
||||
|
||||
if (!globalLoadingEvents.length) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div className={styles.globalLoadingWrapperStyle} data-loading={loading}>
|
||||
<Loading size={20} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user