Skip to content

Commit 047f071

Browse files
authored
Redo .NET banner (#8967)
The banner is broken on INT as the image wasn't included in the release artifacts. Also the previous implementation used a padding hack to force a container to have a minimal height. This solution did not work well on very wide screens as it caused the background image to be noticeably clipped. This new solution looks much better on very wide screens and removes the padding hack. Follow up to #8966 Part of: https://github.com/NuGet/Engineering/issues/4226
1 parent c554eda commit 047f071

4 files changed

Lines changed: 63 additions & 38 deletions

File tree

src/Bootstrap/dist/css/bootstrap-theme.css

Lines changed: 29 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bootstrap/less/theme/page-home.less

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,51 @@
1010
}
1111

1212
div.dotnet-20-banner {
13-
background: black url(../img/dotnet-20-banner.svg);
14-
background-repeat: no-repeat;
15-
background-position: 0 -150px;
16-
background-size: cover;
13+
position: relative;
1714
margin-top: 32px;
1815
}
1916

2017
.dotnet-20-banner {
21-
.container {
22-
// The padding bottom is a hack to force the container's height to
23-
// be at least as big as its content. This ensures the background
24-
// image covers the entire container on narrow screens.
25-
padding-top: 20px;
26-
padding-bottom: 140px;
27-
color: white;
18+
.dotnet-20-image {
19+
position: absolute;
20+
top: 0;
21+
left: 0;
22+
height: 100%;
23+
width: 100%;
24+
25+
img {
26+
height: 100%;
27+
width: 100%;
28+
object-fit: cover;
29+
background-color: #000;
30+
}
31+
}
2832

33+
.container {
2934
.row {
30-
margin-bottom: 40px;
35+
color: white;
36+
37+
@media (max-width: @screen-md-max) {
38+
margin-top: 48px;
39+
margin-bottom: 48px;
40+
}
41+
42+
@media (min-width: @screen-md-max) {
43+
margin-top: 144px;
44+
margin-bottom: 144px;
45+
}
3146

3247
.banner-text {
3348
backdrop-filter: blur(2px);
3449

3550
h2 {
51+
margin-top: 0px;
3652
font-weight: 600;
3753
}
3854

3955
h3 {
4056
margin-top: 0px;
41-
font-weight: 600;
57+
font-weight: 400;
4258
}
4359

4460
a {
@@ -52,14 +68,6 @@
5268
}
5369
}
5470

55-
// The banner uses a hack to ensure its container is tall enough
56-
// on narrow screens. This offsets that hack.
57-
.what-is-nuget-with-banner {
58-
@media (max-width: @screen-sm-max) {
59-
margin-top: -120px;
60-
}
61-
}
62-
6371
.what-is-nuget {
6472
font-size: 1.15em;
6573
padding-bottom: 75px;

src/NuGetGallery/NuGetGallery.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,7 @@
13481348
<Content Include="Content\gallery\img\circuit-board.svg" />
13491349
<Content Include="Content\gallery\img\default-package-icon-256x256.png" />
13501350
<Content Include="Content\gallery\img\default-package-icon.svg" />
1351+
<Content Include="Content\gallery\img\dotnet-20-banner.svg" />
13511352
<Content Include="Content\gallery\img\dotnet-foundation-42x42.png" />
13521353
<Content Include="Content\gallery\img\dotnet-foundation.svg" />
13531354
<Content Include="Content\gallery\img\facebook-24x24.png" />

src/NuGetGallery/Views/Pages/Home.cshtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ else if (AskUserToEnable2FA)
7777
@if (Model.ShowDotnet20Banner)
7878
{
7979
<div class="dotnet-20-banner">
80+
<div class="dotnet-20-image">
81+
<img src="~/Content/gallery/img/dotnet-20-banner.svg" aria-hidden="true" />
82+
</div>
8083
<div class="container">
8184
<div class="row">
8285
<div class="banner-text col-md-8">
@@ -96,7 +99,7 @@ else if (AskUserToEnable2FA)
9699
</div>
97100
}
98101

99-
<div class="container text-center what-is-nuget @(Model.ShowDotnet20Banner ? "what-is-nuget-with-banner" : "") ">
102+
<div class="container text-center what-is-nuget">
100103
<div class="row">
101104
<h2>What is NuGet?</h2>
102105
<p>

0 commit comments

Comments
 (0)