mirror of
https://github.com/morten-olsen/parcel.git
synced 2026-02-08 01:36:24 +01:00
cleanup
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { useState, useEffect, createContext } from 'react';
|
||||
import { Layout, Spin } from 'antd';
|
||||
|
||||
interface GithubContextType {
|
||||
username: string;
|
||||
@@ -13,6 +14,20 @@ interface Props {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const Loader = () => (
|
||||
<Layout
|
||||
style={{
|
||||
position: 'fixed',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<Spin size="large" />
|
||||
</Layout>
|
||||
);
|
||||
|
||||
const GithubContext = createContext<GithubContextType>({
|
||||
username: 'unknown',
|
||||
state: 'failed',
|
||||
@@ -46,6 +61,10 @@ const GithubProvider: React.FC<Props> = ({
|
||||
run();
|
||||
}, [username]);
|
||||
|
||||
if (state === 'loading') {
|
||||
return <Loader />;
|
||||
}
|
||||
|
||||
return (
|
||||
<GithubContext.Provider
|
||||
value={{
|
||||
|
||||
Reference in New Issue
Block a user