diff --git a/src/explore-education-statistics-api-docs/source/partials/_parameter_table.html.erb b/src/explore-education-statistics-api-docs/source/partials/_parameter_table.html.erb index f567347d1c..c422e25bc2 100644 --- a/src/explore-education-statistics-api-docs/source/partials/_parameter_table.html.erb +++ b/src/explore-education-statistics-api-docs/source/partials/_parameter_table.html.erb @@ -1,5 +1,9 @@ -
- +
aria-labelledby="<%= labelled_by %>"<% end %> + class="app-table-container" + role="region" + tabindex="0" +> +
@@ -14,7 +18,7 @@ - + + <% body_parameters.each do |name, parameter| %> + + + + + + + <% end %> + +
Parameter<%= parameter.name %> <%= render_schema_type(parameter.schema) %> <%= parameter.required? %> + <%= partial("partials/schema_description", :locals => { description: parameter.description, schema: parameter.schema diff --git a/src/explore-education-statistics-api-docs/source/stylesheets/app.scss b/src/explore-education-statistics-api-docs/source/stylesheets/app.scss index 2e390db1f2..dc52b9d68f 100644 --- a/src/explore-education-statistics-api-docs/source/stylesheets/app.scss +++ b/src/explore-education-statistics-api-docs/source/stylesheets/app.scss @@ -1,15 +1,6 @@ .technical-documentation { + hyphens: auto; max-width: 50em; -} - -.toc__list li { - a:link, - a:visited { - padding: 8px 10px; - } -} - -.collapsible { word-break: break-word; } diff --git a/src/explore-education-statistics-api-docs/source/stylesheets/components/_header.scss b/src/explore-education-statistics-api-docs/source/stylesheets/components/_header.scss new file mode 100644 index 0000000000..27a597ac0e --- /dev/null +++ b/src/explore-education-statistics-api-docs/source/stylesheets/components/_header.scss @@ -0,0 +1,34 @@ +.app-header { + @include govuk-media-query($until: tablet) { + .govuk-header__container { + align-items: center; + display: flex; + flex-wrap: wrap; + justify-content: space-between; + padding: govuk-spacing(2) !important; + } + + .govuk-header__logo { + padding-right: 0; + margin-bottom: govuk-spacing(1); + } + + .govuk-header__content { + flex-grow: 1; + } + + .govuk-header__navigation--end { + text-align: right; + } + + .govuk-header__menu-button { + display: inline-block; + position: unset; + } + + .govuk-header__navigation-list { + text-align: left; + width: 100%; + } + } +} diff --git a/src/explore-education-statistics-api-docs/source/stylesheets/components/_table.scss b/src/explore-education-statistics-api-docs/source/stylesheets/components/_table.scss index d16334a404..8caafd1c29 100644 --- a/src/explore-education-statistics-api-docs/source/stylesheets/components/_table.scss +++ b/src/explore-education-statistics-api-docs/source/stylesheets/components/_table.scss @@ -1,4 +1,6 @@ .app-table-container { + margin-bottom: govuk-spacing(4); + &:focus { box-shadow: 0 0 0 2px; outline: $govuk-focus-width solid $govuk-focus-colour; @@ -9,4 +11,17 @@ display: block; overflow-x: auto; } + + table { + margin-bottom: 0; + } +} + +.app-parameter-table { + hyphens: none; + word-break: normal; + + &__description { + min-width: 200px; + } } diff --git a/src/explore-education-statistics-api-docs/source/stylesheets/components/_toc.scss b/src/explore-education-statistics-api-docs/source/stylesheets/components/_toc.scss new file mode 100644 index 0000000000..4ac6a6b750 --- /dev/null +++ b/src/explore-education-statistics-api-docs/source/stylesheets/components/_toc.scss @@ -0,0 +1,62 @@ +.toc__list li { + a:link, + a:visited { + padding: 8px 10px; + } +} + +.collapsible { + word-break: break-word; +} + +@include govuk-media-query($until: tablet) { + .js .toc__list { + margin-right: 0; + } + + /* stylelint-disable selector-max-compound-selectors */ + .js .toc li li li { + display: initial; + + a { + padding-left: govuk-spacing(3); + } + } + /* stylelint-enable selector-max-compound-selectors */ + + .collapsible { + align-items: center; + display: flex; + flex-wrap: wrap; + justify-content: space-between; + } + + .collapsible__toggle { + align-items: center; + display: flex; + height: 30px; + justify-content: center; + right: 0; + top: 5px; + width: 20px; + } + + .collapsible__toggle-icon { + position: relative; + top: -5px; + right: unset; + } + + .collapsible__toggle-label { + position: absolute; + } + + .collapsible__body { + word-break: break-all; + width: 100%; + + a { + width: fit-content; + } + } +} diff --git a/src/explore-education-statistics-api-docs/source/stylesheets/screen.css.scss b/src/explore-education-statistics-api-docs/source/stylesheets/screen.css.scss index c8edb234d1..42c5ed2c3e 100644 --- a/src/explore-education-statistics-api-docs/source/stylesheets/screen.css.scss +++ b/src/explore-education-statistics-api-docs/source/stylesheets/screen.css.scss @@ -6,4 +6,6 @@ @import './utils'; @import './components/copy'; +@import './components/header'; @import './components/table'; +@import './components/toc'; diff --git a/src/explore-education-statistics-api-docs/source/templates/reference/endpoint.html.md.erb b/src/explore-education-statistics-api-docs/source/templates/reference/endpoint.html.md.erb index 4d4fd4cc6b..5120a53383 100644 --- a/src/explore-education-statistics-api-docs/source/templates/reference/endpoint.html.md.erb +++ b/src/explore-education-statistics-api-docs/source/templates/reference/endpoint.html.md.erb @@ -23,7 +23,10 @@ The URL for this endpoint is: The following parameters will need to be substituted into the URL path. -<%= partial("partials/parameter_table", :locals => { parameters: path_parameters }) %> +<%= partial("partials/parameter_table", :locals => { + labelled_by: "path-parameters", + parameters: path_parameters }) +%> <% end %> <% query_parameters = parameters.select { |parameter| parameter.in == "query" } %> @@ -31,14 +34,20 @@ The following parameters will need to be substituted into the URL path. <% if query_parameters.any? %> ### Query parameters -<%= partial("partials/parameter_table", :locals => { parameters: query_parameters }) %> +<%= partial("partials/parameter_table", :locals => { + labelled_by: "query-parameters", + parameters: query_parameters }) %> <% end %> <% headers = parameters.select { |parameter| parameter.in == "header" } %> <% if headers.any? %> ### Headers -<%= partial("partials/parameter_table", :locals => { parameters: headers }) %> + +<%= partial("partials/parameter_table", :locals => { + labelled_by: "headers", + parameters: headers +}) %> <% end %> <% end %> @@ -54,31 +63,33 @@ body_schema = schema.type.nil? && schema.all_of&.count == 1 ? schema.all_of[0] : body_parameters = get_schema_properties(schema) %> - - - - - - - - - - - <% body_parameters.each do |name, parameter| %> +
+
NameTypeRequiredDescription
+ - - - - + + + + - <% end %> - -
<%= name %><%= render_schema_type(parameter) %><%= body_schema.requires?(parameter) %> - <%= partial("partials/schema_description", :locals => { - description: parameter.description, - schema: parameter - }) %> - NameTypeRequiredDescription
+
<%= name %><%= render_schema_type(parameter) %><%= body_schema.requires?(parameter) %> + <%= partial("partials/schema_description", :locals => { + description: parameter.description, + schema: parameter + }) %> +
+
### Example request body @@ -141,32 +152,34 @@ languages. <% if responses.any? %> ## Responses - - - - - - - - - - -<% responses.each do |status, response| %> -<% response.content.each do |media_type, content| %> +
+
StatusDescriptionMedia TypeSchema
+ - - - - + + + + -<% end %> -<% end %> - -
<%= status %><%= render_markdown(response.description) %> - <%= media_type %> - - <%= render_schema_type(content.schema) %> - StatusDescriptionMedia TypeSchema
+ + + <% responses.each do |status, response| %> + <% response.content.each do |media_type, content| %> + + <%= status %> + <%= render_markdown(response.description) %> + + <%= media_type %> + + + <%= render_schema_type(content.schema) %> + + + <% end %> + <% end %> + + + <% if responses[200] %> ### Example successful response diff --git a/src/explore-education-statistics-api-docs/source/templates/reference/schema.html.md.erb b/src/explore-education-statistics-api-docs/source/templates/reference/schema.html.md.erb index f82c6cb7a5..cb99276382 100644 --- a/src/explore-education-statistics-api-docs/source/templates/reference/schema.html.md.erb +++ b/src/explore-education-statistics-api-docs/source/templates/reference/schema.html.md.erb @@ -22,8 +22,8 @@ Allowed options: <% if properties.any? %> ## Properties -
- +
+
Property