Skip to content

Commit d97d67c

Browse files
committed
updating from auto to none, and some placement of the control fixes
1 parent ac23849 commit d97d67c

File tree

4 files changed

+27
-13
lines changed

4 files changed

+27
-13
lines changed

src/Elastic.Documentation.Site/Assets/markdown/image-carousel.css

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
.carousel-control {
4242
position: absolute;
43-
top: 100px; /* Fixed distance from top */
4443
background-color: rgba(0, 0, 0, 0.5);
4544
border: none;
4645
color: white;
@@ -93,6 +92,21 @@
9392
background-color: black;
9493
}
9594

95+
/* Small carousel styles */
96+
.carousel-container[data-max-height][style*="350px"] .carousel-control {
97+
top: 150px;
98+
}
99+
100+
/* Medium carousel styles */
101+
.carousel-container[data-max-height][style*="750px"] .carousel-control {
102+
top: 200px;
103+
}
104+
105+
/* None (no max-height) carousel styles */
106+
.carousel-container[data-none-height] .carousel-control {
107+
top: 500px;
108+
}
109+
96110
/* Max height carousel styles */
97111
.carousel-container[data-max-height] {
98112
padding-bottom: 40px; /* Space for indicators */
@@ -111,12 +125,12 @@
111125
margin: 0 auto;
112126
}
113127

114-
/* Auto height carousel styles - images at natural size */
115-
.carousel-container[data-auto-height] {
128+
/* None height carousel styles - images at natural size */
129+
.carousel-container[data-none-height] {
116130
padding-bottom: 40px; /* Space for indicators */
117131
}
118132

119-
.carousel-container[data-auto-height] .carousel-image-reference img {
133+
.carousel-container[data-none-height] .carousel-image-reference img {
120134
max-width: 100%;
121135
height: auto;
122136
display: block;

src/Elastic.Markdown/Myst/Directives/Image/ImageCarouselBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public override void FinalizeAndValidate(ParserContext context)
2727
// Validate max-height option
2828
if (!string.IsNullOrEmpty(MaxHeight))
2929
{
30-
var validHeights = new[] { "auto", "small", "medium" };
30+
var validHeights = new[] { "none", "small", "medium" };
3131
if (!validHeights.Contains(MaxHeight.ToLower()))
3232
{
33-
this.EmitWarning($"Invalid max-height value '{MaxHeight}'. Valid options are: auto, small, medium. Defaulting to 'auto'.");
33+
this.EmitWarning($"Invalid max-height value '{MaxHeight}'. Valid options are: none, small, medium. Defaulting to 'none'.");
3434
}
3535
}
3636

src/Elastic.Markdown/Myst/Directives/Image/ImageCarouselView.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
{
77
"small" => "350px",
88
"medium" => "750px",
9-
"auto" => "none", // Auto means no max-height constraint
9+
"none" => "none", // None means no max-height constraint
1010
null or "" => null,
1111
_ => null // Default to none for invalid values
1212
};
1313

14-
var hasMaxHeight = !string.IsNullOrEmpty(pixelHeight) && maxHeightValue != null;
14+
var hasMaxHeight = !string.IsNullOrEmpty(pixelHeight) && maxHeightValue != null && maxHeightValue != "none";
1515
var containerStyle = hasMaxHeight ? $"--carousel-max-height: {pixelHeight};" : "";
16-
var dataAttribute = maxHeightValue == "auto" ? "data-auto-height" : (hasMaxHeight ? "data-max-height" : "");
16+
var dataAttribute = maxHeightValue == "none" ? "data-none-height" : (hasMaxHeight ? "data-max-height" : "");
1717
}
1818
<div class="carousel-container" @dataAttribute style="@containerStyle">
1919
<div class="carousel-track">

tests/Elastic.Markdown.Tests/Directives/ImageCarouselTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void ParsesSmallMaxHeight()
8585
public class ImageCarouselWithAutoHeightTests(ITestOutputHelper output) : DirectiveTest<ImageCarouselBlock>(output,
8686
"""
8787
:::{carousel}
88-
:max-height: auto
88+
:max-height: none
8989
9090
```{image} img/auto.png
9191
:alt: Auto height image
@@ -98,9 +98,9 @@ protected override void AddToFileSystem(MockFileSystem fileSystem) =>
9898
fileSystem.AddFile(@"docs/img/auto.png", "");
9999

100100
[Fact]
101-
public void ParsesAutoMaxHeight()
101+
public void ParsesNoneMaxHeight()
102102
{
103-
Block!.MaxHeight.Should().Be("auto");
103+
Block!.MaxHeight.Should().Be("none");
104104
Collector.Diagnostics.Count.Should().Be(0);
105105
}
106106
}
@@ -130,7 +130,7 @@ public void WarnsOnInvalidMaxHeight()
130130

131131
var warning = Collector.Diagnostics.First();
132132
warning.Message.Should().Contain("Invalid max-height value 'large'");
133-
warning.Message.Should().Contain("Valid options are: auto, small, medium");
133+
warning.Message.Should().Contain("Valid options are: none, small, medium");
134134
}
135135
}
136136

0 commit comments

Comments
 (0)