Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testimonial section on homepage #3527

Merged
merged 10 commits into from
Aug 26, 2021
33 changes: 32 additions & 1 deletion frontend_v2/src/app/components/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,39 @@ <h3 class="fw-light center">Sponsors</h3>
</div>
</div>
</section>
<!-- Testimonials Section -->
<section class="ev-container testimonial-wrapper text-med-black ev-super-light-bg">
<div class="grad-container text-med-black">
<div class="row">
<h3 class="fw-light center">Testimonials</h3>
</div>
<div class="testimonial-container">
<div class="card ev-card-panel ev-challenge-card z-depth-2 hoverable margin-bottom-cancel">
<div class="testimonial-body">
<span class="fs-24">{{ testimonialbody }}</span>
</div>
<div class="row">
<div class="testimonial-author fs-20">
<img src="../../../assets/images/profile.png" class="logo"/>
<div class="testimonial-details">
<h5 class="name fs-20">{{ testimonialauthor}}</h5>
<span class="orgname fs-18">{{ testimonialorg }}</span>
</div>
</div>
</div>
<img src="assets/images/testimonials/arrow.png" (click)="testimonialNavigate()" class="testimonial-arrow-left" />
<img
src="assets/images/testimonials/arrow.png"
(click)="testimonialNavigate('right')"
class="testimonial-arrow-right"
/>
<img src="assets/images/testimonials/quotes.png" class="testimonial-quotes" />
</div>
</div>
</div>
</section>
<!-- Subscribe to newsletter -->
<section class="ev-container text-med-black ev-super-light-bg">
<section class="ev-container text-med-black">
<div class="grad-container text-med-black">
<div class="row">
<h3 class="fw-light center">Subscribe to our newsletter</h3>
Expand Down
92 changes: 92 additions & 0 deletions frontend_v2/src/app/components/home/home.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@import 'styles/variables';
@import './mixins.scss';


.grad-container .row {
margin-left: auto;
Expand Down Expand Up @@ -92,6 +94,96 @@ p {
}
}

.testimonial-container {
text-align: center;
width: 90%;
height: 30%;
padding-left: 5vw;
.testimonial-body {
RishabhJain2018 marked this conversation as resolved.
Show resolved Hide resolved
width: 70%;
margin-left: 15%;
padding-top: 120px;
padding-bottom: 50px;
span {
RishabhJain2018 marked this conversation as resolved.
Show resolved Hide resolved
color: #000;
font-weight: $fw-light;
font-style: italic;
padding: 15px;
}
}

.testimonial-author {
padding-bottom: 70px;
text-align: left;
display: flex;
align-items: center;
justify-content: center;
.logo {
height: 100px;
width: 100px;
}
.testimonial-details {
margin-left: 15px;
}
.name {
margin: 0;
padding-bottom: 5px;
}
}

.testimonial-arrow-left {
position: absolute;
top: 40%;
left: 0;
height: 100px;
cursor: pointer;
}

.testimonial-arrow-right {
position: absolute;
top: 40%;
right: 0;
height: 100px;
cursor: pointer;
transform: rotate(180deg);
}

.testimonial-quotes {
position: absolute;
top: 15%;
left: 10%;
height: 50px;
}
}

@include screen-medium {
.testimonial-container {
.testimonial-quotes {
top: 15% !important;
height: 40px !important;
}
}
}

@include screen-small {
.testimonial-container {
background-size: 80 !important;
padding-left: 0;
.testimonial-quotes {
height: 30px !important;
top: 12%;
}
.testimonial-author {
padding-bottom: 40px;
}
}
.testimonial-wrapper {
.grad-container {
padding:0px;
}
}
}

#gsoc {
height: 45%;
}
Expand Down
2 changes: 0 additions & 2 deletions frontend_v2/src/app/components/home/home.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { HttpClientModule } from '@angular/common/http';
import { HomemainComponent } from './homemain/homemain.component';
import { PartnersComponent } from './partners/partners.component';
import { RulesComponent } from './rules/rules.component';
import { TestimonialsComponent } from './testimonials/testimonials.component';
import { FeaturedChallengesComponent } from './featured-challenges/featured-challenges.component';
import { TwitterFeedComponent } from './twitter-feed/twitter-feed.component';
import { NO_ERRORS_SCHEMA } from '@angular/core';
Expand All @@ -34,7 +33,6 @@ describe('HomeComponent', () => {
HomemainComponent,
PartnersComponent,
RulesComponent,
TestimonialsComponent,
FeaturedChallengesComponent,
TwitterFeedComponent,
],
Expand Down
126 changes: 124 additions & 2 deletions frontend_v2/src/app/components/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Component, OnDestroy, OnInit, ViewChildren, QueryList, AfterViewInit } from '@angular/core';
import { Component, OnDestroy, OnInit, ViewChildren, QueryList, AfterViewInit, Inject } from '@angular/core';
import { ApiService } from '../../services/api.service';
import { EndpointsService } from '../../services/endpoints.service';
import { AuthService } from '../../services/auth.service';
import { GlobalService } from '../../services/global.service';
import { BehaviorSubject } from 'rxjs';
import { Router } from '@angular/router';
import { InputComponent } from '../../components/utility/input/input.component';
import { DOCUMENT } from '@angular/common';

