source: src/main/resources/templates/categoryPage.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.6 KB
Line 
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>Categories</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<body class="font-sans antialiased bg-gray-100 flex flex-col min-h-screen">
30
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="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
79 <!-- Main Content -->
80 <div class="container mx-auto mt-8">
81 <div class="flex flex-col sm:flex-row"> <!-- Flex direction column for small screens, row for larger screens -->
82 <!-- Categories -->
83 <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">
84 <h2 class="text-xl font-semibold mb-4">Categories</h2>
85 <hr>
86 <ul class="relative">
87 <li th:each="cat : ${categories}" class="m-5 hover:text-emerald-500 category-item relative">
88 <a th:text="${cat.categoryName}"
89 th:value="${cat.categoryId}"
90 th:href="@{'/category/' + ${cat.categoryName}}"
91 th:id="${cat.categoryId}"
92 th:classappend="${selectedCategory.equals(cat.categoryName)} ? 'text-emerald-500 hover:text-emerald-500' : 'hover:text-emerald-500'">
93 </a>
94 <div class="subcategory ml-8"> <!-- Separate div for subcategories -->
95 <ul>
96 <li th:each="subcat : ${subcategories}"
97 th:if="${subcat.categoryId} == ${cat.categoryId}">
98 <a th:text="${subcat.subcategoryName}"
99 th:value="${subcat.subcategoryId}"
100 th:href="@{'/category/subcategory/' + ${subcat.subcategoryName}}"
101 th:id="${subcat.subcategoryId}"
102 class="text-white-500 hover:text-emerald-500">
103 </a>
104 </li>
105 </ul>
106 </div>
107 </li>
108 </ul>
109 </div>
110
111 <!-- Hot Products -->
112 <div class="w-full sm:w-3/4"> <!-- Full width for small screens, 3/4 width for larger screens -->
113 <div class="flex justify-between items-center mb-4">
114 <h2 class="text-xl font-semibold">Hot Products</h2>
115 <form th:action="@{/filter}" method="post">
116 <label>
117 <input type="text" name="name" placeholder="Search..."
118 class="px-4 py-2 border border-gray-300 rounded-lg focus:outline-none">
119 </label>
120 <input type="hidden" name="selectedCategory" th:text="${selectedCategory}">
121 </form>
122 </div>
123 <!-- Product Grid -->
124 <div class="grid grid-cols-1 sm:grid-cols-3 gap-8">
125 <!-- 1 column for small screens, 3 columns for larger screens -->
126 <!--Product Card -->
127 <div th:each="product : ${products}" class="bg-white shadow-lg rounded-lg p-4">
128 <img src="../static/images/intel_core_i7.jpg" th:src="${product.productImage}"
129 alt="Product Image"
130 class="mb-4 rounded-lg object-scale-down h-48 w-96">
131 <a th:href="@{'/product/{id}' (id=${product.productId})}">
132 <h3 th:text="${product.productName}" class="font-semibold text-lg mb-2"></h3>
133 </a>
134 <p th:attr="title=${product.productDescription}" class="text-gray-600 overflow-hidden"
135 style="height: 150px;">
136 <span th:text="${product.productDescription.length() &gt; 142 ? product.productDescription.substring(0, 142) + '...' : product.productDescription}"></span>
137 </p>
138 <div class="mt-4 flex justify-between items-center">
139 <span th:text="${product.productPrice + ' ден.'}"
140 class="text-gray-800 font-semibold"></span>
141 <a th:href="${user != null} ? @{'/shoppingCart/' + ${product.productId}} : '/login'"
142 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">
143 Add to Cart
144 </a>
145 </div>
146 </div>
147
148 </div>
149 </div>
150 </div>
151 </div>
152</main>
153
154<!-- Footer -->
155<footer class="bg-white rounded-lg shadow m-4 dark:bg-gray-800">
156 <div class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-between">
157 <span class="text-sm text-gray-500 sm:text-center dark:text-gray-400">© 2024 Tech Harbor. All rights reserved.™
158 </span>
159 <ul class="flex flex-wrap items-center mt-3 text-sm font-medium text-gray-500 dark:text-gray-400 sm:mt-0">
160 <li>
161 <a th:href="@{'/aboutUs'}" class="hover:underline me-4 md:me-6">About</a>
162 </li>
163 <li>
164 <a href="#" class="hover:underline me-4 md:me-6">Privacy Policy</a>
165 </li>
166 <li>
167 <a href="#" class="hover:underline">Contact</a>
168 </li>
169 </ul>
170 </div>
171</footer>
172</body>
173</html>
Note: See TracBrowser for help on using the repository browser.