Skip to content

Commit

Permalink
Merged latest changes from insitutional-homepage branch
Browse files Browse the repository at this point in the history
  • Loading branch information
poojagunturu96 committed Apr 12, 2023
1 parent bb228a3 commit ef77df9
Show file tree
Hide file tree
Showing 36 changed files with 1,406 additions and 664 deletions.
82 changes: 79 additions & 3 deletions src/data/data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,26 @@ midd_nav:
text: Offices and Services

institutional_nav:
- text: A Sense of Purpose
- text: Our Schools
href: "#"
- text: The Experience of Place
items:
- href: http://www.middlebury.edu
text: Middlebury College
- href: http://www.middlebury.edu/ls
text: Language Schools
- href: http://www.middlebury.edu/blse
text: Bread Loaf School of English
- href: http://www.middlebury.edu/bread-loaf-conferences
text: Bread Loaf Writers' Conference
- href: https://www.middlebury.edu/institute/
text: Institute of International Studies at Monterey
- href: http://www.middlebury.edu/study-abroad
text: C.V. Starr Schools Abroad
- href: http://www.middlebury.edu/environment
text: School of the Environment
- text: About Middlebury
href: "#"
- text: Our Approach to Learning
- text: Office and Services
href: "#"

system_status:
Expand Down Expand Up @@ -653,3 +668,64 @@ area_of_study:
- category: W
course_names:
- name: Writing and Rhetoric Program

journey_gallery_data:
- src: http://placekitten.com/1376/774
width: 1376
height: 774
srcset:
- 1376/774
- 1136/639
- 736/414
- 320/180
alt: ""
sizes: ""
caption: Lorem ipsum <a href="#">dolor</a> sit amet consectetur adipisicing elit.

- src: http://placekitten.com/1376/774
width: 1376
height: 774
srcset:
- 1376/774
- 1136/639
- 736/414
- 320/180
alt: ""
sizes: ""
caption: Lorem ipsum dolor sit amet consectetur adipisicing elit. Repellat aspernatur accusantium eveniet accusamus tempora sequi fugiat magnam? Porro illo cumque error praesentium dolore labore tenetur obcaecati rerum, inventore sequi totam!

- src: http://placekitten.com/1376/774
width: 1376
height: 774
srcset:
- 1376/774
- 1136/639
- 736/414
- 320/180
alt: ""
sizes: ""
caption: Lorem ipsum dolor sit amet consectetur adipisicing elit.

- src: http://placekitten.com/1376/774
width: 1376
height: 774
srcset:
- 1376/774
- 1136/639
- 736/414
- 320/180
alt: ""
sizes: ""
caption: Lorem ipsum dolor sit amet consectetur adipisicing elit.

- src: http://placekitten.com/1376/774
width: 1376
height: 774
srcset:
- 1376/774
- 1136/639
- 736/414
- 320/180
alt: ""
sizes: ""
caption: Repellat aspernatur accusantium eveniet accusamus tempora sequi fugiat magnam? Porro illo cumque error praesentium dolore labore tenetur obcaecati rerum, inventore sequi totam!
20 changes: 20 additions & 0 deletions src/data/image_styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,23 @@ image_styles:
ratio: "16:9"
srcset:
- 1136x639
journey_poster:
title: Background poster image
ratio: "16:9"
srcset:
- 1440x810
- 1200x675
journey_fluencies:
title: Four fluencies display image
ratio: "1:1"
srcset:
- 332x332
- 278x278
- 224x224
journey_image_text:
title: Image with Text component
ratio: "3:4"
srcset:
- 168x225
- 300x400
sizes: "(max-width: 512px) 168px, 300px"
Binary file modified src/images/hero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 40 additions & 22 deletions src/js/journey-swiper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { $, $$, checkElement } from './utils/dom';
import VideoSwap from './video';
import lozad from 'lozad';

class JourneySwiper {
swiperEl: any;
Expand All @@ -20,7 +21,7 @@ class JourneySwiper {

constructor(el: HTMLElement) {
this.elem = el;
this.swiperClass = '.mySwiper';
this.swiperClass = '.journey-swiper';
this.paginationClass = '.swiper-pagination';
this.paginationEl = $(this.paginationClass);
this.swiperParentEl = $('.journey-modal__pagination');
Expand All @@ -36,9 +37,26 @@ class JourneySwiper {
this.init();
}

elementOnLoad(cn: string, cb: (...args: any[]) => void) {
checkElement(cn).then((selector) => {
cb(selector);
});
}

init() {
this.addListeners();
this.elementOnLoad('.journey-modal--block.is-open', this.swiperInit);

// init lazy loaded gallery images

const lazyGalleryImages = lozad('[data-journey-gallery-item] img');
lazyGalleryImages.observe();

this.elementOnLoad('.journey-modal--block.is-open', () => {
this.swiperInit();
this.swiperParentEl.style.transform = `translateX(${this.translate}px)`;
});
this.addListeners();
}

async getSwiper() {
Expand Down Expand Up @@ -117,22 +135,18 @@ class JourneySwiper {
});
}

elementOnLoad(cn: string, cb: (...args: any[]) => void) {
checkElement(cn).then(() => {
cb();
});
}

addListeners() {
checkElement('.journey-modal__cb-link').then((selector) => {
this.elementOnLoad('.journey-modal__cb-link', (selector) => {
this.paginationDotEls = $$(selector);
this.paginationDotEls.forEach((el) => {
el.addEventListener('mouseenter', (e) => {
this.handleMouseEvent(e);
});
el.addEventListener('mouseleave', (e) => {
this.handleMouseEvent(e);
});
if (window.matchMedia('(min-width: 1024px)').matches) {
el.addEventListener('mouseenter', (e) => {
this.handleMouseEvent(e);
});
el.addEventListener('mouseleave', (e) => {
this.handleMouseEvent(e);
});
}
});
});

Expand All @@ -157,9 +171,10 @@ class JourneySwiper {
MicroModal?.close();
}

if (this.swiperEl && hash !== this.swiperEl.activeIndex) {
this.swiperEl.slideTo(hash, 350, false);
if (hash !== this.swiperEl.activeIndex) {
this.swiperEl.slideTo(hash, 300, false);
}
// this.swiperUpdate();
}

resetNavigation() {
Expand All @@ -182,9 +197,16 @@ class JourneySwiper {

swiperUpdate() {
this.currentEl = $('.swiper-pagination-bullet-active', this.paginationEl);
let scrollWidth = this.swiperParentEl.scrollWidth;

// Check if the scrolling distance exceeds the element width,
// if it does set it to the element width so that it doesn't
// scroll past the width
if (scrollWidth > this.swiperParentEl.offsetWidth) {
scrollWidth = this.swiperParentEl.offsetWidth;
}

this.hiddenWidth =
this.swiperParentEl.scrollWidth - this.swiperParentWrapperEl.clientWidth;
this.hiddenWidth = scrollWidth - this.swiperParentWrapperEl.offsetWidth;

const currentElLeft = this.currentEl?.getBoundingClientRect().left;

Expand All @@ -207,8 +229,4 @@ class JourneySwiper {
}
}

const swiper = $$('.mySwiper');

swiper.forEach((elem) => new JourneySwiper(elem));

export default JourneySwiper;
Loading

0 comments on commit ef77df9

Please sign in to comment.