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

OCW Stories & Quotes New Design Implementation #1460

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions base-theme/assets/images/ocw_stories_btn_arrow_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions base-theme/assets/images/ocw_story_single_arrow_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions base-theme/assets/images/quote_close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions base-theme/assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PDFObject from "pdfobject"
import "./js/polyfill"
import "video.js/dist/video-js.css"
import { initExternalLinkModal } from "./js/external_link_modal"
import { initQuotesModalHandler } from "./quotes_card_modal_handler"
import { initVideoDownloadPopup } from "./js/video_download_popup"

export interface OCWWindow extends Window {
Expand All @@ -18,6 +19,7 @@ export interface OCWWindow extends Window {
Sentry: typeof Sentry
PDFObject: typeof PDFObject
initVideoJS: () => void
initModalHandler: () => void
}

declare let window: OCWWindow
Expand All @@ -41,4 +43,5 @@ window.initVideoJS = () => {
$(function() {
window.Sentry = initSentry()
initExternalLinkModal()
initQuotesModalHandler()
})
38 changes: 38 additions & 0 deletions base-theme/assets/quotes_card_modal_handler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export function initQuotesModalHandler() {
$(document).ready(() => {
const modalElement = $(".js-quotes-modal")

// let carouselId: string | undefined

$(".js-modal-trigger").on("click", event => {
event.preventDefault()

const target = $(event.currentTarget)
const modalContentId = target.data("modal-content-id")
const contentDiv = $(`#${modalContentId}`)

// const carouselElement = target.closest(".carousel")
// carouselId = carouselElement.attr("id")

if (contentDiv.length) {
const content = contentDiv.html()
modalElement.find(".modal-body").html(content)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
modalElement.modal("show")
} else {
console.error("Modal content not found for ID:", modalContentId)
}
})

// modalElement.on("shown.bs.modal", () => {
// modalElement.focus()
// })

// modalElement.on("hidden.bs.modal", () => {
// if (carouselId) {
// $(`#${carouselId}`).focus()
// }
// })
})
}
Loading
Loading