chore: add loading spin

This commit is contained in:
Steven 2022-09-13 21:09:58 +08:00
parent 156218b40f
commit dfc797fe58
2 changed files with 42 additions and 32 deletions

View File

@ -20,7 +20,6 @@ const Home: React.FC = () => {
return (
<div className="w-full h-full flex flex-col justify-start items-start">
<Header />
{loadingState.isLoading ? null : (
<div className="mx-auto max-w-4xl w-full px-3 py-6 flex flex-col justify-start items-start">
<div className="mb-4 w-full flex flex-row justify-between items-center">
<span className="font-mono text-gray-400">Workspace List</span>
@ -31,10 +30,16 @@ const Home: React.FC = () => {
<Icon.Plus className="w-5 h-auto mr-1" /> Create Workspace
</div>
</div>
<WorkspaceListView workspaceList={workspaceList} />
{loadingState.isLoading ? (
<div className="py-4 w-full flex flex-row justify-center items-center">
<Icon.Loader className="mr-2 w-5 h-auto animate-spin" />
loading
</div>
) : (
<WorkspaceListView workspaceList={workspaceList} />
)}
</div>
</div>
);
};

View File

@ -46,7 +46,6 @@ const WorkspaceDetail: React.FC = () => {
return (
<div className="w-full h-full flex flex-col justify-start items-start">
<Header />
{loadingState.isLoading ? null : (
<div className="mx-auto max-w-4xl w-full px-3 py-6 flex flex-col justify-start items-start">
<div className="w-full flex flex-row justify-start items-center mb-4">
<span className="font-mono text-gray-600 cursor-pointer hover:underline" onClick={() => handleBackToHome()}>
@ -64,10 +63,16 @@ const WorkspaceDetail: React.FC = () => {
<Icon.Plus className="w-5 h-auto mr-1" /> Create Shortcut
</div>
</div>
<ShortcutListView workspaceId={state.workspace.id} shortcutList={shortcutList} />
{loadingState.isLoading ? (
<div className="py-4 w-full flex flex-row justify-center items-center">
<Icon.Loader className="mr-2 w-5 h-auto animate-spin" />
loading
</div>
) : (
<ShortcutListView workspaceId={state.workspace.id} shortcutList={shortcutList} />
)}
</div>
</div>
);
};