Azuy commited on
Commit
86fd306
·
verified ·
1 Parent(s): 332590c

Help me make a website for querying information about Americans

Browse files
Files changed (7) hide show
  1. README.md +8 -5
  2. components/footer.js +63 -0
  3. components/navbar.js +53 -0
  4. components/search.js +34 -0
  5. index.html +85 -19
  6. script.js +26 -0
  7. style.css +25 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: American Data Explorer
3
- emoji: 🚀
4
- colorFrom: pink
5
- colorTo: green
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: American Data Explorer 🦅
3
+ colorFrom: purple
4
+ colorTo: pink
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .footer-link {
7
+ transition: color 0.3s ease;
8
+ }
9
+ .footer-link:hover {
10
+ color: #3b82f6;
11
+ }
12
+ .social-icon {
13
+ transition: all 0.3s ease;
14
+ }
15
+ .social-icon:hover {
16
+ transform: translateY(-3px);
17
+ color: #3b82f6;
18
+ }
19
+ </style>
20
+ <footer class="bg-gray-800 text-white py-12">
21
+ <div class="container mx-auto px-4">
22
+ <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
23
+ <div>
24
+ <h3 class="text-lg font-semibold mb-4">American Data Explorer</h3>
25
+ <p class="text-gray-400">Providing accessible insights into American demographics and statistics.</p>
26
+ </div>
27
+ <div>
28
+ <h3 class="text-lg font-semibold mb-4">Quick Links</h3>
29
+ <ul class="space-y-2">
30
+ <li><a href="index.html" class="footer-link text-gray-400 hover:text-white">Home</a></li>
31
+ <li><a href="population.html" class="footer-link text-gray-400 hover:text-white">Population</a></li>
32
+ <li><a href="economy.html" class="footer-link text-gray-400 hover:text-white">Economy</a></li>
33
+ <li><a href="housing.html" class="footer-link text-gray-400 hover:text-white">Housing</a></li>
34
+ </ul>
35
+ </div>
36
+ <div>
37
+ <h3 class="text-lg font-semibold mb-4">Resources</h3>
38
+ <ul class="space-y-2">
39
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white">API Documentation</a></li>
40
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white">Data Sources</a></li>
41
+ <li><a href="#" class="footer-link text-gray-400 hover:text-white">Methodology</a></li>
42
+ </ul>
43
+ </div>
44
+ <div>
45
+ <h3 class="text-lg font-semibold mb-4">Connect</h3>
46
+ <div class="flex space-x-4">
47
+ <a href="#" class="social-icon text-gray-400 hover:text-white"><i data-feather="twitter"></i></a>
48
+ <a href="#" class="social-icon text-gray-400 hover:text-white"><i data-feather="github"></i></a>
49
+ <a href="#" class="social-icon text-gray-400 hover:text-white"><i data-feather="linkedin"></i></a>
50
+ <a href="#" class="social-icon text-gray-400 hover:text-white"><i data-feather="mail"></i></a>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
55
+ <p>© ${new Date().getFullYear()} American Data Explorer. All rights reserved.</p>
56
+ </div>
57
+ </div>
58
+ </footer>
59
+ `;
60
+ }
61
+ }
62
+
63
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .nav-link {
7
+ position: relative;
8
+ transition: color 0.3s ease;
9
+ }
10
+ .nav-link:hover {
11
+ color: #3b82f6;
12
+ }
13
+ .nav-link::after {
14
+ content: '';
15
+ position: absolute;
16
+ bottom: -2px;
17
+ left: 0;
18
+ width: 0;
19
+ height: 2px;
20
+ background-color: #3b82f6;
21
+ transition: width 0.3s ease;
22
+ }
23
+ .nav-link:hover::after {
24
+ width: 100%;
25
+ }
26
+ </style>
27
+ <nav class="bg-white shadow-md">
28
+ <div class="container mx-auto px-4 py-4">
29
+ <div class="flex justify-between items-center">
30
+ <div class="flex items-center space-x-4">
31
+ <a href="index.html" class="flex items-center space-x-2">
32
+ <i data-feather="globe" class="text-blue-600 w-6 h-6"></i>
33
+ <span class="text-xl font-bold text-gray-800">American Data Explorer</span>
34
+ </a>
35
+ </div>
36
+ <div class="hidden md:flex items-center space-x-8">
37
+ <a href="index.html" class="nav-link text-gray-600 hover:text-blue-600">Home</a>
38
+ <a href="population.html" class="nav-link text-gray-600 hover:text-blue-600">Population</a>
39
+ <a href="economy.html" class="nav-link text-gray-600 hover:text-blue-600">Economy</a>
40
+ <a href="housing.html" class="nav-link text-gray-600 hover:text-blue-600">Housing</a>
41
+ <a href="about.html" class="nav-link text-gray-600 hover:text-blue-600">About</a>
42
+ </div>
43
+ <button class="md:hidden focus:outline-none">
44
+ <i data-feather="menu" class="w-6 h-6"></i>
45
+ </button>
46
+ </div>
47
+ </div>
48
+ </nav>
49
+ `;
50
+ }
51
+ }
52
+
53
+ customElements.define('custom-navbar', CustomNavbar);
components/search.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomSearch extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .search-input {
7
+ transition: box-shadow 0.3s ease, border-color 0.3s ease;
8
+ }
9
+ .search-input:focus {
10
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
11
+ }
12
+ </style>
13
+ <div class="bg-white rounded-lg shadow-md p-6">
14
+ <h2 class="text-2xl font-semibold mb-4 text-gray-800">Search American Data</h2>
15
+ <div class="flex flex-col md:flex-row gap-4">
16
+ <div class="flex-grow">
17
+ <input type="text"
18
+ placeholder="Enter state, city, or demographic..."
19
+ class="search-input w-full px-4 py-3 border border-gray-300 rounded-lg focus:border-blue-500 focus:outline-none">
20
+ </div>
21
+ <button class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg transition-colors duration-300 flex items-center justify-center">
22
+ <i data-feather="search" class="mr-2 w-4 h-4"></i>
23
+ Search
24
+ </button>
25
+ </div>
26
+ <div class="mt-4">
27
+ <p class="text-sm text-gray-500">Try searching for: "California population", "New York income", or "Texas housing"</p>
28
+ </div>
29
+ </div>
30
+ `;
31
+ }
32
+ }
33
+
34
+ customElements.define('custom-search', CustomSearch);
index.html CHANGED
@@ -1,19 +1,85 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
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
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>American Data Explorer</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://unpkg.com/feather-icons"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="components/navbar.js"></script>
12
+ <script src="components/search.js"></script>
13
+ <script src="components/footer.js"></script>
14
+ </head>
15
+ <body class="bg-gray-100 min-h-screen flex flex-col">
16
+ <custom-navbar></custom-navbar>
17
+
18
+ <main class="flex-grow container mx-auto px-4 py-8">
19
+ <div class="max-w-4xl mx-auto">
20
+ <div class="text-center mb-12">
21
+ <h1 class="text-4xl font-bold text-gray-900 mb-4">American Data Explorer</h1>
22
+ <p class="text-xl text-gray-600">Discover fascinating statistics and information about Americans</p>
23
+ </div>
24
+
25
+ <custom-search></custom-search>
26
+
27
+ <div class="grid md:grid-cols-3 gap-8 mt-12">
28
+ <div class="bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow">
29
+ <div class="text-blue-600 mb-4">
30
+ <i data-feather="users" class="w-10 h-10"></i>
31
+ </div>
32
+ <h3 class="text-xl font-semibold mb-2">Population Stats</h3>
33
+ <p class="text-gray-600 mb-4">Explore demographic data including age, gender, and ethnicity distributions.</p>
34
+ <a href="population.html" class="text-blue-600 hover:text-blue-800 font-medium inline-flex items-center">
35
+ View details <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
36
+ </a>
37
+ </div>
38
+
39
+ <div class="bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow">
40
+ <div class="text-green-600 mb-4">
41
+ <i data-feather="dollar-sign" class="w-10 h-10"></i>
42
+ </div>
43
+ <h3 class="text-xl font-semibold mb-2">Economic Data</h3>
44
+ <p class="text-gray-600 mb-4">Income, employment, and economic mobility statistics across states.</p>
45
+ <a href="economy.html" class="text-green-600 hover:text-green-800 font-medium inline-flex items-center">
46
+ View details <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
47
+ </a>
48
+ </div>
49
+
50
+ <div class="bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow">
51
+ <div class="text-purple-600 mb-4">
52
+ <i data-feather="home" class="w-10 h-10"></i>
53
+ </div>
54
+ <h3 class="text-xl font-semibold mb-2">Housing Trends</h3>
55
+ <p class="text-gray-600 mb-4">Housing prices, ownership rates, and rental market analysis.</p>
56
+ <a href="housing.html" class="text-purple-600 hover:text-purple-800 font-medium inline-flex items-center">
57
+ View details <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
58
+ </a>
59
+ </div>
60
+ </div>
61
+
62
+ <div class="mt-16 bg-white rounded-lg shadow-md p-8">
63
+ <h2 class="text-2xl font-bold mb-6 text-gray-800">About This Project</h2>
64
+ <p class="text-gray-600 mb-4">
65
+ The American Data Explorer provides easy access to comprehensive data about the United States population.
66
+ Our platform aggregates and visualizes data from trusted government sources to help you understand
67
+ American demographics, economics, and social trends.
68
+ </p>
69
+ <p class="text-gray-600">
70
+ Whether you're a researcher, student, journalist, or just curious, our tools make complex data accessible
71
+ and understandable.
72
+ </p>
73
+ </div>
74
+ </div>
75
+ </main>
76
+
77
+ <custom-footer></custom-footer>
78
+
79
+ <script>
80
+ feather.replace();
81
+ </script>
82
+ <script src="script.js"></script>
83
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
84
+ </body>
85
+ </html>
script.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Initialize tooltips
2
+ document.addEventListener('DOMContentLoaded', function() {
3
+ // Initialize any tooltips if needed
4
+ });
5
+
6
+ // Function to fetch data from APIs
7
+ async function fetchData(endpoint) {
8
+ try {
9
+ const response = await fetch(endpoint);
10
+ if (!response.ok) throw new Error('Network response was not ok');
11
+ return await response.json();
12
+ } catch (error) {
13
+ console.error('Error fetching data:', error);
14
+ return null;
15
+ }
16
+ }
17
+
18
+ // Smooth scroll for anchor links
19
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
20
+ anchor.addEventListener('click', function (e) {
21
+ e.preventDefault();
22
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
23
+ behavior: 'smooth'
24
+ });
25
+ });
26
+ });
style.css CHANGED
@@ -1,28 +1,35 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
28
  }
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', system-ui, -apple-system, sans-serif;
5
+ }
6
+
7
+ /* Custom scrollbar */
8
+ ::-webkit-scrollbar {
9
+ width: 8px;
10
+ height: 8px;
11
  }
12
 
13
+ ::-webkit-scrollbar-track {
14
+ background: #f1f1f1;
15
+ border-radius: 10px;
16
  }
17
 
18
+ ::-webkit-scrollbar-thumb {
19
+ background: #888;
20
+ border-radius: 10px;
 
 
21
  }
22
 
23
+ ::-webkit-scrollbar-thumb:hover {
24
+ background: #555;
 
 
 
 
25
  }
26
 
27
+ /* Animation for cards */
28
+ @keyframes fadeIn {
29
+ from { opacity: 0; transform: translateY(20px); }
30
+ to { opacity: 1; transform: translateY(0); }
31
  }
32
+
33
+ .card-animation {
34
+ animation: fadeIn 0.5s ease-out forwards;
35
+ }