Merge pull request #4334 from consul/sdg_show_section_header

New header section on SDG Goals Index
This commit is contained in:
Javi Martín
2021-01-29 14:14:44 +01:00
committed by GitHub
4 changed files with 51 additions and 4 deletions

View File

@@ -915,7 +915,8 @@
}
}
.help-header {
.help-header,
.section-header {
background: #fafafa;
border-bottom: 1px solid #eee;
margin-top: -$line-height;

View File

@@ -1,5 +1,22 @@
.sdg-goals-index {
.section-header {
h1 {
@include grid-row;
@include grid-column-gutter;
&::before {
@extend %font-icon;
background: image-url("sdg.svg");
display: inline-block;
height: 1.5em;
width: 1.5em;
}
}
}
.sdg-goal-list {
@extend %sdg-goal-list;
@include grid-row;

View File

@@ -1,8 +1,12 @@
<% provide(:title) { title } %>
<%= render Shared::BannerComponent.new("sdg") %>
<main class="sdg-goals-index">
<header class="section-header">
<h1><%= title %></h1>
</header>
<%= render Shared::BannerComponent.new("sdg") %>
<div class="sdg-goals-index">
<%= link_list(*goal_links, class: "sdg-goal-list") %>
<% phases.each do |phase| %>
@@ -14,4 +18,4 @@
<%= render "shared/cards", cards: phase.cards %>
</section>
<% end %>
</div>
</main>

View File

@@ -0,0 +1,25 @@
require "rails_helper"
describe SDG::Goals::IndexComponent, type: :component do
let!(:goals) { SDG::Goal.all }
let!(:phases) { SDG::Phase.all }
let!(:component) { SDG::Goals::IndexComponent.new(goals, phases) }
before do
Setting["feature.sdg"] = true
end
it "renders a heading" do
render_inline component
expect(page).to have_css "h1", exact_text: "Sustainable Development Goals"
end
it "renders phases" do
render_inline component
expect(page).to have_content "Sensitization"
expect(page).to have_content "Planning"
expect(page).to have_content "Monitoring"
end
end