sfc-utils 1.4.11 → 1.4.12

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.
@@ -12,12 +12,16 @@ const Topper2 = ({ settings, wcmData, mods }) => {
12
12
  Topper_Style, Title, Title_Style, Deck, Image, Image_Alt, Video_Mp4, Image_Caption, Image_Credits,
13
13
  HeaderDek_Vertical_Position, HeaderDek_Vertical_Offset, HeaderDek_Horizontal_Offset,
14
14
  HeaderDek_Horizontal_Position, Inverted_Colors, Inverted_Layout, Inverted_Text_Color,
15
- Topper_Background_Color
15
+ Topper_Background_Color, Small_Visual_Max_Width
16
16
  } = settings
17
17
 
18
+ // During server-side rendering, access to ":root" is unavailable. This is okay; we just need
19
+ // to make sure that the site does not crash during SSR
20
+ let r = (typeof window != "undefined") ? document.querySelector(':root') : null;
21
+
18
22
  // Handle mods here, in case the project modifies the title
19
- if (mods){
20
- if (mods.Title){
23
+ if (mods) {
24
+ if (mods.Title) {
21
25
  Title = mods.Title
22
26
  }
23
27
  }
@@ -154,7 +158,7 @@ const Topper2 = ({ settings, wcmData, mods }) => {
154
158
  let charSearch = ","
155
159
  if (listStr.toString().indexOf(";") !== -1){
156
160
  charSearch = ";"
157
- }
161
+ }
158
162
  return listStr.toString().split(charSearch).map((d) => parseInt(d));
159
163
  }
160
164
 
@@ -240,6 +244,11 @@ const Topper2 = ({ settings, wcmData, mods }) => {
240
244
  />
241
245
  )
242
246
  case "small-visual":
247
+ // If there is a "Small_Visual_Max_Width" column, set the custom max width
248
+ if (Small_Visual_Max_Width) {
249
+ r.style.setProperty('--small-visual-max-width', Small_Visual_Max_Width)
250
+ }
251
+
243
252
  return (
244
253
  <TopperImage
245
254
  wcm={Image}
@@ -469,8 +478,6 @@ const Topper2 = ({ settings, wcmData, mods }) => {
469
478
 
470
479
  /** Calculate offsets for header-deck container based on the spreadsheet, for full-screen toppers only **/
471
480
  const calculatefullScreenOffsets = () => {
472
- let r = (typeof window != "undefined") ? document.querySelector(':root') : null;
473
-
474
481
  let verticalOffset = convertStringToNumber(HeaderDek_Vertical_Offset, (HeaderDek_Vertical_Position === "bottom"));
475
482
  let horizontalOffset = convertStringToNumber(HeaderDek_Horizontal_Offset, (HeaderDek_Horizontal_Position === "right"));
476
483
 
@@ -498,8 +505,6 @@ const Topper2 = ({ settings, wcmData, mods }) => {
498
505
 
499
506
  /** Sets the background and text color in topper for side-by-side and side-by-side-portrait topper styles **/
500
507
  const setBackgroundAndTextColor = () => {
501
- let r = (typeof window != "undefined") ? document.querySelector(':root') : null;
502
-
503
508
  if (r && Topper_Background_Color) {
504
509
  r.style.setProperty('--container-background-color', Topper_Background_Color)
505
510
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",
@@ -76,11 +76,16 @@
76
76
 
77
77
  .imageSmallVisual {
78
78
  position: relative;
79
- max-width: 150px;
79
+ max-width: var(--small-visual-max-width);
80
+ height: auto;
81
+ width: 100%;
80
82
  margin: @s24 auto 0 auto;
81
83
 
82
84
  @media @mobile {
83
85
  margin-left: @s16;
86
+ margin-right: @s16;
87
+ width: auto;
88
+ height: auto;
84
89
  }
85
90
  }
86
91
 
@@ -5,6 +5,7 @@
5
5
  --img-bottom-padding-ratio: "56.25%";
6
6
  --img-height-viewport: "56.25vw";
7
7
  --img-bottom-padding-fraction: 0.5625;
8
+ --small-visual-max-width: 150px;
8
9
  }
9
10
 
10
11
  .c-force-aspect-ratio {
@@ -70,8 +71,16 @@
70
71
  }
71
72
 
72
73
  .c-container-small-visual {
73
- height: calc(var(--img-bottom-padding-fraction)*150px);
74
- width: 150px;
74
+ height: calc(var(--img-bottom-padding-fraction)*var(--small-visual-max-width));
75
+ max-width: var(--small-visual-max-width);
76
+ width: calc(100vw - 32px);
77
+ margin: 0 @s16;
78
+
79
+ @media @mobile {
80
+ max-height: calc(var(--img-bottom-padding-fraction)*var(--small-visual-max-width));
81
+ height: calc(var(--img-bottom-padding-fraction)*(100vw - 32px));
82
+ margin: auto;
83
+ }
75
84
  }
76
85
 
77
86
  .c-img {
@@ -106,6 +115,7 @@
106
115
  .c-img-small-visual {
107
116
  display: block;
108
117
  position: absolute;
118
+ width: calc(100vw - 32px);
109
119
  padding: 0;
110
120
  }
111
121