-
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.
Add styling to number, select and date fields. Rename button sections…
… to interaction
- Loading branch information
1 parent
b169f22
commit 1069eca
Showing
10 changed files
with
59 additions
and
21 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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
module AtomicView | ||
module Components | ||
class DateFieldComponent < ViewComponent::Form::DateFieldComponent | ||
def html_class | ||
class_names( | ||
*%W[block w-full h-9 min-w-0 flex-1 rounded-md border-0 py-1 text-sm shadow-sm ring-1], | ||
"disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200", | ||
"text-gray-900 ring-gray-300 placeholder:text-gray-400 focus:ring-neutral-700", | ||
"text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500" => method_errors? | ||
) | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
module AtomicView | ||
module Components | ||
class NumberFieldComponent < ViewComponent::Form::NumberFieldComponent | ||
def call | ||
render FieldComponent.new( | ||
form, | ||
object_name, | ||
method_name, | ||
options, | ||
ActionView::Helpers::Tags::NumberField | ||
) | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
module AtomicView | ||
module Components | ||
class SelectComponent < ViewComponent::Form::SelectComponent | ||
def html_class | ||
class_names( | ||
class_names( | ||
*%W[block w-full h-9 min-w-0 flex-1 rounded-md border-0 py-1 text-sm shadow-sm ring-1], | ||
"disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 disabled:ring-gray-200", | ||
"text-gray-900 ring-gray-300 placeholder:text-gray-400 focus:ring-neutral-700", | ||
"text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500" => method_errors?, | ||
), | ||
options[:class] | ||
) | ||
end | ||
end | ||
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
4 changes: 0 additions & 4 deletions
4
previews/selection_and_input/text_field_component_preview/with_left_section_button.html.erb
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
...s/selection_and_input/text_field_component_preview/with_left_section_interaction.html.erb
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,9 @@ | ||
<%= form_with model: model do |form| %> | ||
<%= form.label :attribute %> | ||
<%= form.text_field :attribute, left_section_as_interaction: true, left_section: form.button("Do Things", class: "relative -mr-px inline-flex items-center gap-x-1.5 rounded-l-md px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-gray-300 hover:bg-gray-50") %> | ||
<% end %> | ||
<br> | ||
<%= form_with model: model do |form| %> | ||
<%= form.label :attribute %> | ||
<%= form.text_field :attribute, left_section_as_interaction: true, left_section: form.select(:example, [["Lorem", 1], ["Ipsum", 2]], class: "max-w-24 rounded-r-none") %> | ||
<% end %> |
4 changes: 0 additions & 4 deletions
4
previews/selection_and_input/text_field_component_preview/with_right_section_button.html.erb
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
.../selection_and_input/text_field_component_preview/with_right_section_interaction.html.erb
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,9 @@ | ||
<%= form_with model: model do |form| %> | ||
<%= form.label :attribute %> | ||
<%= form.text_field :attribute, right_section_as_interaction: true, right_section: form.button("Do Things", class: "relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-gray-300 hover:bg-gray-50") %> | ||
<% end %> | ||
<br> | ||
<%= form_with model: model do |form| %> | ||
<%= form.label :attribute %> | ||
<%= form.text_field :attribute, right_section_as_interaction: true, right_section: form.select(:example, [["Lorem", 1], ["Ipsum", 2]], class: "max-w-24 rounded-l-none") %> | ||
<% end %> |