Skip to content

Commit 1e2cdd2

Browse files
djanelle-mitmatt-bernhardt
authored andcommitted
Merged: Assorted style fixes for timdex result
This also catches up to link_to_tab changes
1 parent 2c82b31 commit 1e2cdd2

File tree

5 files changed

+89
-29
lines changed

5 files changed

+89
-29
lines changed

app/assets/stylesheets/partials/_buttons.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
@mixin buttonSecondary {
22
border: 1px solid $color-blue-500;
3+
background-color: $color-white;
4+
color: $color-text-primary;
35
border-radius: 0;
46
display: inline-block;
57
padding: 6px 12px;

app/assets/stylesheets/partials/_results.scss

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ li.result {
4747
margin-bottom: 48px;
4848

4949
.eyebrow {
50+
color: $color-text-secondary;
5051
font-size: 1.3rem;
5152
font-weight: $fw-medium;
5253
letter-spacing: 0.05em;
@@ -55,7 +56,8 @@ li.result {
5556

5657
.record-title {
5758
font-size: 2.4rem;
58-
line-height: 1.1;
59+
line-height: 1.3;
60+
margin-bottom: 8px;
5961

6062
a {
6163
@include underlinedLinks;
@@ -65,9 +67,10 @@ li.result {
6567

6668
.pub-info {
6769
font-size: $fs-base;
68-
color: $gray-d1;
70+
color: $color-text-secondary;
6971
span:first-child:after {
70-
content: " | ";
72+
content: "";
73+
color: $color-text-disabled;
7174
}
7275
margin-bottom: 1em;
7376
}
@@ -86,6 +89,18 @@ li.result {
8689
}
8790
}
8891

92+
.result-highlights.use {
93+
margin-top: 0;
94+
95+
ul {
96+
list-style: disc inside;
97+
98+
li {
99+
margin-left: 0.6rem;
100+
}
101+
}
102+
}
103+
89104
.result-get,
90105
.result-record {
91106
a:visited {
@@ -115,6 +130,38 @@ li.result {
115130
.highlight {
116131
background-color: $color-highlight;
117132
}
133+
134+
&.use {
135+
.result-metadata {
136+
margin-bottom: 16px;
137+
}
138+
139+
.pub-info {
140+
margin-bottom: 4px;
141+
}
142+
143+
ul.contributors {
144+
li {
145+
font-weight: $fw-normal;
146+
147+
a {
148+
color: $color-text-secondary;
149+
text-decoration: none;
150+
151+
&:hover {
152+
text-decoration: underline;
153+
}
154+
}
155+
}
156+
}
157+
158+
a.button {
159+
@include buttonSecondary;
160+
}
161+
162+
.truncate-list li:last-child {margin-bottom: 0;}
163+
164+
}
118165
}
119166

120167
/* Start USE specific overrides */

app/helpers/search_helper.rb

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,22 @@ def link_to_result(result)
2222
end
2323
end
2424

25-
def link_to_tab(target)
26-
if @active_tab == target.downcase
27-
link_to target, results_path(params.permit(:q, :per_page, :booleanType, :tab).merge(tab: target.downcase)),
28-
aria: { current: "page" },
29-
class: "active tab-link",
30-
data: { turbo_frame: "search-results", turbo_action: "advance" }
25+
# Generates a link for a search results tab, marking it as active if it matches the current active tab.
26+
# @param target [String] The name of the tab to link to
27+
# @param label [String] The display label for the tab (optional)
28+
# @return [String] HTML link element for the tab
29+
def link_to_tab(target, label = nil)
30+
clean_target = target.downcase.gsub(' ', '_').downcase
31+
tab_label = label || target
32+
if @active_tab == clean_target
33+
link_to tab_label, results_path(params.permit(:q, :per_page, :booleanType, :tab).merge(tab: clean_target)),
34+
aria: { current: 'page' },
35+
class: 'active tab-link',
36+
data: { turbo_frame: 'search-results', turbo_action: 'advance' }
3137
else
32-
link_to target, results_path(params.permit(:q, :per_page, :booleanType, :tab).merge(tab: target.downcase)),
33-
class: "tab-link",
34-
data: { turbo_frame: "search-results", turbo_action: "advance" }
38+
link_to tab_label, results_path(params.permit(:q, :per_page, :booleanType, :tab).merge(tab: clean_target)),
39+
class: 'tab-link',
40+
data: { turbo_frame: 'search-results', turbo_action: 'advance' }
3541
end
3642
end
3743

app/views/search/_result.html.erb

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
1-
<li class="result">
1+
<li class="result use">
22
<div class="result-content">
33
<p class="eyebrow">Eyebrow Text</p>
44
<h3 class="record-title">
55
<span class="sr">Title: </span>
66
<%= link_to_result(result) %>
77
</h3>
88

9-
<p class="pub-info">
10-
<span><%= result[:content_type]&.each { |type| type['value'] }&.join(' ; ') %></span>
11-
<span>
12-
<% result[:dates]&.each do |date| %>
13-
<%= date['value'] if date['kind'] == 'Publication date' %>
14-
<% end %>
15-
</span>
16-
</p>
9+
<div class="result-metadata">
1710

18-
<%= render partial: 'shared/contributors', locals: { contributors: result[:contributors] } %>
11+
<p class="pub-info">
12+
<span><%= result[:content_type]&.each { |type| type['value'] }&.join(' ; ') %></span>
13+
<span>
14+
<% result[:dates]&.each do |date| %>
15+
<%= date['value'] if date['kind'] == 'Publication date' %>
16+
<% end %>
17+
</span>
18+
</p>
1919

20-
<div class="result-highlights">
20+
<% if result[:contributors].present? %>
21+
<span class="sr">Contributors: </span>
22+
<ul class="list-inline truncate-list contributors">
23+
<%= render partial: 'shared/contributors', locals: { contributors: result[:contributors] } %>
24+
</ul>
25+
<% end %>
26+
</div>
27+
28+
<div class="result-highlights use">
2129
<%= render partial: 'search/highlights', locals: { result: result } %>
2230
</div>
2331

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<%= return if contributors.blank? %>
22

3-
<span class="sr">Contributors: </span>
4-
<ul class="list-inline truncate-list contributors">
5-
<% contributors.uniq do |contributor| %>
6-
<li><%= link_to contributor['value'], results_path({ advanced: true, contributors: contributor['value'] }) %></li>
7-
<% end %>
8-
</ul>
3+
<% contributors.uniq do |contributor| %>
4+
<li><%= link_to contributor['value'], results_path({ advanced: true, contributors: contributor['value'] }) %></li>
5+
<% end %>

0 commit comments

Comments
 (0)