Path: blob/master/src/packages/next/components/share/saving.tsx
1449 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/4import { Icon } from "@cocalc/frontend/components/icon";5import { CSSProperties, useEffect, useState } from "react";6import useIsMounted from "lib/hooks/mounted";78interface Props {9delay?: number;10style?: CSSProperties;11}1213export default function Loading({ delay, style }: Props) {14const [show, setShow] = useState<boolean>(false);15const isMounted = useIsMounted();16useEffect(() => {17setTimeout(() => {18if (!isMounted.current) return;19setShow(true);20}, delay ?? 500);21}, []);2223if (!show) {24return <></>;25}26return (27<div style={{ color: "#666", ...style }}>28<Icon name="spinner" spin /> Saving...29</div>30);31}323334