This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref: Initialize App with a loading page
- Loading branch information
Eray C
committed
Nov 1, 2021
1 parent
6d5e6e8
commit 2e19128
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as React from "react"; | ||
import "./index.css"; | ||
|
||
// Components | ||
import { Loading } from "./components/Loading"; | ||
import { Navbar } from "./components/Navbar"; | ||
|
||
// Views | ||
import { ChooseBread } from "./views/ChooseBread"; | ||
import { ChooseMeat } from "./views/ChooseMeat"; | ||
import { ChooseVegetables } from "./views/ChooseVegetables"; | ||
import { ChooseSauces } from "./views/ChooseSauces"; | ||
|
||
import { defaultOrder } from "./data"; | ||
|
||
class App extends React.Component { | ||
constructor() { | ||
super(); | ||
this.state = { | ||
currentOrder: defaultOrder, | ||
isLoading: true, | ||
timerHandle: null, | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
this.timerHandle = setTimeout( | ||
() => this.setState({ isLoading: false }), | ||
2500 | ||
); | ||
} | ||
|
||
componentWillUnmount() { | ||
if (this.timerHandle) { | ||
clearTimeout(this.timerHandle); | ||
this.timerHandle = null; | ||
} | ||
} | ||
|
||
render() { | ||
if (this.state.isLoading) { | ||
return ( | ||
// <Loading /> | ||
<div>its loading</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="min-h-screen bg-yellow-25"> | ||
{/* <Navbar /> */} | ||
{/* <ChooseBread order={this.state} /> */} | ||
<ChooseMeat order={this.state} /> | ||
{/* <ChooseVegetables order={this.state} /> */} | ||
{/* <ChooseSauces order={this.state} /> */} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default App; |