Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
ref: Initialize App with a loading page
Browse files Browse the repository at this point in the history
  • Loading branch information
Eray C committed Nov 1, 2021
1 parent 6d5e6e8 commit 2e19128
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
3 changes: 3 additions & 0 deletions public/public.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
4 changes: 2 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ code {
monospace;
}

.App {
/* .App {
text-align: center;
}
Expand Down Expand Up @@ -53,4 +53,4 @@ code {
to {
transform: rotate(360deg);
}
}
} */
60 changes: 60 additions & 0 deletions src/App.jsx
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;

0 comments on commit 2e19128

Please sign in to comment.