Error executing template "Designs/KoksGroup/Paragraph/BackgroundConfiguration.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_96e8c09bd2f9460a81f3458da1dc5def.Execute() in D:\virtual_hosts\koksgroup.nl Production\files\Templates\Designs\KoksGroup\Paragraph\BackgroundConfiguration.cshtml:line 245
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Configuration; 6 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 7 8 9 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 10 @using Dynamicweb; 11 @using Dynamicweb.Content.Items; 12 @using Bluedesk.DynamicWeb.ItemTypes; 13 14 @functions { 15 16 Dictionary<string, string> GetFontConfiguration(string TextColor, FontConfigurationItemTab FontConfiguration) 17 { 18 19 var colorService = new ColorSwatchService(); 20 21 TextColor = !string.IsNullOrWhiteSpace(TextColor) ? TextColor : "" ; 22 23 TextColor = !TextColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, TextColor) : TextColor; 24 25 Dictionary<string, string> FontConfig = new Dictionary<string, string>() 26 { 27 { "textColor" , TextColor }, 28 { "fontSize" , FontConfiguration.FontSize }, 29 { "lineHeight", FontConfiguration.LineHeight}, 30 { "fontFamily" , FontConfiguration.FontConfiguration.FontFamily }, 31 { "fontWeight" , FontConfiguration.FontWeight }, 32 { "fontStyle" , FontConfiguration.FontStyle } 33 }; 34 35 return FontConfig; 36 } 37 38 } 39 40 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 41 @using Dynamicweb; 42 @using Dynamicweb.Content.Items; 43 @using Bluedesk.DynamicWeb.ItemTypes; 44 @using Bluedesk.DynamicWeb.ItemTypes.Configuration; 45 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 46 47 48 @helper RenderButton(ButtonConfiguration ButtonConfiguration, string btnLink, string btnClass, string btnText, string ariaLabel = "", bool newWindow = false, string btnIcon = "", string btnExtraClass = "", string btnTextClass = "", string btnIconClass = "") 49 { 50 51 var paragraphID = Pageview.CurrentParagraph.ID; 52 string buttonID = ButtonConfiguration.Id; 53 54 var colorService = new ColorSwatchService(); 55 56 var master_configuration = Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 57 58 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 59 60 string FontAwesomeLibrary = mc.GeneralConfiguration.fontawesomeStyle; 61 string IconPosition = mc.GeneralConfiguration.IconPosition == "left" ? "-1" : "1"; 62 63 bool HideIcon = ButtonConfiguration.HideIcon.ToString() == "True" ? true : false; 64 string CustomIconClass = !string.IsNullOrWhiteSpace(ButtonConfiguration.CustomIcon) ? ButtonConfiguration.CustomIcon : "fa-chevron-right"; 65 66 string BackgroundColor = ButtonConfiguration.ButtonColorConfiguration.BackgroundColor; 67 68 string BackgroundHoverColor = ButtonConfiguration.ButtonHoverColorConfiguration.BackgroundColor; 69 70 string BorderColor = ButtonConfiguration.ButtonColorConfiguration.BorderColor; 71 string BorderHoverColor = ButtonConfiguration.ButtonHoverColorConfiguration.BorderColor; 72 73 string BorderSize = ButtonConfiguration.BorderSize + "px"; 74 75 string FontColor = ButtonConfiguration.ButtonColorConfiguration.FontColor; 76 string FontHoverColor = ButtonConfiguration.ButtonHoverColorConfiguration.FontColor; 77 78 string FontStyle = ButtonConfiguration.FontConfiguration.FontStyle; 79 80 string FontSize = ButtonConfiguration.FontConfiguration.FontSize; 81 string FontWeight = ButtonConfiguration.FontConfiguration.FontWeight; 82 string FontFamily = ButtonConfiguration.FontConfiguration.FontConfiguration.FontFamily; 83 84 if (!string.IsNullOrWhiteSpace(BackgroundColor)) 85 { 86 BackgroundColor = !BackgroundColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, BackgroundColor) : BackgroundColor; 87 } 88 else 89 { 90 BackgroundColor = null; 91 } 92 93 if (!string.IsNullOrWhiteSpace(BackgroundColor)) 94 { 95 BackgroundHoverColor = !BackgroundHoverColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, BackgroundHoverColor) : BackgroundHoverColor; 96 } 97 else 98 { 99 BackgroundHoverColor = null; 100 } 101 102 BorderColor = colorService.GetHexColor(Pageview.AreaID, BorderColor); 103 FontColor = colorService.GetHexColor(Pageview.AreaID, FontColor); 104 105 BorderHoverColor = colorService.GetHexColor(Pageview.AreaID, BorderHoverColor); 106 FontHoverColor = colorService.GetHexColor(Pageview.AreaID, FontHoverColor); 107 108 if (string.IsNullOrWhiteSpace(btnIcon)) 109 { 110 btnIcon = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 111 } 112 string target = newWindow ? "_blank" : "_self"; 113 string ariaText = !string.IsNullOrWhiteSpace(ariaLabel) ? "aria-label='" + ariaLabel + "'" : ""; 114 115 if (!string.IsNullOrWhiteSpace(btnLink) && !string.IsNullOrWhiteSpace(btnText)) 116 { 117 <style> 118 119 .default-btn { 120 position: relative; 121 display: flex; 122 align-items: center; 123 padding: .75rem; 124 min-height: 50px; 125 cursor: pointer; 126 text-transform: uppercase; 127 min-width: 15rem; 128 } 129 130 .btn__icon { 131 position: relative; 132 right: 0; 133 order: @IconPosition; 134 } 135 136 .jumbotron__playground-@paragraphID .button--@buttonID, 137 .multicolumn--@paragraphID .button--@buttonID, 138 .cta-paragraph--@paragraphID .button--@buttonID 139 { 140 141 display: flex; 142 align-items: center; 143 justify-content: space-between; 144 min-height: 50px; 145 146 background-color : @BackgroundColor; 147 color : @FontColor; 148 font-size : @FontSize; 149 font-family : @FontFamily; 150 font-weight : @FontWeight; 151 text-transform : @FontStyle; 152 153 @if (BorderSize != "0px") 154 { 155 <text>border: @BorderSize @BorderColor solid;</text> 156 } 157 } 158 159 .jumbotron__playground-@paragraphID .button--@buttonID .cta-paragraph__btn-label, 160 .multicolumn--@paragraphID .button--@buttonID .cta-paragraph__btn-label, 161 .cta-paragraph--@paragraphID .button--@buttonID cta-paragraph__btn-label 162 { 163 color : @FontColor; 164 } 165 166 .cta-paragraph--@paragraphID .button--@buttonID .btn__icon { 167 color: @FontColor !important; 168 } 169 170 .jumbotron__playground-@paragraphID .button--@buttonID:hover, 171 .multicolumn--@paragraphID .button--@buttonID:hover, 172 .cta-paragraph--@paragraphID .button--@buttonID:hover 173 { 174 175 background-color : @BackgroundHoverColor; 176 color : @FontHoverColor; 177 @if (BorderSize != "0px") 178 { 179 <text>border: @BorderSize @BorderHoverColor solid;</text> 180 } 181 } 182 183 .cta-paragraph--@paragraphID .button--@buttonID:hover .btn__icon { 184 color: @FontHoverColor !important; 185 } 186 187 </style> 188 189 <a href="@btnLink" class="default-btn @btnClass button--@buttonID" target="@target" @ariaText> 190 <span class="btn__text @btnTextClass">@btnText</span> 191 @if (!HideIcon) 192 { 193 <i class="btn__icon @FontAwesomeLibrary @CustomIconClass"></i> 194 } 195 </a> 196 } 197 } 198 199 @helper RenderFontConfig(Dictionary<string, string> FontConfig) 200 { 201 202 <text>color: @FontConfig["textColor"] !important;</text> 203 204 if (!string.IsNullOrWhiteSpace(FontConfig["textColor"])) 205 { 206 <text> 207 color: @FontConfig["textColor"] !important; 208 </text> 209 } 210 211 if (!string.IsNullOrWhiteSpace(FontConfig["fontSize"])) 212 { 213 <text>font-size: @FontConfig["fontSize"] !important;</text> 214 } 215 if (!string.IsNullOrWhiteSpace(FontConfig["lineHeight"])) 216 { 217 <text>line-height: @FontConfig["lineHeight"] !important;</text> 218 } 219 if (!string.IsNullOrWhiteSpace(FontConfig["fontFamily"])) 220 { 221 <text>font-family: @FontConfig["fontFamily"] !important;</text> 222 } 223 if (!string.IsNullOrWhiteSpace(FontConfig["fontWeight"])) 224 { 225 <text>font-weight: @FontConfig["fontWeight"] !important;</text> 226 } 227 if (!string.IsNullOrWhiteSpace(FontConfig["fontStyle"])) 228 { 229 if (FontConfig["fontStyle"] != "none") 230 { 231 <text>text-transform: @FontConfig["fontStyle"] !important;</text> 232 } 233 } 234 } 235 236 237 @{ 238 int paragraphID = Pageview.CurrentParagraph.ID; 239 BackgroundConfiguration _data = ItemManager.Storage.GetById<BackgroundConfiguration>(Pageview.CurrentParagraph.ItemId ?? "0"); 240 241 string ParagraphHeight = "auto"; 242 243 var colorService = new ColorSwatchService(); 244 245 var subheaderFontConfig = GetFontConfiguration(_data.CTASubheaderTextColor, _data.FontConfigurationSubheader); 246 var headerFontConfig = GetFontConfiguration(_data.CTAHeaderTextColor, _data.FontConfigurationHeader); 247 var contentFontConfig = GetFontConfiguration(_data.CTAContentTextColor, _data.FontConfigurationContent); 248 249 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundClass) : ""; 250 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundColor) ? $"background-color: {_data.BackgroundColor}; " : ""; 251 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundImage) ? $"background-image: url({_data.BackgroundImage}); " : ""; 252 253 string backgroundImageRepeatClass = _data.BackgroundImageRepeat; 254 string backgroundImageSizeClass = ""; 255 256 string BackgroundImagePositionX = _data.BackgroundImagePositionX; 257 string BackgroundImagePositionY = _data.BackgroundImagePositionY; 258 259 string BackgroundImagePositionClass = ""; 260 261 if (backgroundImageRepeatClass == "no-repeat") 262 { 263 BackgroundImagePositionClass = BackgroundImagePositionY + "-" + BackgroundImagePositionX; 264 backgroundImageSizeClass = _data.BackgroundImageSize; 265 } 266 267 string ctaBackgroundColor = _data.BackgroundColor; 268 269 ctaBackgroundColor = colorService.GetHexColor(Pageview.AreaID, ctaBackgroundColor); 270 271 string BackgroundGradient = _data.BackgroundGradient; 272 273 string contentBackgroundColor = _data.contentBackgroundColor; 274 string contentBorderColor = _data.contentBorderColor; 275 276 string contentBorderSize = _data.contentBorderSize + "px"; 277 278 string contentGutterClass = _data.contentGutter; 279 string BackgroundPadding = _data.backgroundPadding; 280 281 contentBackgroundColor = colorService.GetHexColor(Pageview.AreaID, contentBackgroundColor); 282 contentBorderColor = colorService.GetHexColor(Pageview.AreaID, contentBorderColor); 283 284 string shadowClass = _data.contentShadow ? "contentShadow" : ""; 285 286 } 287 288 <style> 289 290 @@media screen and (min-width: 991px) { 291 .multicolumn--@paragraphID { 292 height: @ParagraphHeight !important; 293 } 294 } 295 296 .multicolumn--@paragraphID { 297 background-color: @ctaBackgroundColor; 298 @if (!string.IsNullOrWhiteSpace(BackgroundGradient)) 299 { 300 @BackgroundGradient 301 } 302 } 303 304 .multicolumn--@paragraphID .cta-paragraph { 305 background-color: @contentBackgroundColor; 306 border: @contentBorderSize @contentBorderColor solid; 307 } 308 309 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__subheader, 310 .cta-paragraph--@paragraphID .cta-paragraph__subheader { 311 @RenderFontConfig(subheaderFontConfig) 312 } 313 314 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__header, 315 .cta-paragraph--@paragraphID .cta-paragraph__header { 316 @RenderFontConfig(headerFontConfig) 317 } 318 319 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__text p, 320 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__text li { 321 @RenderFontConfig(contentFontConfig) 322 } 323 324 325 .multicolumn--@paragraphID .cta-paragraph__content-container, 326 .cta-paragraph--@paragraphID .cta-paragraph__content-container 327 { 328 @RenderContentAlignment(_data) 329 } 330 331 </style> 332 <div style="display: flex; flex-direction: column; padding: 25px;"> 333 <div class="multicolumn multicolumn--@paragraphID @_data.BackgroundClass @backgroundImageRepeatClass @BackgroundImagePositionClass @backgroundImageSizeClass @contentGutterClass @BackgroundPadding" style="display: flex; flex-direction: row; @backgroundStyle"> 334 <section class="multicolumn__item"> 335 <div class="cta-paragraph @shadowClass" style="display: flex; flex-direction: column; padding: 25px;"> 336 <section class="cta-paragraph__content-container"> 337 <header class="cta-paragraph__header"> 338 <h2 class="cta-paragraph__subheader">Subheader</h2> 339 <h2 class="cta-paragraph__header">header</h2> 340 </header> 341 <div class="cta-paragraph__text"> 342 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> 343 </div> 344 </section> 345 </div> 346 </section> 347 <section class="multicolumn__item"> 348 <div class="cta-paragraph @shadowClass" style="display: flex; flex-direction: column; padding: 25px;"> 349 <section class="cta-paragraph__content-container"> 350 <header class="cta-paragraph__header"> 351 <h2 class="cta-paragraph__subheader">Subheader</h2> 352 <h2 class="cta-paragraph__header">header</h2> 353 </header> 354 <div class="cta-paragraph__text"> 355 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> 356 </div> 357 </section> 358 </div> 359 </section> 360 </div> 361 362 @_data.ConfigurationName 363 </div> 364 </section> 365 366 @helper RenderContentAlignment(BackgroundConfiguration data) 367 { 368 369 switch (data.ContentElementAlign) 370 { 371 case "align-left": 372 <text> 373 align-items: flex-start; 374 text-align: left; 375 </text> 376 break; 377 case "align-center": 378 <text> 379 align-items: center; 380 text-align: center; 381 </text> 382 break; 383 case "align-right": 384 <text> 385 align-items: flex-end; 386 text-align: right; 387 </text> 388 break; 389 case "align-full": 390 <text> 391 align-items: flex-start; 392 text-align: justify; 393 </text> 394 break; 395 } 396 397 } 398
Error executing template "Designs/KoksGroup/Paragraph/BackgroundConfiguration.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_96e8c09bd2f9460a81f3458da1dc5def.Execute() in D:\virtual_hosts\koksgroup.nl Production\files\Templates\Designs\KoksGroup\Paragraph\BackgroundConfiguration.cshtml:line 245
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Configuration; 6 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 7 8 9 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 10 @using Dynamicweb; 11 @using Dynamicweb.Content.Items; 12 @using Bluedesk.DynamicWeb.ItemTypes; 13 14 @functions { 15 16 Dictionary<string, string> GetFontConfiguration(string TextColor, FontConfigurationItemTab FontConfiguration) 17 { 18 19 var colorService = new ColorSwatchService(); 20 21 TextColor = !string.IsNullOrWhiteSpace(TextColor) ? TextColor : "" ; 22 23 TextColor = !TextColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, TextColor) : TextColor; 24 25 Dictionary<string, string> FontConfig = new Dictionary<string, string>() 26 { 27 { "textColor" , TextColor }, 28 { "fontSize" , FontConfiguration.FontSize }, 29 { "lineHeight", FontConfiguration.LineHeight}, 30 { "fontFamily" , FontConfiguration.FontConfiguration.FontFamily }, 31 { "fontWeight" , FontConfiguration.FontWeight }, 32 { "fontStyle" , FontConfiguration.FontStyle } 33 }; 34 35 return FontConfig; 36 } 37 38 } 39 40 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 41 @using Dynamicweb; 42 @using Dynamicweb.Content.Items; 43 @using Bluedesk.DynamicWeb.ItemTypes; 44 @using Bluedesk.DynamicWeb.ItemTypes.Configuration; 45 @using Bluedesk.DynamicWeb.ItemTypes.Settings.Configuration; 46 47 48 @helper RenderButton(ButtonConfiguration ButtonConfiguration, string btnLink, string btnClass, string btnText, string ariaLabel = "", bool newWindow = false, string btnIcon = "", string btnExtraClass = "", string btnTextClass = "", string btnIconClass = "") 49 { 50 51 var paragraphID = Pageview.CurrentParagraph.ID; 52 string buttonID = ButtonConfiguration.Id; 53 54 var colorService = new ColorSwatchService(); 55 56 var master_configuration = Services.Pages.GetPageByNavigationTag(Pageview.AreaID, "MasterConfiguration"); 57 58 MasterConfig mc = master_configuration.Item.ToCodeFirstItem<MasterConfig>(); 59 60 string FontAwesomeLibrary = mc.GeneralConfiguration.fontawesomeStyle; 61 string IconPosition = mc.GeneralConfiguration.IconPosition == "left" ? "-1" : "1"; 62 63 bool HideIcon = ButtonConfiguration.HideIcon.ToString() == "True" ? true : false; 64 string CustomIconClass = !string.IsNullOrWhiteSpace(ButtonConfiguration.CustomIcon) ? ButtonConfiguration.CustomIcon : "fa-chevron-right"; 65 66 string BackgroundColor = ButtonConfiguration.ButtonColorConfiguration.BackgroundColor; 67 68 string BackgroundHoverColor = ButtonConfiguration.ButtonHoverColorConfiguration.BackgroundColor; 69 70 string BorderColor = ButtonConfiguration.ButtonColorConfiguration.BorderColor; 71 string BorderHoverColor = ButtonConfiguration.ButtonHoverColorConfiguration.BorderColor; 72 73 string BorderSize = ButtonConfiguration.BorderSize + "px"; 74 75 string FontColor = ButtonConfiguration.ButtonColorConfiguration.FontColor; 76 string FontHoverColor = ButtonConfiguration.ButtonHoverColorConfiguration.FontColor; 77 78 string FontStyle = ButtonConfiguration.FontConfiguration.FontStyle; 79 80 string FontSize = ButtonConfiguration.FontConfiguration.FontSize; 81 string FontWeight = ButtonConfiguration.FontConfiguration.FontWeight; 82 string FontFamily = ButtonConfiguration.FontConfiguration.FontConfiguration.FontFamily; 83 84 if (!string.IsNullOrWhiteSpace(BackgroundColor)) 85 { 86 BackgroundColor = !BackgroundColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, BackgroundColor) : BackgroundColor; 87 } 88 else 89 { 90 BackgroundColor = null; 91 } 92 93 if (!string.IsNullOrWhiteSpace(BackgroundColor)) 94 { 95 BackgroundHoverColor = !BackgroundHoverColor.Contains("#") ? colorService.GetHexColor(Pageview.AreaID, BackgroundHoverColor) : BackgroundHoverColor; 96 } 97 else 98 { 99 BackgroundHoverColor = null; 100 } 101 102 BorderColor = colorService.GetHexColor(Pageview.AreaID, BorderColor); 103 FontColor = colorService.GetHexColor(Pageview.AreaID, FontColor); 104 105 BorderHoverColor = colorService.GetHexColor(Pageview.AreaID, BorderHoverColor); 106 FontHoverColor = colorService.GetHexColor(Pageview.AreaID, FontHoverColor); 107 108 if (string.IsNullOrWhiteSpace(btnIcon)) 109 { 110 btnIcon = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 111 } 112 string target = newWindow ? "_blank" : "_self"; 113 string ariaText = !string.IsNullOrWhiteSpace(ariaLabel) ? "aria-label='" + ariaLabel + "'" : ""; 114 115 if (!string.IsNullOrWhiteSpace(btnLink) && !string.IsNullOrWhiteSpace(btnText)) 116 { 117 <style> 118 119 .default-btn { 120 position: relative; 121 display: flex; 122 align-items: center; 123 padding: .75rem; 124 min-height: 50px; 125 cursor: pointer; 126 text-transform: uppercase; 127 min-width: 15rem; 128 } 129 130 .btn__icon { 131 position: relative; 132 right: 0; 133 order: @IconPosition; 134 } 135 136 .jumbotron__playground-@paragraphID .button--@buttonID, 137 .multicolumn--@paragraphID .button--@buttonID, 138 .cta-paragraph--@paragraphID .button--@buttonID 139 { 140 141 display: flex; 142 align-items: center; 143 justify-content: space-between; 144 min-height: 50px; 145 146 background-color : @BackgroundColor; 147 color : @FontColor; 148 font-size : @FontSize; 149 font-family : @FontFamily; 150 font-weight : @FontWeight; 151 text-transform : @FontStyle; 152 153 @if (BorderSize != "0px") 154 { 155 <text>border: @BorderSize @BorderColor solid;</text> 156 } 157 } 158 159 .jumbotron__playground-@paragraphID .button--@buttonID .cta-paragraph__btn-label, 160 .multicolumn--@paragraphID .button--@buttonID .cta-paragraph__btn-label, 161 .cta-paragraph--@paragraphID .button--@buttonID cta-paragraph__btn-label 162 { 163 color : @FontColor; 164 } 165 166 .cta-paragraph--@paragraphID .button--@buttonID .btn__icon { 167 color: @FontColor !important; 168 } 169 170 .jumbotron__playground-@paragraphID .button--@buttonID:hover, 171 .multicolumn--@paragraphID .button--@buttonID:hover, 172 .cta-paragraph--@paragraphID .button--@buttonID:hover 173 { 174 175 background-color : @BackgroundHoverColor; 176 color : @FontHoverColor; 177 @if (BorderSize != "0px") 178 { 179 <text>border: @BorderSize @BorderHoverColor solid;</text> 180 } 181 } 182 183 .cta-paragraph--@paragraphID .button--@buttonID:hover .btn__icon { 184 color: @FontHoverColor !important; 185 } 186 187 </style> 188 189 <a href="@btnLink" class="default-btn @btnClass button--@buttonID" target="@target" @ariaText> 190 <span class="btn__text @btnTextClass">@btnText</span> 191 @if (!HideIcon) 192 { 193 <i class="btn__icon @FontAwesomeLibrary @CustomIconClass"></i> 194 } 195 </a> 196 } 197 } 198 199 @helper RenderFontConfig(Dictionary<string, string> FontConfig) 200 { 201 202 <text>color: @FontConfig["textColor"] !important;</text> 203 204 if (!string.IsNullOrWhiteSpace(FontConfig["textColor"])) 205 { 206 <text> 207 color: @FontConfig["textColor"] !important; 208 </text> 209 } 210 211 if (!string.IsNullOrWhiteSpace(FontConfig["fontSize"])) 212 { 213 <text>font-size: @FontConfig["fontSize"] !important;</text> 214 } 215 if (!string.IsNullOrWhiteSpace(FontConfig["lineHeight"])) 216 { 217 <text>line-height: @FontConfig["lineHeight"] !important;</text> 218 } 219 if (!string.IsNullOrWhiteSpace(FontConfig["fontFamily"])) 220 { 221 <text>font-family: @FontConfig["fontFamily"] !important;</text> 222 } 223 if (!string.IsNullOrWhiteSpace(FontConfig["fontWeight"])) 224 { 225 <text>font-weight: @FontConfig["fontWeight"] !important;</text> 226 } 227 if (!string.IsNullOrWhiteSpace(FontConfig["fontStyle"])) 228 { 229 if (FontConfig["fontStyle"] != "none") 230 { 231 <text>text-transform: @FontConfig["fontStyle"] !important;</text> 232 } 233 } 234 } 235 236 237 @{ 238 int paragraphID = Pageview.CurrentParagraph.ID; 239 BackgroundConfiguration _data = ItemManager.Storage.GetById<BackgroundConfiguration>(Pageview.CurrentParagraph.ItemId ?? "0"); 240 241 string ParagraphHeight = "auto"; 242 243 var colorService = new ColorSwatchService(); 244 245 var subheaderFontConfig = GetFontConfiguration(_data.CTASubheaderTextColor, _data.FontConfigurationSubheader); 246 var headerFontConfig = GetFontConfiguration(_data.CTAHeaderTextColor, _data.FontConfigurationHeader); 247 var contentFontConfig = GetFontConfiguration(_data.CTAContentTextColor, _data.FontConfigurationContent); 248 249 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundClass) : ""; 250 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundColor) ? $"background-color: {_data.BackgroundColor}; " : ""; 251 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundImage) ? $"background-image: url({_data.BackgroundImage}); " : ""; 252 253 string backgroundImageRepeatClass = _data.BackgroundImageRepeat; 254 string backgroundImageSizeClass = ""; 255 256 string BackgroundImagePositionX = _data.BackgroundImagePositionX; 257 string BackgroundImagePositionY = _data.BackgroundImagePositionY; 258 259 string BackgroundImagePositionClass = ""; 260 261 if (backgroundImageRepeatClass == "no-repeat") 262 { 263 BackgroundImagePositionClass = BackgroundImagePositionY + "-" + BackgroundImagePositionX; 264 backgroundImageSizeClass = _data.BackgroundImageSize; 265 } 266 267 string ctaBackgroundColor = _data.BackgroundColor; 268 269 ctaBackgroundColor = colorService.GetHexColor(Pageview.AreaID, ctaBackgroundColor); 270 271 string BackgroundGradient = _data.BackgroundGradient; 272 273 string contentBackgroundColor = _data.contentBackgroundColor; 274 string contentBorderColor = _data.contentBorderColor; 275 276 string contentBorderSize = _data.contentBorderSize + "px"; 277 278 string contentGutterClass = _data.contentGutter; 279 string BackgroundPadding = _data.backgroundPadding; 280 281 contentBackgroundColor = colorService.GetHexColor(Pageview.AreaID, contentBackgroundColor); 282 contentBorderColor = colorService.GetHexColor(Pageview.AreaID, contentBorderColor); 283 284 string shadowClass = _data.contentShadow ? "contentShadow" : ""; 285 286 } 287 288 <style> 289 290 @@media screen and (min-width: 991px) { 291 .multicolumn--@paragraphID { 292 height: @ParagraphHeight !important; 293 } 294 } 295 296 .multicolumn--@paragraphID { 297 background-color: @ctaBackgroundColor; 298 @if (!string.IsNullOrWhiteSpace(BackgroundGradient)) 299 { 300 @BackgroundGradient 301 } 302 } 303 304 .multicolumn--@paragraphID .cta-paragraph { 305 background-color: @contentBackgroundColor; 306 border: @contentBorderSize @contentBorderColor solid; 307 } 308 309 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__subheader, 310 .cta-paragraph--@paragraphID .cta-paragraph__subheader { 311 @RenderFontConfig(subheaderFontConfig) 312 } 313 314 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__header, 315 .cta-paragraph--@paragraphID .cta-paragraph__header { 316 @RenderFontConfig(headerFontConfig) 317 } 318 319 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__text p, 320 .multicolumn--@paragraphID .cta-paragraph .cta-paragraph__text li { 321 @RenderFontConfig(contentFontConfig) 322 } 323 324 325 .multicolumn--@paragraphID .cta-paragraph__content-container, 326 .cta-paragraph--@paragraphID .cta-paragraph__content-container 327 { 328 @RenderContentAlignment(_data) 329 } 330 331 </style> 332 <div style="display: flex; flex-direction: column; padding: 25px;"> 333 <div class="multicolumn multicolumn--@paragraphID @_data.BackgroundClass @backgroundImageRepeatClass @BackgroundImagePositionClass @backgroundImageSizeClass @contentGutterClass @BackgroundPadding" style="display: flex; flex-direction: row; @backgroundStyle"> 334 <section class="multicolumn__item"> 335 <div class="cta-paragraph @shadowClass" style="display: flex; flex-direction: column; padding: 25px;"> 336 <section class="cta-paragraph__content-container"> 337 <header class="cta-paragraph__header"> 338 <h2 class="cta-paragraph__subheader">Subheader</h2> 339 <h2 class="cta-paragraph__header">header</h2> 340 </header> 341 <div class="cta-paragraph__text"> 342 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> 343 </div> 344 </section> 345 </div> 346 </section> 347 <section class="multicolumn__item"> 348 <div class="cta-paragraph @shadowClass" style="display: flex; flex-direction: column; padding: 25px;"> 349 <section class="cta-paragraph__content-container"> 350 <header class="cta-paragraph__header"> 351 <h2 class="cta-paragraph__subheader">Subheader</h2> 352 <h2 class="cta-paragraph__header">header</h2> 353 </header> 354 <div class="cta-paragraph__text"> 355 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> 356 </div> 357 </section> 358 </div> 359 </section> 360 </div> 361 362 @_data.ConfigurationName 363 </div> 364 </section> 365 366 @helper RenderContentAlignment(BackgroundConfiguration data) 367 { 368 369 switch (data.ContentElementAlign) 370 { 371 case "align-left": 372 <text> 373 align-items: flex-start; 374 text-align: left; 375 </text> 376 break; 377 case "align-center": 378 <text> 379 align-items: center; 380 text-align: center; 381 </text> 382 break; 383 case "align-right": 384 <text> 385 align-items: flex-end; 386 text-align: right; 387 </text> 388 break; 389 case "align-full": 390 <text> 391 align-items: flex-start; 392 text-align: justify; 393 </text> 394 break; 395 } 396 397 } 398