source: src/main/resources/templates/index.html

main
Last change on this file was f4b4afa, checked in by Nikola Todoroski <nikola.todoroski@…>, 6 months ago

Pushed whole project, original project location on github:https://github.com/hehxd/Tech-Harbor

  • Property mode set to 100644
File size: 8.4 KB
RevLine 
[f4b4afa]1<!DOCTYPE html>
2<html lang="en" xmlns:th="http://www.thymeleaf.org">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>Home Page</title>
7 <!-- Tailwind CSS from CDN for development purposes -->
8 <script src="https://cdn.tailwindcss.com"></script>
9 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
10 <link href="./output.css" rel="stylesheet">
11 <style>
12 .subcategory {
13 display: none;
14 }
15
16 .category-item:hover .subcategory {
17 display: block;
18 right: 0; /* Adjust the position to the right */
19 top: 0;
20 background-color: #4a5568; /* Change the background color */
21 padding: 1rem;
22 z-index: 10;
23 width: 240px; /* Increase the width */
24 border: 2px solid;
25 border-radius: 5px;
26 }
27 </style>
28</head>
29
30<body class="bg-gray-100 font-sans flex flex-col min-h-screen">
31<!-- Navbar -->
32<nav class="bg-gray-800 text-white p-4 text-lg sm:text-xl"> <!-- Responsive font size -->
33 <div class="container mx-auto flex justify-between items-center">
34 <div class="flex items-center">
35 <img src="/images/logoWhite.png" alt="Logo" class="object-cover h-32 w-32 rounded-lg">
36 <h1 class="text-2xl font-semibold ml-4 sm:text-3xl">Tech Harbor</h1> <!-- Responsive font size -->
37 </div>
38 <ul class="flex space-x-8">
39 <li><a href="/" class="text-emerald-500 hover:text-emerald-500">Home</a></li>
40 <li><a th:href="@{'/aboutUs'}" class="hover:text-emerald-500">About Us</a></li>
41 <li th:if="${user != null}">
42 <a th:href="@{'/orders/{id}' (id=${user.userId})}" class="hover:text-emerald-500">My Orders</a>
43 </li>
44 <li th:if="${user != null}">
45 <a th:href="@{'/reviews/{id}' (id=${user.userId})}" class="hover:text-emerald-500">My Reviews</a>
46 </li>
47 <li th:if="${deliveryMan != null}">
48 <a th:href="@{'/myDeliveries/{id}' (id=${deliveryMan.userId})}" class="hover:text-emerald-500">My
49 Deliveries</a>
50 </li>
51 </ul>
52 <ul class="flex space-x-4">
53 <li th:if="${user != null}">
54 <span>Welcome <span th:text="${user.nameUser}"></span></span>
55 </li>
56 <li th:if="${deliveryMan != null}">
57 <span>Welcome Delivery Man <span th:text="${deliveryMan.nameUser}"></span></span>
58 </li>
59 <li th:if="${user != null}">
60 <a th:href="@{'/shoppingCart'}"><i class="fa-solid fa-cart-shopping"></i></a>
61 </li>
62 <li th:if="${user != null || deliveryMan != null}">
63 <a class="hover:text-emerald-500" th:href="@{/logout}">Log out</a>
64 </li>
65 <li th:if="${user == null && deliveryMan == null}">
66 <a th:href="@{/login}" class="hover:text-emerald-500">Sign In</a>
67 </li>
68 <li th:if="${user == null && deliveryMan == null}">
69 <a th:href="@{/register}" class="hover:text-emerald-500">Register</a>
70 </li>
71 </ul>
72
73 </div>
74</nav>
75
76<main class="container mx-auto mt-8 flex-grow">
77
78 <!-- Main Content -->
79 <div class="container mx-auto mt-8">
80 <div class="flex flex-col sm:flex-row"> <!-- Flex direction column for small screens, row for larger screens -->
81 <!-- Categories -->
82 <div class="inline-block sm:w-1/6 bg-gray-800 shadow-lg rounded-lg p-4 m-2 mr-0 sm:mr-10 text-center text-white text-lg mb-auto">
83 <h2 class="text-xl font-semibold mb-4">Categories</h2>
84 <hr>
85 <ul class="relative">
86 <li th:each="cat : ${categories}" class="m-5 hover:text-emerald-500 category-item relative">
87 <a th:text="${cat.categoryName}"
88 th:value="${cat.categoryId}"
89 th:href="@{'/category/' + ${cat.categoryName}}"
90 th:id="${cat.categoryId}"
91 class="text-white-500 hover:text-emerald-500">
92 </a>
93 <div class="subcategory ml-8"> <!-- Separate div for subcategories -->
94 <ul>
95 <li th:each="subcat : ${subcategories}"
96 th:if="${subcat.categoryId} == ${cat.categoryId}">
97 <a th:text="${subcat.subcategoryName}"
98 th:value="${subcat.subcategoryId}"
99 th:href="@{'/category/subcategory/' + ${subcat.subcategoryName}}"
100 th:id="${subcat.subcategoryId}"
101 class="text-white-500 hover:text-emerald-500">
102 </a>
103 </li>
104 </ul>
105 </div>
106 </li>
107 </ul>
108 </div>
109
110 <!-- Hot Products -->
111 <div class="w-full sm:w-3/4"> <!-- Full width for small screens, 3/4 width for larger screens -->
112 <div class="flex justify-between items-center mb-4">
113 <h2 class="text-xl font-semibold">Hot Products</h2>
114 <form th:action="@{/filter}" method="post">
115 <label>
116 <input type="text" name="name" placeholder="Search..."
117 class="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none">
118 </label>
119 </form>
120 </div>
121 <!-- Product Grid -->
122 <div class="grid grid-cols-1 sm:grid-cols-3 gap-8">
123 <!-- 1 column for small screens, 3 columns for larger screens -->
124 <!-- Product Card -->
125
126 <div th:each="product : ${products}" class="bg-white shadow-lg rounded-lg p-4">
127 <img src="../static/images/intel_core_i7.jpg" th:src="${product.productImage}"
128 alt="Product Image"
129 class="mb-4 rounded-lg object-scale-down h-48 w-96">
130 <a th:href="@{'/product/{id}' (id=${product.productId})}">
131 <h3 th:text="${product.productName}" class="font-semibold text-lg mb-2"></h3>
132 </a>
133 <p th:attr="title=${product.productDescription}" class="text-gray-600 overflow-hidden"
134 style="height: 150px;">
135 <span th:text="${product.productDescription.length() &gt; 142 ? product.productDescription.substring(0, 142) + '...' : product.productDescription}"></span>
136 </p>
137 <div class="mt-4 flex justify-between items-center">
138 <span th:text="${product.productPrice + ' ден.'}"
139 class="text-gray-800 font-semibold"></span>
140 <a th:unless="${deliveryMan != null}" th:href="${user != null} ? @{'/shoppingCart/' + ${product.productId}} : '/login'"
141 class="px-4 py-2 bg-indigo-500 text-white font-bold rounded-md shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
142 Add to Cart
143 </a>
144 </div>
145 </div>
146 </div>
147 </div>
148 </div>
149 </div>
150</main>
151<!-- Footer -->
152<footer class="bg-white rounded-lg shadow m-4 dark:bg-gray-800">
153 <div class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-between">
154 <span class="text-sm text-gray-500 sm:text-center dark:text-gray-400">© 2024 Tech Harbor. All rights reserved.™
155 </span>
156 <ul class="flex flex-wrap items-center mt-3 text-sm font-medium text-gray-500 dark:text-gray-400 sm:mt-0">
157 <li>
158 <a th:href="@{'/aboutUs'}" class="hover:underline me-4 md:me-6">About</a>
159 </li>
160 <li>
161 <a href="#" class="hover:underline me-4 md:me-6">Privacy Policy</a>
162 </li>
163 <li>
164 <a href="#" class="hover:underline">Contact</a>
165 </li>
166 </ul>
167 </div>
168</footer>
169</body>
170</html>
171
172
Note: See TracBrowser for help on using the repository browser.