/**
* Component Class
Expand All @@ -21,6 +22,42 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
public user = {};
public challengeList = [];

/**
* Selected testimonial index
*/
selected = 0;

/**
* Placeholder text Lorem Ipsum
*/
ipsum: any =
'Lorem ipsum dolor sit amet,\
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';

/**
* Sample testimonials till the API comes up
*/
testimonials = [
{ text: '1-' + this.ipsum, author: 'Lorem', org: 'Georgia Tech', image:'' },
{ text: '2-' + this.ipsum, author: 'Octopus', org: 'Google', image:'' },
{ text: '3-' + this.ipsum, author: 'Penguin', org: 'Facebook', image:'' },
];

/**
* Selected testimonial text
*/
testimonialbody = this.testimonials[this.selected]['text'];

/**
* Selected testimonial author
*/
testimonialauthor = this.testimonials[this.selected]['author'];

/**
* Selected testimonial orgName
*/
testimonialorg = this.testimonials[this.selected]['org'];

/**
* Subscribe Form
*/
Expand All @@ -32,12 +69,18 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
components: QueryList<InputComponent>;

authServiceSubscription: any;

/**
* Component constructor
* @param document Window document Injection.
*/
constructor(
private apiService: ApiService,
private endpointService: EndpointsService,
private authService: AuthService,
private globalService: GlobalService,
private router: Router
private router: Router,
@Inject(DOCUMENT) private document: Document
) {}

ngOnInit() {
Expand Down Expand Up @@ -115,6 +158,85 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
);
}

/**
* Right arrow clicked
*/
testimonialRight() {
this.selected = this.selected + 1;
if (this.selected >= this.testimonials.length) {
this.selected = 0;
}
}

/**
* left arrow clicked
*/
testimonialLeft() {
this.selected = this.selected - 1;
if (this.selected < 0) {
this.selected = this.testimonials.length - 1;
}
}

/**
* Testimonials navigated
*/
testimonialNavigate(direction = 'left') {
const a = this.document.getElementsByClassName('testimonial-body')[0];
const b = this.document.getElementsByClassName('testimonial-author')[0];
const c = this.document.getElementsByClassName('testimonial-quotes')[0];
const d = this.document.getElementsByClassName('testimonial-org')[0];
if (direction === 'left') {
this.testimonialLeft();
} else {
this.testimonialRight();
}
this.flyOut(a, direction, this);
this.disappearAppear(a, this);
this.disappearAppear(b, this);
this.disappearAppear(c, this);
this.disappearAppear(d, this);
}

/**
* Fly out animation
*/
flyOut = (element, direction, scope) => {
const temp = 15;
setTimeout(function () {
scope.testimonialbody = scope.testimonials[scope.selected]['text'];
scope.testimonialauthor = scope.testimonials[scope.selected]['author'];
scope.testimonialorg = scope.testimonials[scope.selected]['org'];
element.style.marginLeft = '15%';
}, 1000);
};

/**
* Disappear animation
*/
disappearAppearRecursive = (element, temp) => {
const x = temp - 0.01;
if (x >= 0) {
(function (scope) {
setTimeout(function () {
element.style.opacity = x + '';
scope.disappearAppearRecursive(element, x);
}, 5);
})(this);
}
};

/**
* Disappear animation wrapper
*/
disappearAppear = (element, scope) => {
const temp = 1.0;
this.disappearAppearRecursive(element, temp);
setTimeout(function () {
element.style.opacity = '1';
}, 1000);
};

ngOnDestroy(): void {
if (this.authServiceSubscription) {
this.authServiceSubscription.unsubscribe();
Expand Down
3 changes: 0 additions & 3 deletions frontend_v2/src/app/components/home/home.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { FeaturedChallengesComponent } from './featured-challenges/featured-chal
import { HomemainComponent } from './homemain/homemain.component';
import { PartnersComponent } from './partners/partners.component';
import { RulesComponent } from './rules/rules.component';
import { TestimonialsComponent } from './testimonials/testimonials.component';
import { TwitterFeedComponent } from './twitter-feed/twitter-feed.component';
import { HomeComponent } from './home.component';

Expand All @@ -21,7 +20,6 @@ import { HomeRoutingModule } from './home-routing.module';
TwitterFeedComponent,
PartnersComponent,
RulesComponent,
TestimonialsComponent,
HomemainComponent,
FeaturedChallengesComponent,
],
Expand All @@ -31,7 +29,6 @@ import { HomeRoutingModule } from './home-routing.module';
TwitterFeedComponent,
PartnersComponent,
RulesComponent,
TestimonialsComponent,
HomemainComponent,
FeaturedChallengesComponent,
],
Expand Down

This file was deleted.

Loading