sfc-utils 1.3.65 → 1.3.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,62 +3,49 @@
3
3
  import React, { Fragment, useEffect } from 'react'
4
4
  import PropTypes from 'prop-types'
5
5
  import { Helmet } from 'react-helmet'
6
-
7
- // Bring in footer
6
+ import LayoutHelmet from '../../../components/layout/layouthelmet.mjs'
8
7
  import Footer from './sfc/footer'
9
-
10
8
  // Add SFC utils
11
- import { blendHDN, appCheck, getBrands, getBlueconic } from '../../../index'
12
-
9
+ import { appCheck } from '../../../index'
10
+ import { appendLayoutScripts, formatHDN } from "../../../components/helpers/utilfunctions.mjs"
13
11
  // Import global styles needed in document
14
12
  require('../styles/seed.less')
15
13
 
16
- const Layout = ({
14
+ const Layout = ({
17
15
  meta,
18
16
  url_add = '',
19
17
  description = false,
20
18
  image = false,
21
19
  social_title = false,
22
20
  title = false,
23
- children,
21
+ embed = false,
22
+ children,
24
23
  }) => {
25
24
  // Determine if we need registration code
26
25
 
27
26
  let {
28
27
  EMBEDDED,
29
- MAIN_DOMAIN,
30
28
  PROJECT: {
31
- AUTHORS,
32
29
  DESCRIPTION,
33
30
  IMAGE,
34
- ISO_MODDATE,
35
- ISO_PUBDATE,
36
- OPT_SLASH,
37
- SLUG,
38
31
  SOCIAL_TITLE,
39
- SUBFOLDER,
40
- TITLE,
41
- MARKET_KEY,
42
- CANONICAL_URL
32
+ TITLE
43
33
  },
44
34
  } = meta
45
35
 
46
36
  // Override these if they exist (but just use the default otherwise)
47
- DESCRIPTION = description || DESCRIPTION
48
- IMAGE = image || IMAGE
49
- SOCIAL_TITLE = social_title || SOCIAL_TITLE
50
- TITLE = title || TITLE
51
-
52
- let styleSheetID;
53
- if ((MARKET_KEY === "SFC") || (MARKET_KEY === "Houston") || (MARKET_KEY === "Albany")) {
54
- styleSheetID = MARKET_KEY
55
- }
56
- else {
57
- styleSheetID = "default"
37
+ meta.PROJECT.DESCRIPTION = description || DESCRIPTION
38
+ meta.PROJECT.IMAGE = image || IMAGE
39
+ meta.PROJECT.SOCIAL_TITLE = social_title || SOCIAL_TITLE
40
+ meta.PROJECT.TITLE = title || TITLE
41
+
42
+ // If we're receiving `embed` as a prop, change this page's settings to be embed settings
43
+ if (embed) {
44
+ meta.EMBEDDED = true
58
45
  }
59
46
 
60
47
  // Make sure url_add ends with a slash
61
- if (url_add && url_add.slice(-1) !== "/"){
48
+ if (url_add && url_add.slice(-1) !== "/") {
62
49
  url_add += "/"
63
50
  }
64
51
 
@@ -67,77 +54,10 @@ const Layout = ({
67
54
  const isApp = appCheck()
68
55
 
69
56
  // Combine our settings with what Hearst puts on page
70
- let stringHDN = ''
71
- if (!EMBEDDED) {
72
- // Put url_add into a new meta object to pass in
73
- const metaHDN = Object.assign({}, meta)
74
- metaHDN.URL_ADD = url_add
75
- // Make sure this is free on app
76
- if (isApp){
77
- metaHDN.PAYWALL_SETTING = "free";
78
- }
79
- let blended = blendHDN(metaHDN)
80
- stringHDN = blended.stringHDN
81
- }
82
-
83
- // Get brand vars
84
- const thisBrand = getBrands(MARKET_KEY);
85
-
86
- // Handle author data
87
- let authorObj = []
88
- let newAuthor = {}
89
- try {
90
- AUTHORS.forEach(author => {
91
- newAuthor = {
92
- '@type': 'Person',
93
- name: author.AUTHOR_NAME,
94
- url: author.AUTHOR_PAGE,
95
- }
96
- authorObj.push(newAuthor)
97
- })
98
- } catch (err) {
99
- // If it errored, just set to neutral default
100
- authorObj = {
101
- '@type': 'Person',
102
- name: thisBrand.attributes.siteName,
103
- url: MAIN_DOMAIN,
104
- }
105
- }
57
+ let stringHDN = formatHDN(EMBEDDED, url_add, meta);
106
58
 
107
59
  useEffect(() => {
108
- // React Helmet is actually terrible and runs these scripts twice, so we are including them async ourselves
109
- // Run analytics and resizing scripts right away so we take care of that
110
- if (!EMBEDDED){
111
- let script = document.createElement('script');
112
- script.type = 'text/javascript';
113
- script.src = 'https://nexus.ensighten.com/hearst/news/Bootstrap.js';
114
- document.body.appendChild(script);
115
- } else {
116
- let script = document.createElement('script');
117
- script.type = 'text/javascript';
118
- script.src = 'https://projects.sfchronicle.com/shared/js/responsive-child.js';
119
- document.body.appendChild(script);
120
- }
121
-
122
- if (!EMBEDDED && !isApp){
123
- let script = document.createElement('script');
124
- script.type = 'text/javascript';
125
- script.id = 'adPositionManagerScriptTag';
126
- script.src = 'https://aps.hearstnp.com/Scripts/loadAds.js';
127
- document.body.appendChild(script);
128
- }
129
-
130
- // Wait a beat, then add to body so it doesn't mess with the head (which Helmet seems to want to manage)
131
- setTimeout(() => {
132
- if (!EMBEDDED && !isApp){
133
- let blueconicURL = getBlueconic(window.location.origin)
134
- let script = document.createElement('script');
135
- script.type = 'text/javascript';
136
- script.defer = true;
137
- script.src = blueconicURL;
138
- document.body.appendChild(script);
139
- }
140
- }, 5000)
60
+ appendLayoutScripts(EMBEDDED);
141
61
  }, [])
142
62
 
143
63
  return (
@@ -151,68 +71,8 @@ const Layout = ({
151
71
  },
152
72
  ]}
153
73
  />
154
- <Helmet>
155
- <title>{TITLE}</title>
156
- <meta name="description" content={DESCRIPTION} />
157
- <link
158
- rel="shortcut icon"
159
- href="/favicon.ico"
160
- type="image/x-icon"
161
- />
162
- <link rel="canonical" href={ CANONICAL_URL } />
163
- <link rel="stylesheet" href={`https://files.sfchronicle.com/brand-styles/${styleSheetID}.css`} />
164
-
165
- {(isApp || EMBEDDED) ? (
166
- <meta name="robots" content="noindex, nofollow" />
167
- ) : (
168
- <meta name="robots" content="max-image-preview:large" />
169
- )}
170
-
171
- <meta name="twitter:card" content="summary_large_image" />
172
- <meta name="twitter:title" content={SOCIAL_TITLE} />
173
- <meta name="twitter:site" content={"@"+thisBrand.attributes.twitter} />
174
- <meta
175
- name="twitter:url"
176
- content={`${MAIN_DOMAIN}/${SUBFOLDER}${OPT_SLASH}${SLUG}/${url_add}`}
177
- />
178
- <meta name="twitter:image" content={IMAGE} />
179
- <meta name="twitter:description" content={DESCRIPTION} />
180
74
 
181
- <meta property="og:type" content="article" />
182
- <meta property="og:title" content={SOCIAL_TITLE} />
183
- <meta property="og:site_name" content={thisBrand.attributes.siteName} />
184
- <meta property="og:url" content={`${MAIN_DOMAIN}/${SUBFOLDER}${OPT_SLASH}${SLUG}/${url_add}`}/>
185
- <meta property="og:image" content={IMAGE} />
186
- <meta property="og:description" content={DESCRIPTION} />
187
-
188
- <script data-schema="NewsArticle" type="application/ld+json">{`{
189
- "@context": "http://schema.org",
190
- "@type": "NewsArticle",
191
- "mainEntityOfPage": {
192
- "@type": "WebPage",
193
- "@id": "${MAIN_DOMAIN}/${SUBFOLDER}${OPT_SLASH}${SLUG}/${url_add}"
194
- },
195
- "headline": "${TITLE}",
196
- "image": {
197
- "@type": "ImageObject",
198
- "url": "${IMAGE}"
199
- },
200
- "datePublished": "${ISO_PUBDATE}",
201
- "dateModified": "${ISO_MODDATE}",
202
- "author": ${JSON.stringify(authorObj)},
203
- "publisher": {
204
- "@type": "Organization",
205
- "name": "${thisBrand.attributes.siteName}",
206
- "logo": {
207
- "@type": "ImageObject",
208
- "url": "/apple-touch-icon.png",
209
- "width": "180",
210
- "height": "180"
211
- }
212
- },
213
- "description": "${DESCRIPTION}"
214
- }`}</script>
215
- </Helmet>
75
+ <LayoutHelmet meta={meta} url_add={url_add} />
216
76
 
217
77
  {/* Full project included here: */}
218
78
  {children}
@@ -1,5 +1,6 @@
1
1
  import React from "react"
2
2
  import PropTypes from "prop-types"
3
+ import LayoutScript from "../../components/layout/layoutscript.mjs"
3
4
 
4
5
  export default function HTML(props) {
5
6
  return (
@@ -11,8 +12,7 @@ export default function HTML(props) {
11
12
  name="viewport"
12
13
  content="width=device-width, initial-scale=1, shrink-to-fit=no"
13
14
  />
14
- <script src="https://projects.sfchronicle.com/shared/js/jquery.min.js"></script>
15
- <script src="https://treg.hearstnp.com/treg.js"></script>
15
+ <LayoutScript/>
16
16
  {props.headComponents}
17
17
  </head>
18
18
  <body {...props.bodyAttributes} is="responsive-body">
@@ -5,8 +5,6 @@ import Layout from '../components/layout'
5
5
  import WCMImage from '../components/sfc/wcmimage'
6
6
  import DropCap from '../components/sfc/dropcap'
7
7
  import { useCanNativeLazyLoad } from '../components/sfc/component-helpers/customhooks'
8
- import LazyLoad from 'react-lazyload'
9
- import Topper from '../components/sfc/topper'
10
8
  import RelatedSection from '../components/sfc/relatedsection'
11
9
  import CreditsSection from '../components/sfc/creditssection'
12
10
  import Ad from '../components/sfc/ad'
@@ -14,6 +12,7 @@ import Newsletter from '../components/sfc/newsletter'
14
12
  import NavTop from '../components/sfc/navtop'
15
13
  import Byline from '../../../components/byline.mjs'
16
14
  import Topper2 from '../../../components/topper2.mjs'
15
+ import OgPubDate from '../../../components/ogpubdate.mjs'
17
16
 
18
17
  let rawCredits;
19
18
  try {
@@ -37,13 +36,6 @@ try {
37
36
  topperSettings = null;
38
37
  }
39
38
 
40
- // lazy loader wrapper for WCM Image
41
- const LazyLoader = ({children}) => {
42
- return (
43
- <LazyLoad offset={300} resize once>{children}</LazyLoad>
44
- )
45
- }
46
-
47
39
  const IndexPage = ({ data }) => {
48
40
  // easy hooks based request library
49
41
  // const { data: responseData, error } = useSWR('https://api.kanye.rest', getData, {
@@ -63,7 +55,7 @@ const IndexPage = ({ data }) => {
63
55
  return (
64
56
  <Layout meta={siteMetadata}>
65
57
  <NavTop meta={siteMetadata} />
66
- <Topper2 settings={topperSettings[0]} wcmData={allWcmPhotos} lazyloader={LazyLoader}/>
58
+ <Topper2 settings={topperSettings[0]} wcmData={allWcmPhotos}/>
67
59
  <Byline meta={siteMetadata}/>
68
60
  <main>
69
61
  <article>
@@ -110,6 +102,7 @@ const IndexPage = ({ data }) => {
110
102
  </main>
111
103
 
112
104
  <RelatedSection links={related_links} />
105
+ <OgPubDate />
113
106
  {rawCredits && <CreditsSection creditsData={rawCredits}/>}
114
107
  </Layout>
115
108
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.3.65",
3
+ "version": "1.3.67",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",
package/settings.js CHANGED
@@ -14,7 +14,7 @@ try {
14
14
  // Get settings off story_settings if it exists, otherwise fall back to projectConfig
15
15
  let getSettings = function(){
16
16
  if (!projectConfig) {
17
- let settings = {PROJECT : {DATE: "September 20, 2022 9:00 AM", MOD_DATE: "September 21, 2022 9:00 AM"}}
17
+ let settings = {PROJECT : {DATE: "January 1, 1900 9:00 AM", MOD_DATE: "January 1, 1901 9:00 AM"}} // Making this demo date SUPER wrong so we can catch it
18
18
  return (
19
19
  settings
20
20
  )
@@ -1,6 +1,6 @@
1
1
  .hed, .deck{
2
2
  text-align: center;
3
- margin: @s8 0;
3
+ margin: @s16 0;
4
4
  &.left {
5
5
  text-align: left;
6
6
  }
@@ -10,6 +10,10 @@
10
10
  }
11
11
  }
12
12
 
13
+ h1 {
14
+ font-size: 4rem;
15
+ font-family: @hed;
16
+ }
13
17
  //could the next three classes be moved into byline module?
14
18
  .byline-wrapper {
15
19
  max-width: @lg;
@@ -153,12 +157,4 @@ a {
153
157
  &:visited {
154
158
  color: @grey-75;
155
159
  }
156
- }
157
-
158
- .dropcap:first-letter {
159
- font-family: @hed;
160
- font-size: @s112;
161
- float: left;
162
- line-height: 0.75;
163
- margin: 0.75rem 0.5rem 0 0.25rem;
164
160
  }
@@ -21,6 +21,19 @@
21
21
  }
22
22
  }
23
23
 
24
+ .container-side-by-side {
25
+ padding-bottom: calc(50vw*2/3);
26
+ width: 50%;
27
+ height: 100%;
28
+
29
+ @media (max-width: @lg) {
30
+ margin: 0 auto;
31
+ width: auto;
32
+ white-space: nowrap;
33
+ padding-bottom: calc(100vw * (2/3));
34
+ }
35
+ }
36
+
24
37
  .image-wrapper-stacked {
25
38
  position: absolute;
26
39
  width: 100%;
@@ -37,6 +50,38 @@
37
50
  }
38
51
  }
39
52
 
53
+ .image-wrapper-side-by-side {
54
+ position: absolute;
55
+ width: calc(50vw);
56
+ height: calc(50vw*2/3);
57
+
58
+ @media (max-width: @lg) {
59
+ width: 100%;
60
+ height: calc(100vw*2/3);
61
+ }
62
+ }
63
+
64
+ .image-wrapper-side-by-side-portrait {
65
+ position: absolute;
66
+ width: calc(90vh*2/3);
67
+ height: calc(90vh);
68
+ min-height: calc(600px + 32px);
69
+
70
+ @media (max-width: @lg) {
71
+ height: calc(90vh);
72
+ min-height: unset;
73
+ }
74
+
75
+ @media @mobile {
76
+ width: 90vw;
77
+ height: calc(90vw*3/2);
78
+ }
79
+ }
80
+
81
+ .side-by-side-portrait-margin-left {
82
+ margin-left: clamp(0px, calc(50vw - 32px - 90vh * 2/3), calc(600px - 90vh * 2/3))
83
+ }
84
+
40
85
  /* enter animation */
41
86
  .fade-enter {
42
87
  opacity: 0;
@@ -3,6 +3,8 @@
3
3
  :root {
4
4
  --headerDek-vertical-offset: 0px;
5
5
  --headerDek-horizontal-offset: 0px;
6
+ --container-background-color: none;
7
+ --side-by-side-text-color: black;
6
8
  }
7
9
 
8
10
  .topperContainerFullScreen {
@@ -20,6 +22,40 @@
20
22
  }
21
23
  }
22
24
 
25
+ .topperContainerSideBySide {
26
+ display: flex;
27
+ align-items: center;
28
+ background: var(--container-background-color);
29
+
30
+ @media (max-width: @lg) {
31
+ flex-direction: column;
32
+ }
33
+ }
34
+
35
+ .topperContainerSideBySidePortrait {
36
+ display: flex;
37
+ align-items: center;
38
+ max-width: @xl;
39
+ margin: auto;
40
+ margin-bottom: @s32;
41
+ min-height: 600px;
42
+
43
+ @media (max-width: @lg) {
44
+ flex-direction: column;
45
+ margin-bottom: 0;
46
+ }
47
+ }
48
+
49
+ .fullWidthContainer {
50
+ background: var(--container-background-color);
51
+ width: 100%;
52
+ padding-bottom: @s16;
53
+
54
+ @media (max-width: @lg) {
55
+ padding-bottom: 0px;
56
+ }
57
+ }
58
+
23
59
  .imageFullScreen {
24
60
  top: 0 !important;
25
61
  width: 100%;
@@ -38,6 +74,66 @@
38
74
  }
39
75
  }
40
76
 
77
+ .imageSideBySide {
78
+ width: 50%;
79
+ float: left;
80
+ padding: @s16;
81
+
82
+ @media (max-width: @lg) {
83
+ width: auto;
84
+ float: none;
85
+ padding-bottom: 0;
86
+ }
87
+ }
88
+
89
+ .imageSideBySideSlideshow {
90
+ width: 50%;
91
+ height: calc(50vw*2/3 + 10px);
92
+
93
+ @media (max-width: @lg) {
94
+ width: 100%;
95
+ height: calc(100vw*2/3 + 10px);
96
+ }
97
+ }
98
+
99
+ .imageSideBySidePortrait {
100
+ width: 50%;
101
+ height: 90vh;
102
+ min-height: calc(600px + 32px);
103
+ float: left;
104
+ padding: @s16;
105
+
106
+ @media (max-width: @lg) {
107
+ width: auto;
108
+ float: none;
109
+ height: auto;
110
+ padding-bottom: 0;
111
+ min-height: unset;
112
+ }
113
+ }
114
+
115
+ .imageSideBySidePortraitSlideshow {
116
+ width: 50%;
117
+ height: 90vh;
118
+ min-height: calc(600px + 32px);
119
+ float: left;
120
+ padding: @s16;
121
+
122
+ @media (max-width: @lg) {
123
+ width: calc(90vh*2/3);
124
+ float: none;
125
+ height: calc(90vh);
126
+ padding-bottom: 0;
127
+ min-height: unset;
128
+ }
129
+
130
+ @media @mobile {
131
+ width: 90vw;
132
+ height: calc(90vw*3/2 + @s16);
133
+ padding: 0;
134
+ }
135
+ }
136
+
41
137
  .headerDekStacked {
42
138
  margin-left: auto;
43
139
  margin-right: auto;
@@ -63,6 +159,20 @@
63
159
  }
64
160
  }
65
161
 
162
+ .headerDekSideBySide {
163
+ max-width: 50%;
164
+ float: right;
165
+ text-align: left;
166
+ color: var(--side-by-side-text-color);
167
+
168
+ @media (max-width: @lg) {
169
+ width: auto;
170
+ max-width: 100%;
171
+ float: none;
172
+ padding: 0;
173
+ }
174
+ }
175
+
66
176
  .hedFullScreen {
67
177
  margin-top: 0px;
68
178
  }
@@ -170,4 +280,133 @@
170
280
  @media @tablet {
171
281
  padding-left: @s8;
172
282
  }
283
+ }
284
+
285
+ .slideshowCaptionSideBySide {
286
+ padding-top: calc(50vw*2/3 - @s16);
287
+
288
+ @media (max-width: @lg) {
289
+ padding-top: calc(100vw*2/3 - @s16);
290
+ }
291
+ }
292
+
293
+ .slideshowCaptionSideBySidePortrait {
294
+ padding-top: clamp(584px, 88vh, 90vh);
295
+
296
+ @media (max-width: @lg) {
297
+ padding-top: calc(90vh - 37px - @s16);
298
+ }
299
+
300
+ @media @mobile {
301
+ padding-top: calc(90vw*3/2);
302
+ }
303
+ }
304
+
305
+ .captionSideBySide {
306
+ max-width: @lg;
307
+ }
308
+
309
+ .captionSideBySidePortrait {
310
+ width: clamp(0px, calc(50vw - 32px), calc(90vh * 2/3));
311
+ max-width: calc(50vw * 2/3 - 32px);
312
+ min-width: 400px;
313
+
314
+ @media (max-width: @lg) {
315
+ width: auto;
316
+ max-width: none;
317
+ min-width: 0px;
318
+ }
319
+ }
320
+
321
+ .reverseFlexbox {
322
+ flex-direction: row-reverse;
323
+
324
+ @media (max-width: @lg) {
325
+ flex-direction: column;
326
+ }
327
+ }
328
+
329
+ .captionTextColor {
330
+ color: var(--side-by-side-text-color);
331
+ }
332
+
333
+ .captionTextColorImportant {
334
+ color: var(--side-by-side-text-color) !important;
335
+ }
336
+
337
+ .largePaddingLeft {
338
+ padding: @s16 @s8 @s16 @s32;
339
+
340
+ @media (max-width: @lg) {
341
+ padding: 0;
342
+ }
343
+ }
344
+
345
+ .largePaddingRight {
346
+ padding: @s16 @s32 @s16 @s8;
347
+
348
+ @media (max-width: @lg) {
349
+ padding: 0;
350
+ }
351
+ }
352
+
353
+ .captionLargePaddingLeft {
354
+ padding-left: @s32;
355
+
356
+ @media (max-width: @lg) {
357
+ padding-left: @s16;
358
+ }
359
+ }
360
+
361
+ .captionSmallPaddingLeft {
362
+ padding-left: @s16;
363
+
364
+ @media (max-width: @lg) {
365
+ padding-left: @s16;
366
+ }
367
+
368
+ @media @mobile {
369
+ padding-left: 0;
370
+ }
371
+ }
372
+
373
+ .captionLargePaddingRight {
374
+ padding-left: @s8;
375
+
376
+ @media (max-width: @lg) {
377
+ padding-left: @s16;
378
+ }
379
+ }
380
+
381
+ .captionXLargePaddingRight {
382
+ padding-left: @s16;
383
+
384
+ @media (max-width: @lg) {
385
+ padding-left: @s16;
386
+ }
387
+ }
388
+
389
+ .captionSideBySidePortraitPadding {
390
+ padding-left: clamp(0px, calc(50vw - (90vh * 2/3) - @s16), calc(600px - 90vh *2/3 + @s16));
391
+
392
+ @media (max-width: @lg) {
393
+ padding-left: @s16;
394
+ }
395
+ }
396
+
397
+ .floatLeftWhenDesktop {
398
+ float: left;
399
+
400
+ @media (max-width: @lg) {
401
+ float: none;
402
+ }
403
+ }
404
+
405
+ .floatRightWhenDesktop {
406
+ float: right;
407
+ max-width: none;
408
+
409
+ @media (max-width: @lg) {
410
+ float: none;
411
+ }
173
412
  }