forked from rubyforgood/casa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rubyforgood#5777] Refactor step navigation into unique component
- Loading branch information
1 parent
dfd5408
commit 2e4fdce
Showing
5 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div> | ||
<%# Back navigation %> | ||
<%= button_tag type: @submit_back ? "submit" : "button", class: "btn btn-link", title: "Back step", aria: { label: "Back step" } do %> | ||
<% if @submit_back %> | ||
<i class="lni lni-chevron-left", alt: "Chevron icon left"></i> | ||
<% else %> | ||
<%= link_to @nav_back, title: "Back step", aria: { label: "Back step" } do %> | ||
<i class="lni lni-chevron-left", alt: "Chevron icon left"></i> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%# Next navigation %> | ||
<%= button_tag type: @submit_next ? "submit" : "button", class: "btn btn-link", title: "Next step", aria: { label: "Next step" } do %> | ||
<% if @submit_next %> | ||
<i class="lni lni-chevron-right", alt: "Chevron icon right"></i> | ||
<% else %> | ||
<%= link_to @nav_next, title: "Next step", aria: { label: "Next step" } do %> | ||
<i class="lni lni-chevron-right", alt: "Chevron icon right"></i> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class Form::StepNavigationComponent < ViewComponent::Base | ||
def initialize(nav_back: nil, nav_next: nil, submit_back: false, submit_next: false) | ||
@nav_back = nav_back | ||
@nav_next = nav_next | ||
@submit_back = submit_back | ||
@submit_next = submit_next | ||
@back_disabled = !@nav_back | ||
@next_disabled = !@nav_next | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters