Skip to content

Commit a2cd609

Browse files
committed
Add project's name in the content on small screens
1 parent 85f445b commit a2cd609

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

assets/less/content/general.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,13 @@ h1.section-heading {
132132
vertical-align: middle;
133133
}
134134
}
135+
136+
.visible-xs {
137+
display: none !important;
138+
}
139+
140+
@media screen and (max-width: 767px) {
141+
.visible-xs {
142+
display: block !important;
143+
}
144+
}

lib/ex_doc/formatter/html/templates/api_reference_template.eex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<%= head_template(config, %{title: "API Reference", type: :extra}) %>
22
<%= sidebar_template(config, modules, exceptions, protocols) %>
3-
<h1>API Reference</h1>
3+
<h1>
4+
<small class="visible-xs"><%= config.project %></small>
5+
API Reference
6+
</h1>
47

58
<ul class="summary-links">
69
<%= unless Enum.empty?(modules) do %>

lib/ex_doc/formatter/html/templates/dist/app.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ex_doc/formatter/html/templates/module_template.eex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<%= sidebar_template(config, modules, exceptions, protocols) %>
33

44
<h1>
5+
<small class="visible-xs"><%= config.project %></small>
56
<%= module.id %>
67
<%= if module.type != :module do %>
78
<small><%= module.type %></small>

test/ex_doc/formatter/html/templates_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
108108
content = get_module_page([CompiledWithDocs])
109109

110110
assert content =~ ~r{<title>CompiledWithDocs [^<]*</title>}
111-
assert content =~ ~r{<h1>\s*CompiledWithDocs\s*}
111+
assert content =~ ~r{<h1>\n\s*<small class="visible-xs">Elixir</small>\n\s*CompiledWithDocs\s*}
112112
refute content =~ ~r{<small>module</small>}
113113
assert content =~ ~r{moduledoc.*Example.*CompiledWithDocs\.example.*}ms
114114
assert content =~ ~r{example/2.*Some example}ms
@@ -159,12 +159,12 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
159159

160160
test "module_page outputs behavior and callbacks" do
161161
content = get_module_page([CustomBehaviourOne])
162-
assert content =~ ~r{<h1>\s*CustomBehaviourOne\s*<small>behaviour</small>}m
162+
assert content =~ ~r{<h1>\n\s*<small class="visible-xs">Elixir</small>\n\s*CustomBehaviourOne\s*<small>behaviour</small>}m
163163
assert content =~ ~r{Callbacks}
164164
assert content =~ ~r{<div class="detail" id="c:hello/1">}
165165

166166
content = get_module_page([CustomBehaviourTwo])
167-
assert content =~ ~r{<h1>\s*CustomBehaviourTwo\s*<small>behaviour</small>\s*}m
167+
assert content =~ ~r{<h1>\n\s*<small class="visible-xs">Elixir</small>\n\s*CustomBehaviourTwo\s*<small>behaviour</small>\s*}m
168168
assert content =~ ~r{Callbacks}
169169
assert content =~ ~r{<div class="detail" id="c:bye/1">}
170170
end
@@ -173,6 +173,6 @@ defmodule ExDoc.Formatter.HTML.TemplatesTest do
173173

174174
test "module_page outputs the protocol type" do
175175
content = get_module_page([CustomProtocol])
176-
assert content =~ ~r{<h1>\s*CustomProtocol\s*<small>protocol</small>\s*}m
176+
assert content =~ ~r{<h1>\n\s*<small class="visible-xs">Elixir</small>\n\s*CustomProtocol\s*<small>protocol</small>\s*}m
177177
end
178178
end

0 commit comments

Comments
 (0)