Skip to content

Commit 92011cb

Browse files
Merge pull request #228 from Houssien-Zeineddine/frontend-landingpage
Frontend landingpage
2 parents 9c95916 + 7f3f40d commit 92011cb

File tree

7 files changed

+396
-25
lines changed

7 files changed

+396
-25
lines changed

client/src/pages/Dashboard/Elections/index.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ const Elections = () => {
6161
</div>
6262
<div className="bars-container">
6363
{results.map((candidate, index) => (
64-
<div key={index} className="bar-result-container">
64+
<div
65+
key={index}
66+
className="bar-result-container"
67+
data-name={candidate.name}
68+
style={{ "--index": index }}
69+
>
6570
<div
6671
className="vote-bar"
6772
style={{ "--target-width": `${candidate.percentage}%` }}

client/src/pages/Dashboard/Elections/style.css

Lines changed: 132 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,86 @@
9292
color: var(--primary-color);
9393
font-weight: var(--font-weight-medium);
9494
font-size: var(--font-size-header-4);
95+
animation: fadeIn 0.8s ease-out forwards;
96+
animation-delay: calc(0.1s * var(--index, 0));
97+
opacity: 0;
98+
position: relative;
99+
height: 2rem;
100+
padding-right: 60px;
101+
/* Space for percentage text */
102+
}
103+
104+
.bar-result-container:after {
105+
content: '';
106+
position: absolute;
107+
left: 0;
108+
top: 0;
109+
height: 2rem;
110+
width: 100%;
111+
background-color: rgba(0, 0, 0, 0.05);
112+
border-radius: 100px;
113+
z-index: 1;
95114
}
96115

97116
.vote-bar {
98117
height: 2rem;
99118
background-color: var(--primary-color);
100119
border-radius: 100px;
101-
width: var(--target-width);
102-
animation: growBar 1s ease-out forwards;
120+
width: 0;
121+
animation: growBar 1.5s cubic-bezier(0.26, 0.86, 0.44, 0.985) forwards;
122+
position: absolute;
123+
left: 0;
124+
top: 0;
125+
overflow: hidden;
126+
z-index: 2;
127+
}
128+
129+
.vote-bar::after {
130+
content: '';
131+
position: absolute;
132+
top: 0;
133+
left: 0;
134+
right: 0;
135+
bottom: 0;
136+
background: linear-gradient(90deg,
137+
rgba(255, 255, 255, 0.1) 0%,
138+
rgba(255, 255, 255, 0.2) 50%,
139+
rgba(255, 255, 255, 0.1) 100%);
140+
width: 75%;
141+
height: 100%;
142+
animation: shimmer 2s infinite;
143+
transform: translateX(-100%);
144+
}
145+
146+
@keyframes shimmer {
147+
100% {
148+
transform: translateX(150%);
149+
}
150+
}
151+
152+
@keyframes growBar {
153+
from {
154+
width: 0;
155+
}
156+
157+
to {
158+
width: var(--target-width);
159+
}
160+
}
161+
162+
.bar-result-container p {
163+
min-width: 50px;
164+
text-align: right;
165+
font-weight: 600;
166+
animation: countUp 2s forwards;
167+
z-index: 3;
168+
position: absolute;
169+
right: 0;
170+
top: 0;
171+
margin: 0;
172+
height: 2rem;
173+
display: flex;
174+
align-items: center;
103175
}
104176

105177
/* statistics container */
@@ -121,6 +193,7 @@
121193

122194
.statistics-container h4 {
123195
font-size: var(--font-size-header-4);
196+
text-align: center;
124197
}
125198

126199
.round-div {
@@ -240,18 +313,47 @@
240313
}
241314

242315
.candidates-names {
243-
width: 100%;
244-
gap: 1.5rem;
245-
margin-bottom: 1rem;
316+
display: none;
246317
}
247318

248319
.bar-result-container {
249-
gap: 0.5rem;
250-
margin-bottom: 0.5rem;
320+
position: relative;
321+
margin-bottom: 1.5rem;
322+
padding-top: 1.5rem;
323+
background: transparent;
324+
height: auto;
325+
padding-right: 0;
251326
}
252327

253-
.vote-bar {
328+
.bar-result-container:before {
329+
content: attr(data-name);
330+
position: absolute;
331+
top: 0;
332+
left: 0;
333+
font-weight: 600;
334+
color: var(--primary-color);
335+
font-size: 0.95rem;
336+
margin-bottom: 0.3rem;
337+
}
338+
339+
.bar-result-container .vote-bar {
340+
position: absolute;
341+
left: 0;
342+
top: 1.5rem;
254343
height: 1.5rem;
344+
width: var(--target-width) !important;
345+
margin: 0;
346+
}
347+
348+
.bar-result-container:after {
349+
top: 1.5rem;
350+
width: 100%;
351+
}
352+
353+
.bar-result-container p {
354+
top: 0;
355+
right: 0;
356+
height: auto;
255357
}
256358

257359
.statistics-container {
@@ -317,6 +419,14 @@
317419
.statistics-container p {
318420
margin: 0.25rem 0;
319421
}
422+
423+
.bar-result-container:before {
424+
font-size: 0.9rem;
425+
}
426+
427+
.bar-result-container:after {
428+
height: 1.2rem;
429+
}
320430
}
321431

322432
@media screen and (max-width: 360px) {
@@ -348,4 +458,18 @@
348458
.statistics-container {
349459
padding: 0.5rem;
350460
}
461+
462+
.bar-result-container {
463+
padding-top: 1.8rem;
464+
}
465+
466+
.bar-result-container:before {
467+
font-size: 0.85rem;
468+
}
469+
470+
.bar-result-container .vote-bar,
471+
.bar-result-container:after {
472+
height: 1.2rem;
473+
top: 1.8rem;
474+
}
351475
}

client/src/pages/Home/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import securedPlatform from "../../assets/web-security 2.svg";
1313
import realTimeResults from "../../assets/pie-chart 1.svg";
1414
import { AuthContext } from "../../components/Context/AuthorizationContext";
1515
import "./styles.css";
16+
import "./responsive.css";
1617

1718
const Home = () => {
1819
const { user } = useContext(AuthContext);

0 commit comments

Comments
 (0)