ChandimaPrabath commited on
Commit
0d4d44f
1 Parent(s): 03769d0
frontend/src/components/HeroSection.css CHANGED
@@ -1,181 +1,195 @@
1
- /* Fade-in animation for the hero section */
 
2
  @keyframes fadeIn {
3
- 0% {
4
- opacity: 0;
5
- }
6
- 100% {
7
- opacity: 1;
8
- }
9
  }
10
 
11
  .hero-container {
12
- position: relative;
13
- width: 100%;
14
- overflow: hidden;
15
  }
16
 
17
  .hero-section {
18
- display: flex;
19
- flex-direction: column;
20
- min-height: 480px;
21
- position: relative;
22
- border-radius: 12px;
23
- padding: 1rem;
24
- padding-bottom: 2.5rem;
25
- justify-content: flex-end;
26
- animation: fadeIn 1s ease-in-out; /* Add fade-in animation */
27
  }
28
 
29
  .hero-image {
30
- position: absolute;
31
- top: 0;
32
- left: 0;
33
- width: 100%;
34
- height: 100%;
35
- background-size: cover;
36
- background-position: center;
37
- background-repeat: no-repeat;
38
- transition: opacity 1s ease-in-out; /* Smooth transition */
39
- opacity: 0;
40
  }
41
 
42
  .hero-image.active {
43
- opacity: 1;
44
  }
45
 
46
  .hero-text {
47
- display: flex;
48
- flex-direction: column;
49
- gap: 0.5rem;
50
- text-align: left;
51
- position: relative;
52
- z-index: 1;
 
 
 
 
53
  }
54
 
55
  .hero-title {
56
- color: white;
57
- font-size: 2.5rem;
58
- font-weight: 900;
59
- line-height: 1.2;
60
- transition: font-size 0.3s ease-in-out;
 
 
 
 
 
 
 
 
 
61
  }
62
 
63
  .hero-description {
64
- color: white;
65
- font-size: 1rem;
66
- font-weight: normal;
67
- line-height: 1.4;
68
- overflow: hidden; /* Hide text overflow */
69
- display: -webkit-box; /* Use flexbox layout */
70
- -webkit-line-clamp: 3; /* Limit text to 3 lines */
71
- -webkit-box-orient: vertical; /* Set box orientation to vertical */
72
- text-overflow: ellipsis; /* Add ellipsis (...) */
73
- transition: font-size 0.3s ease-in-out;
74
  }
75
 
76
  .hero-indicators {
77
- position: absolute;
78
- bottom: 1rem;
79
- left: 50%;
80
- transform: translateX(-50%);
81
- display: flex;
82
- gap: 0.5rem;
83
  }
84
 
85
  .indicator {
86
- width: 20px;
87
- height: 10px;
88
- border-radius: 5px;
89
- background-color: gray;
90
- cursor: pointer;
91
- transition: background-color 0.3s ease-in-out, transform 0.3s ease-in-out;
92
  }
93
 
94
  .indicator.active {
95
- background-color: white;
96
- transform: scale(1.2);
97
  }
98
 
99
  /* Responsive Styles */
100
  @media (max-width: 1200px) {
101
- .hero-title {
102
- font-size: 2rem;
103
- }
104
- .hero-description {
105
- font-size: 0.875rem;
106
- }
107
- .hero-button {
108
- height: 2rem;
109
- font-size: 0.75rem;
110
- padding: 0 0.75rem;
111
- }
112
- .indicator {
113
- width: 15px;
114
- height: 7px;
115
- }
116
  }
117
 
118
  @media (max-width: 992px) {
119
- .hero-section {
120
- min-height: 400px;
121
- }
122
- .hero-title {
123
- font-size: 1.75rem;
124
- }
125
- .hero-description {
126
- font-size: 0.75rem;
127
- }
128
- .hero-button {
129
- height: 1.75rem;
130
- font-size: 0.675rem;
131
- padding: 0 0.5rem;
132
- }
133
- .indicator {
134
- width: 12px;
135
- height: 6px;
136
- }
137
  }
138
 
139
  @media (max-width: 768px) {
140
- .hero-section {
141
- min-height: 300px;
142
- padding: 0.5rem;
143
- padding-bottom: 2rem;
144
- }
145
- .hero-title {
146
- font-size: 1.5rem;
147
- }
148
- .hero-description {
149
- font-size: 0.875rem;
150
- }
151
- .hero-button {
152
- height: 1.5rem;
153
- font-size: 0.75rem;
154
- padding: 0 0.5rem;
155
- }
156
- .indicator {
157
- width: 15px;
158
- height: 8px;
159
- }
160
  }
161
 
162
  @media (max-width: 576px) {
163
- .hero-section {
164
- min-height: 200px;
165
- }
166
- .hero-title {
167
- font-size: 1.25rem;
168
- }
169
- .hero-description {
170
- font-size: 0.75rem;
171
- }
172
- .hero-button {
173
- height: 1.25rem;
174
- font-size: 0.625rem;
175
- padding: 0 0.5rem;
176
- }
177
- .indicator {
178
- width: 12px;
179
- height: 6px;
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: 'Film'
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: 320px;
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;