Spaces:
Running
Running
Add 3 files
Browse files- app.css +24 -0
- index.html +4 -19
- main.js +34 -0
app.css
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
body {
|
2 |
+
background-color: #fbfbfc;
|
3 |
+
font-family: D.Gotham, sans-serif;
|
4 |
+
}
|
5 |
+
|
6 |
+
h1 {
|
7 |
+
font-size: 2rem;
|
8 |
+
font-weight: bold;
|
9 |
+
margin: 1rem 0;
|
10 |
+
}
|
11 |
+
|
12 |
+
.btn {
|
13 |
+
cursor: pointer;
|
14 |
+
background-color: #3B82F6;
|
15 |
+
color: #fff;
|
16 |
+
padding: 0.5rem 1rem;
|
17 |
+
border: none;
|
18 |
+
border-radius: 0.25rem;
|
19 |
+
margin-left: auto;
|
20 |
+
}
|
21 |
+
|
22 |
+
.btn-green {
|
23 |
+
background-color: #10B981;
|
24 |
+
}
|
index.html
CHANGED
@@ -1,19 +1,4 @@
|
|
1 |
-
|
2 |
-
<
|
3 |
-
|
4 |
-
|
5 |
-
<meta name="viewport" content="width=device-width" />
|
6 |
-
<title>My static Space</title>
|
7 |
-
<link rel="stylesheet" href="style.css" />
|
8 |
-
</head>
|
9 |
-
<body>
|
10 |
-
<div class="card">
|
11 |
-
<h1>Welcome to your static Space!</h1>
|
12 |
-
<p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
|
13 |
-
<p>
|
14 |
-
Also don't forget to check the
|
15 |
-
<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
|
16 |
-
</p>
|
17 |
-
</div>
|
18 |
-
</body>
|
19 |
-
</html>
|
|
|
1 |
+
<html><head><link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css" rel="stylesheet" type="text/css" /><script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script><script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script><script defer src="https://cdnjs.cloudflare.com/ajax/libs/three.js/0.156.1/three.min.js"></script><script type="module" src="main.js"></script><title>Food delivery for cambodia</title></head><body>
|
2 |
+
<h1>Food delivery for cambodia</h1>
|
3 |
+
<button class="btn btn-green">Order now</button>
|
4 |
+
</body></html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main.js
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Component, createElement, render } from 'react';
|
2 |
+
import axios from 'axios';
|
3 |
+
|
4 |
+
class App extends Component {
|
5 |
+
constructor(props) {
|
6 |
+
super(props);
|
7 |
+
this.state = {
|
8 |
+
data: null
|
9 |
+
};
|
10 |
+
}
|
11 |
+
|
12 |
+
componentDidMount() {
|
13 |
+
axios.get('https://jsonplaceholder.typicode.com/posts').then(response => {
|
14 |
+
this.setState({
|
15 |
+
data: response.data
|
16 |
+
});
|
17 |
+
});
|
18 |
+
}
|
19 |
+
|
20 |
+
render() {
|
21 |
+
if (!this.state.data) {
|
22 |
+
return <div>Loading</div>;
|
23 |
+
}
|
24 |
+
|
25 |
+
return (
|
26 |
+
<div>
|
27 |
+
<h1>Food delivery for cambodia</h1>
|
28 |
+
<button class="btn btn-green">Order now</button>
|
29 |
+
</div>
|
30 |
+
);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
render(<App />, document.querySelector('#root'));
|