ChandimaPrabath
commited on
Commit
•
0d4d44f
1
Parent(s):
03769d0
UI fix
Browse files
frontend/src/components/HeroSection.css
CHANGED
@@ -1,181 +1,195 @@
|
|
1 |
-
|
|
|
2 |
@keyframes fadeIn {
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
}
|
10 |
|
11 |
.hero-container {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
}
|
16 |
|
17 |
.hero-section {
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
}
|
28 |
|
29 |
.hero-image {
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
}
|
41 |
|
42 |
.hero-image.active {
|
43 |
-
|
44 |
}
|
45 |
|
46 |
.hero-text {
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
.hero-title {
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
.hero-description {
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
}
|
75 |
|
76 |
.hero-indicators {
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
}
|
84 |
|
85 |
.indicator {
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
}
|
93 |
|
94 |
.indicator.active {
|
95 |
-
|
96 |
-
|
97 |
}
|
98 |
|
99 |
/* Responsive Styles */
|
100 |
@media (max-width: 1200px) {
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
}
|
117 |
|
118 |
@media (max-width: 992px) {
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
}
|
138 |
|
139 |
@media (max-width: 768px) {
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
}
|
161 |
|
162 |
@media (max-width: 576px) {
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
}
|
|
|
1 |
+
@import url('https://fonts.googleapis.com/css2?family=New+Amsterdam&display=swap');
|
2 |
+
|
3 |
@keyframes fadeIn {
|
4 |
+
0% {
|
5 |
+
opacity: 0;
|
6 |
+
}
|
7 |
+
100% {
|
8 |
+
opacity: 1;
|
9 |
+
}
|
10 |
}
|
11 |
|
12 |
.hero-container {
|
13 |
+
position: relative;
|
14 |
+
width: 100%;
|
15 |
+
overflow: hidden;
|
16 |
}
|
17 |
|
18 |
.hero-section {
|
19 |
+
display: flex;
|
20 |
+
flex-direction: column;
|
21 |
+
min-height: 480px;
|
22 |
+
position: relative;
|
23 |
+
border-radius: 12px;
|
24 |
+
padding: 1rem;
|
25 |
+
padding-bottom: 2.5rem;
|
26 |
+
justify-content: center;
|
27 |
+
animation: fadeIn 1s ease-in-out; /* Add fade-in animation */
|
28 |
}
|
29 |
|
30 |
.hero-image {
|
31 |
+
position: absolute;
|
32 |
+
top: 0;
|
33 |
+
left: 0;
|
34 |
+
width: 100%;
|
35 |
+
height: 100%;
|
36 |
+
background-size: cover;
|
37 |
+
background-position: center;
|
38 |
+
background-repeat: no-repeat;
|
39 |
+
transition: opacity 1s ease-in-out; /* Smooth transition */
|
40 |
+
opacity: 0;
|
41 |
}
|
42 |
|
43 |
.hero-image.active {
|
44 |
+
opacity: 1;
|
45 |
}
|
46 |
|
47 |
.hero-text {
|
48 |
+
display: flex;
|
49 |
+
flex-direction: column;
|
50 |
+
justify-content: center;
|
51 |
+
color: white;
|
52 |
+
gap: 0.5rem;
|
53 |
+
text-align: left;
|
54 |
+
z-index: 1;
|
55 |
+
height: 100%;
|
56 |
+
margin: 20px;
|
57 |
+
width: 49%;
|
58 |
}
|
59 |
|
60 |
.hero-title {
|
61 |
+
color: white;
|
62 |
+
font-size: 5rem;
|
63 |
+
font-weight: 600;
|
64 |
+
font-family: "New Amsterdam", sans-serif;
|
65 |
+
font-style: normal;
|
66 |
+
line-height: 1;
|
67 |
+
transition: font-size 0.3s ease-in-out;
|
68 |
+
}
|
69 |
+
|
70 |
+
.hero-section-play-button {
|
71 |
+
background-color: #1f202196;
|
72 |
+
padding: 10px;
|
73 |
+
width: 120px;
|
74 |
+
border-radius: 5px;
|
75 |
}
|
76 |
|
77 |
.hero-description {
|
78 |
+
color: white;
|
79 |
+
font-size: 1rem;
|
80 |
+
font-weight: normal;
|
81 |
+
line-height: 1.4;
|
82 |
+
overflow: hidden; /* Hide text overflow */
|
83 |
+
display: -webkit-box; /* Use flexbox layout */
|
84 |
+
-webkit-line-clamp: 3; /* Limit text to 3 lines */
|
85 |
+
-webkit-box-orient: vertical; /* Set box orientation to vertical */
|
86 |
+
text-overflow: ellipsis; /* Add ellipsis (...) */
|
87 |
+
transition: font-size 0.3s ease-in-out;
|
88 |
}
|
89 |
|
90 |
.hero-indicators {
|
91 |
+
position: absolute;
|
92 |
+
bottom: 1rem;
|
93 |
+
left: 50%;
|
94 |
+
transform: translateX(-50%);
|
95 |
+
display: flex;
|
96 |
+
gap: 0.5rem;
|
97 |
}
|
98 |
|
99 |
.indicator {
|
100 |
+
width: 20px;
|
101 |
+
height: 10px;
|
102 |
+
border-radius: 5px;
|
103 |
+
background-color: gray;
|
104 |
+
cursor: pointer;
|
105 |
+
transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
|
106 |
}
|
107 |
|
108 |
.indicator.active {
|
109 |
+
background-color: white;
|
110 |
+
transform: scale(1.2);
|
111 |
}
|
112 |
|
113 |
/* Responsive Styles */
|
114 |
@media (max-width: 1200px) {
|
115 |
+
.hero-title {
|
116 |
+
font-size: 2rem;
|
117 |
+
}
|
118 |
+
.hero-description {
|
119 |
+
font-size: 0.875rem;
|
120 |
+
}
|
121 |
+
.hero-button {
|
122 |
+
height: 2rem;
|
123 |
+
font-size: 0.75rem;
|
124 |
+
padding: 0 0.75rem;
|
125 |
+
}
|
126 |
+
.indicator {
|
127 |
+
width: 15px;
|
128 |
+
height: 7px;
|
129 |
+
}
|
130 |
}
|
131 |
|
132 |
@media (max-width: 992px) {
|
133 |
+
.hero-section {
|
134 |
+
min-height: 400px;
|
135 |
+
}
|
136 |
+
.hero-title {
|
137 |
+
font-size: 1.75rem;
|
138 |
+
}
|
139 |
+
.hero-description {
|
140 |
+
font-size: 0.75rem;
|
141 |
+
}
|
142 |
+
.hero-button {
|
143 |
+
height: 1.75rem;
|
144 |
+
font-size: 0.675rem;
|
145 |
+
padding: 0 0.5rem;
|
146 |
+
}
|
147 |
+
.indicator {
|
148 |
+
width: 12px;
|
149 |
+
height: 6px;
|
150 |
+
}
|
151 |
}
|
152 |
|
153 |
@media (max-width: 768px) {
|
154 |
+
.hero-section {
|
155 |
+
min-height: 300px;
|
156 |
+
padding: 0.5rem;
|
157 |
+
padding-bottom: 2rem;
|
158 |
+
}
|
159 |
+
.hero-title {
|
160 |
+
font-size: 1.5rem;
|
161 |
+
}
|
162 |
+
.hero-description {
|
163 |
+
font-size: 0.875rem;
|
164 |
+
}
|
165 |
+
.hero-button {
|
166 |
+
height: 1.5rem;
|
167 |
+
font-size: 0.75rem;
|
168 |
+
padding: 0 0.5rem;
|
169 |
+
}
|
170 |
+
.indicator {
|
171 |
+
width: 15px;
|
172 |
+
height: 8px;
|
173 |
+
}
|
174 |
}
|
175 |
|
176 |
@media (max-width: 576px) {
|
177 |
+
.hero-section {
|
178 |
+
min-height: 200px;
|
179 |
+
}
|
180 |
+
.hero-title {
|
181 |
+
font-size: 1.25rem;
|
182 |
+
}
|
183 |
+
.hero-description {
|
184 |
+
font-size: 0.75rem;
|
185 |
+
}
|
186 |
+
.hero-button {
|
187 |
+
height: 1.25rem;
|
188 |
+
font-size: 0.625rem;
|
189 |
+
padding: 0 0.5rem;
|
190 |
+
}
|
191 |
+
.indicator {
|
192 |
+
width: 12px;
|
193 |
+
height: 6px;
|
194 |
+
}
|
195 |
}
|
frontend/src/components/HeroSection.js
CHANGED
@@ -3,6 +3,9 @@ import { useState, useEffect, useRef } from 'react';
|
|
3 |
import './HeroSection.css';
|
4 |
import apiClient from '@/api/apiClient';
|
5 |
import SkeletonLoader from '@/skeletons/HeroSection';
|
|
|
|
|
|
|
6 |
|
7 |
const HeroSection = () => {
|
8 |
const [currentIndex, setCurrentIndex] = useState(0);
|
@@ -15,11 +18,12 @@ const HeroSection = () => {
|
|
15 |
const fetchRecentItems = async () => {
|
16 |
try {
|
17 |
const response = await apiClient.getRecent();
|
|
|
18 |
const movies = response.movies.map(film => ({
|
19 |
title: film[0],
|
20 |
description: film[2],
|
21 |
imageUrl: film[3],
|
22 |
-
type: '
|
23 |
}));
|
24 |
const series = response.series.map(serie => ({
|
25 |
title: serie[0],
|
@@ -30,7 +34,6 @@ const HeroSection = () => {
|
|
30 |
setItems([...movies, ...series]);
|
31 |
} catch (error) {
|
32 |
console.error('Error fetching recent items:', error);
|
33 |
-
// Handle error (e.g., set a default list or show an error message)
|
34 |
} finally {
|
35 |
setLoading(false);
|
36 |
}
|
@@ -73,7 +76,8 @@ const HeroSection = () => {
|
|
73 |
return <SkeletonLoader />;
|
74 |
}
|
75 |
|
76 |
-
const { title, description, imageUrl } = items[currentIndex];
|
|
|
77 |
|
78 |
return (
|
79 |
<div className="hero-container">
|
@@ -87,6 +91,11 @@ const HeroSection = () => {
|
|
87 |
))}
|
88 |
<div className="hero-text">
|
89 |
<h1 className="hero-title">{title}</h1>
|
|
|
|
|
|
|
|
|
|
|
90 |
<p className="hero-description">{description}</p>
|
91 |
</div>
|
92 |
</div>
|
|
|
3 |
import './HeroSection.css';
|
4 |
import apiClient from '@/api/apiClient';
|
5 |
import SkeletonLoader from '@/skeletons/HeroSection';
|
6 |
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
7 |
+
import { faPlay } from '@fortawesome/free-solid-svg-icons';
|
8 |
+
import Link from 'next/link';
|
9 |
|
10 |
const HeroSection = () => {
|
11 |
const [currentIndex, setCurrentIndex] = useState(0);
|
|
|
18 |
const fetchRecentItems = async () => {
|
19 |
try {
|
20 |
const response = await apiClient.getRecent();
|
21 |
+
console.log(response);
|
22 |
const movies = response.movies.map(film => ({
|
23 |
title: film[0],
|
24 |
description: film[2],
|
25 |
imageUrl: film[3],
|
26 |
+
type: 'Movie'
|
27 |
}));
|
28 |
const series = response.series.map(serie => ({
|
29 |
title: serie[0],
|
|
|
34 |
setItems([...movies, ...series]);
|
35 |
} catch (error) {
|
36 |
console.error('Error fetching recent items:', error);
|
|
|
37 |
} finally {
|
38 |
setLoading(false);
|
39 |
}
|
|
|
76 |
return <SkeletonLoader />;
|
77 |
}
|
78 |
|
79 |
+
const { title, description, imageUrl, type } = items[currentIndex];
|
80 |
+
const linkPath = `/${type.toLowerCase()}/${encodeURIComponent(title)}`;
|
81 |
|
82 |
return (
|
83 |
<div className="hero-container">
|
|
|
91 |
))}
|
92 |
<div className="hero-text">
|
93 |
<h1 className="hero-title">{title}</h1>
|
94 |
+
<Link href={linkPath}>
|
95 |
+
<button className="hero-section-play-button">
|
96 |
+
<FontAwesomeIcon icon={faPlay} size="lg" /> Play
|
97 |
+
</button>
|
98 |
+
</Link>
|
99 |
<p className="hero-description">{description}</p>
|
100 |
</div>
|
101 |
</div>
|
frontend/src/components/Sidebar.css
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
}
|
20 |
|
21 |
.sidebar.open {
|
22 |
-
width:
|
23 |
}
|
24 |
|
25 |
.sidebar.closed {
|
@@ -54,6 +54,8 @@
|
|
54 |
|
55 |
.sidebar-link {
|
56 |
text-decoration: none;
|
|
|
|
|
57 |
color: #b0b0b0;
|
58 |
display: flex;
|
59 |
align-items: center;
|
|
|
19 |
}
|
20 |
|
21 |
.sidebar.open {
|
22 |
+
width: 220px;
|
23 |
}
|
24 |
|
25 |
.sidebar.closed {
|
|
|
54 |
|
55 |
.sidebar-link {
|
56 |
text-decoration: none;
|
57 |
+
text-align: center;
|
58 |
+
justify-content: center;
|
59 |
color: #b0b0b0;
|
60 |
display: flex;
|
61 |
align-items: center;
|