Skip to content

Commit 0529c08

Browse files
committed
Fix sidebar component to render slot before
With this preliminary PR, we display the missing title h2 in sidebar component, when provided via slot `before`. - Display slot 'before' if provides, with `<%= slotted :before %>` - Favor tag h2 for this slot, to have only one h1 per page This PR will be necessary to display a OpenAPI version select button, and prepare the release of version v3.2
1 parent a9f2713 commit 0529c08

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/_components/shared/sidebar.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ side-bar {
66

77
aside {
88
padding: var(--spacing-14) var(--spacing-4);
9-
9+
1010
> button {
1111
display: none;
1212
}
1313
}
1414

15-
:is(h1) {
15+
:is(h2) {
1616
display: flex;
1717
flex-wrap: wrap;
1818
justify-content: space-between;
19-
font-size: var(--text-l);
19+
align-items: baseline;
20+
font-size: var(--text-xl);
2021
margin-block-end: var(--spacing-4);
2122

2223
span {

src/_components/shared/sidebar.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<svg width="11" height="12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m10 6 .543.517a.75.75 0 0 0 0-1.034L10 6ZM0 6.75h10v-1.5H0v1.5Zm10.543-1.267-4.762-5-1.086 1.034 4.762 5 1.086-1.034Zm-1.086 0-4.762 5 1.086 1.034 4.762-5-1.086-1.034Z" fill="#025FD7"/></svg>
55
Hide menu
66
</button>
7+
<%= slotted :before %>
78
<ul class="sidebar-list" data-controller="sidebar">
89
<% @data.each do |page| %>
910
<li>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sidebar_version: "v3.1"
1+
sidebar_version: "3.1"
22
sidebar_name: openapi_v3-1

src/_layouts/documentation.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ layout: application
66
<%= render Shared::Sidebar.new(data: @entries, current: resource) do |sidebar| %>
77
<% if resource.data.sidebar_title.present? %>
88
<% sidebar.slot :before do %>
9-
<h1>
9+
<h2>
1010
<%= resource.data.sidebar_title %>
11+
<% # TODO: replace by select with version v3.2 %>
1112
<span class="version"><%= resource.data.sidebar_version %></span>
12-
</h1>
13+
</h2>
1314
<% end %>
1415
<% end %>
1516
<% if resource.data.display_cta.present? %>

0 commit comments

Comments
 (0)