Skip to content

Commit

Permalink
Don't provide empty background image url if not set
Browse files Browse the repository at this point in the history
  • Loading branch information
linkdotnet committed Jun 26, 2024
1 parent 0dea3a4 commit a96f65f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@inject IOptions<Introduction> Introduction
@inject IOptions<Social> Social

<div style="--profile-background: url(@Introduction.Value.BackgroundUrl)" class="@IntroductionClass">
<div style="@IntroductionStyle" class="@IntroductionClass">
<div class="introduction-container">
<div class="profile-picture" style="--profile-image: url(@Introduction.Value.ProfilePictureUrl)">
</div>
Expand All @@ -16,4 +16,8 @@
private string IntroductionClass => !string.IsNullOrEmpty(Introduction.Value.BackgroundUrl)
? "introduction-background"
: string.Empty;

private string IntroductionStyle => !string.IsNullOrEmpty(Introduction.Value.BackgroundUrl)
? $"-profile-background: url({Introduction.Value.BackgroundUrl})"
: string.Empty;
}

0 comments on commit a96f65f

Please sign in to comment.