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
24 changes: 23 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,30 @@ <h3 class="fw-light center">Sponsors</h3>
</div>
</div>
</section>
<!-- Subscribe to newsletter -->
<section class="ev-container text-med-black ev-super-light-bg">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Css seems a bit distorted for mobile devices. Can you please try making padding:0px for .grad-container just for the testimonial container.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The left and right buttons? Because I had seen the mobile view as well. I will check it once again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kajol-Kumari Currently, the mobile view is:
Screenshot from 2021-07-14 00-36-00

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we can use the left and right padding spaces just for mobile devices. It would look much cleaner that way.

Copy link
Member Author

@gautamjajoo gautamjajoo Jul 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kajol-Kumari Got it. Done the required changes.
Screenshot from 2021-07-14 18-09-53

Copy link
Member

@Kajol-Kumari Kajol-Kumari Jul 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gautamjajoo Instead of renaming grad-container to grad-conatiner-testimonial and repeating the styles of .grad-container at here You can instead put an extra wrapper class eg testimonial-wrapper here like <section class="ev-container testimonial-wrapper text-med-black ev-super-light-bg"> and just just do

.testimonial-wrapper {
    .grad-container {
      padding:0px;
    }
  }

under the media query for mobile devices

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<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="testimonial-author fs-20">- {{ testimonialauthor }}</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">
<div class="grad-container text-med-black">
<div class="row">
<h3 class="fw-light center">Subscribe to our newsletter</h3>
Expand Down
77 changes: 77 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,81 @@ 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: 100px;
span {
RishabhJain2018 marked this conversation as resolved.
Show resolved Hide resolved
color: #000;
font-weight: $fw-light;
font-style: italic;
padding: 15px;
}
}

.testimonial-author {
color: #000;
font-weight: $fw-regular;
padding-bottom: 70px;
text-align: right;
padding-right: 15vw;
}

.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;
}
}
}


#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
148 changes: 146 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,37 @@ 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' },
{ text: '2-' + this.ipsum, author: 'Octopus' },
{ text: '3-' + this.ipsum, author: 'Penguin' },
];

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

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

/**
* Subscribe Form
*/
Expand All @@ -32,12 +64,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 +153,112 @@ 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];
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);
}

/**
* Fly left animation
*/
flyLeftRecursive = (element, temp) => {
gautamjajoo marked this conversation as resolved.
Show resolved Hide resolved
const x = temp - 1;
if (x > -100) {
(function (scope) {
setTimeout(function () {
element.style.marginLeft = x + '%';
scope.flyLeftRecursive(element, x);
}, 5);
})(this);
}
};

/**
* Fly right animation
*/
flyRightRecursive = (element, temp) => {
gautamjajoo marked this conversation as resolved.
Show resolved Hide resolved
const x = temp + 1;
if (x < 100) {
(function (scope) {
setTimeout(function () {
element.style.marginLeft = x + '%';
scope.flyRightRecursive(element, x);
}, 5);
})(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'];
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