Skip to content

Commit

Permalink
css: isolate spacing properties for 'button--alt' class (#1956)
Browse files Browse the repository at this point in the history
When customising your own admin dashboards, it is quite expected to
use consistent graphical elements (such as buttons) in custom pages.

Exposing a `button--alt` CSS class is helpful when adding some custom
buttons, however the existing CSS class includes some spacing
properties which is specific to the navigation bar (because this class
is only used there in the Administrate engine).

This commit moves the spacing property (margin) into a dedicated
`.button--nav` class in order to give the `.button--alt` class a
reusable role.
  • Loading branch information
paulRbr authored Apr 16, 2021
1 parent ffcc34b commit c16b8d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/assets/stylesheets/administrate/components/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ input[type="submit"],
border: $base-border;
border-color: $blue;
color: $blue;
}

.button--nav {
margin-bottom: $base-spacing;
}
2 changes: 1 addition & 1 deletion app/views/administrate/application/_navigation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ as defined by the routes in the `admin/` namespace
%>

<nav class="navigation" role="navigation">
<%= link_to(t("administrate.navigation.back_to_app"), root_url, class: "button button--alt") if defined?(root_url) %>
<%= link_to(t("administrate.navigation.back_to_app"), root_url, class: "button button--alt button--nav") if defined?(root_url) %>

<% Administrate::Namespace.new(namespace).resources_with_index_route.each do |resource| %>
<%= link_to(
Expand Down

0 comments on commit c16b8d1

Please sign in to comment.