TFL Resources
This commit is contained in:
+8
-9
@@ -1056,13 +1056,11 @@ function HomepageNewsletterSection() {
|
||||
)
|
||||
}
|
||||
|
||||
type TflWidgetType = 'audiodevo' | 'abdevotional'
|
||||
type TflWidgetType = 'audiodevo' | 'abdevotional' | 'resourcead'
|
||||
|
||||
function TruthForLifeWidget({ type = 'audiodevo' }: { type?: TflWidgetType }) {
|
||||
// Use an iframe so TFL's script gets a fresh page context with its own
|
||||
// DOMContentLoaded — required because this is a SPA and that event has
|
||||
// already fired on the outer page before this component ever mounts.
|
||||
const iframeHeight = type === 'audiodevo' ? '420' : '800'
|
||||
const iframeHeight = type === 'audiodevo' ? '420' : type === 'resourcead' ? '270' : '800'
|
||||
const heading = type === 'resourcead' ? 'Recommended Resources' : 'Daily Devotional'
|
||||
|
||||
const srcdoc = `<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -1085,11 +1083,11 @@ function TruthForLifeWidget({ type = 'audiodevo' }: { type?: TflWidgetType }) {
|
||||
</html>`
|
||||
|
||||
return (
|
||||
<section className="section-tfl" aria-label="Truth For Life devotional">
|
||||
<section className="section-tfl" aria-label="Truth For Life devotional" style={type === 'resourcead' ? { padding: '2.5rem 0' } : undefined}>
|
||||
<div className="section-inner">
|
||||
<div className="tfl-label-row">
|
||||
<div className="tfl-label-row" style={type === 'resourcead' ? { marginBottom: '1rem' } : undefined}>
|
||||
<h2 className="section-heading" style={{ marginBottom: '0.25rem' }}>
|
||||
<span className="ornament">✦</span> Daily Devotional <span className="ornament">✦</span>
|
||||
<span className="ornament">✦</span> {heading} <span className="ornament">✦</span>
|
||||
</h2>
|
||||
<p className="tfl-attribution" style={{ marginBottom: '1rem' }}>
|
||||
<a href="https://www.truthforlife.org" target="_blank" rel="noreferrer" className="tfl-link" style={{ fontSize: '1rem', fontWeight: 600 }}>Truth For Life</a>
|
||||
@@ -1102,7 +1100,7 @@ function TruthForLifeWidget({ type = 'audiodevo' }: { type?: TflWidgetType }) {
|
||||
title="Truth For Life daily devotional"
|
||||
width="100%"
|
||||
height={iframeHeight}
|
||||
style={{ border: 'none', display: 'block', borderRadius: '10px' }}
|
||||
style={{ border: 'none', display: 'block', borderRadius: '10px', maxWidth: type === 'resourcead' ? '500px' : '760px', margin: '0 auto' }}
|
||||
sandbox="allow-scripts allow-same-origin allow-popups"
|
||||
/>
|
||||
</div>
|
||||
@@ -1663,6 +1661,7 @@ function ResourcesPage({ content }: { content: SiteContent }) {
|
||||
<StudyGuideSection content={content} />
|
||||
<DownloadLibrarySection content={content} />
|
||||
<CustomBlocksSection content={content} page="downloads" />
|
||||
<TruthForLifeWidget type="resourcead" />
|
||||
<SiteFooter content={content} />
|
||||
<AnalyticsConsentBanner content={content} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user