Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ lint_asset_bundle_size: ## Lints JavaScript and CSS compiled bundle size
@# and you have no options to split that from the common bundles. If you need to increase this
@# budget and accept the fact that this will force end-users to endure longer load times, you
@# should set the new budget to within a few thousand bytes of the production-compiled size.
find app/assets/builds/application.css -size -220000c | grep .
find app/assets/builds/application.css -size -190000c | grep .
find public/packs/js/application-*.digested.js -size -5000c | grep .

lint_migrations:
Expand Down
1 change: 0 additions & 1 deletion app/assets/stylesheets/_uswds.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@forward 'usa-banner';
@forward 'usa-button';
@forward 'usa-form';
@forward 'usa-header';
@forward 'usa-layout-grid';
@forward 'usa-link';
@forward 'usa-list';
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/navigation.css.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use 'uswds-core' as *;

@forward 'usa-header/src/styles/usa-header';
@forward 'usa-nav/src/styles';
@forward 'usa-sidenav/src/styles';

Expand Down
12 changes: 9 additions & 3 deletions app/views/accounts/_nav_auth.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<div class="usa-overlay"></div>
<div class="usa-header">
<%= render 'accounts/mobile_nav' %>
</div>

<div class="grid-container padding-x-0 tablet:padding-x-4">
<div class="grid-row flex-justify tablet:padding-y-4">
<div class="grid-col-auto display-flex flex-align-center padding-x-2 tablet:padding-x-0">
Expand All @@ -19,9 +24,10 @@

<%= button_to t('links.sign_out'), logout_path, method: :delete, class: 'usa-button usa-button--unstyled' %>

<% if enable_mobile_nav %>
<button class="usa-menu-btn margin-left-2"><%= t('account.navigation.menu') %></button>
<% end %>
<button class="usa-menu-btn margin-left-2"><%= t('account.navigation.menu') %></button>
</div>
</div>
</div>

<%= stylesheet_tag_once('navigation') %>
<%= javascript_packs_tag_once('navigation') %>
2 changes: 1 addition & 1 deletion app/views/events/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for(:header) do %>
<%= render 'accounts/nav_auth', enable_mobile_nav: false, greeting: @presenter.header_personalization %>
<%= render 'accounts/nav_auth', greeting: @presenter.header_personalization %>
<% end %>

<% self.title = t('titles.account') %>
Expand Down
9 changes: 1 addition & 8 deletions app/views/layouts/account_side_nav.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<% content_for(:header) do %>
<%= render 'accounts/nav_auth', enable_mobile_nav: true, greeting: @presenter.header_personalization %>
<%= render 'accounts/nav_auth', greeting: @presenter.header_personalization %>
<% end %>

<% content_for(:mobile_nav) do %>
<%= render 'accounts/mobile_nav' %>
<% end %>

<%= stylesheet_tag_once('navigation') %>
<%= javascript_packs_tag_once('navigation') %>

<%= extends_layout :application, body_class: 'site', disable_card: true, user_main_tag: false do %>
<div class="grid-row grid-gap">
<div class="display-none tablet:display-block tablet:grid-col-4">
Expand Down
6 changes: 0 additions & 6 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

<%= extends_layout :base, body_class: local_assigns.fetch(:body_class, 'site tablet:bg-primary-lighter') do %>
<%= link_to t('shared.skip_link'), '#main-content', class: 'usa-skipnav' %>
<div class="usa-overlay"></div>
<% if content_for?(:mobile_nav) %>
<div class="usa-header">
<%= yield(:mobile_nav) %>
</div>
<% end %>
Comment on lines -7 to -12
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously I might have assumed usa-overlay could be used for things other than mobile navigation (e.g. modals) and that's why it always needed to be present, but in reality it is very specifically for header/navigation.

See: https://github.com/search?q=repo%3Auswds%2Fuswds%20usa-overlay&type=code

<%= render 'shared/banner' %>
<%= content_tag(
local_assigns[:user_main_tag] == false ? 'div' : 'main',
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/base.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<% end %>
<%= preload_link_tag font_url('public-sans/PublicSans-Bold.woff2') %>
<%= preload_link_tag font_url('public-sans/PublicSans-Regular.woff2') %>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= render_stylesheet_once_tags %>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= csrf_meta_tags %>

<%= favicon_link_tag(
Expand Down
37 changes: 13 additions & 24 deletions spec/views/accounts/_nav_auth.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,25 @@
@user = build_stubbed(:user, :with_backup_code)
allow(view).to receive(:greeting).and_return(@user.email)
allow(view).to receive(:current_user).and_return(@user)
render partial: 'accounts/nav_auth'
end

context 'user is signed in' do
before do
render partial: 'accounts/nav_auth', locals: { enable_mobile_nav: false }
end

it 'contains welcome message' do
expect(rendered).to have_content "Welcome #{@user.email}", normalize_ws: true
end

it 'does not contain link to cancel the auth process' do
expect(rendered).not_to have_link(t('links.cancel'))
end
it 'contains welcome message' do
expect(rendered).to have_content "Welcome #{@user.email}", normalize_ws: true
end

it 'contains sign out link' do
expect(rendered).to have_button(t('links.sign_out'))
expect(rendered).to have_selector('form') do |f|
expect(f['action']).to eq logout_path
end
end
it 'does not contain link to cancel the auth process' do
expect(rendered).not_to have_link(t('links.cancel'))
end

context 'mobile nav is enabled' do
before do
render partial: 'accounts/nav_auth', locals: { enable_mobile_nav: true }
end
it 'contains menu button' do
expect(rendered).to have_button t('account.navigation.menu')
end

it 'contains menu button' do
expect(rendered).to have_button t('account.navigation.menu')
it 'contains sign out link' do
expect(rendered).to have_button(t('links.sign_out'))
expect(rendered).to have_selector('form') do |f|
expect(f['action']).to eq logout_path
end
end
end