Skip to content

Commit

Permalink
Bug fix: Text field validation wrap styles (#2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
langermank committed May 31, 2023
1 parent 6ac5cb9 commit 607889b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-buses-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/view-components": patch
---

Bug fix: Text field validation wrap styles
2 changes: 1 addition & 1 deletion app/components/primer/alpha/form_control.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<% end %>
<% if @validation_message %>
<%= render(Primer::BaseComponent.new(tag: :div, **@validation_arguments)) do %>
<%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %>
<span class="FormControl-inlineValidation--visual"><%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %></span>
<span><%= @validation_message %></span>
<% end %>
<% end %>
Expand Down
9 changes: 8 additions & 1 deletion app/components/primer/alpha/text_field.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,25 @@
.FormControl-inlineValidation {
display: flex;
font-size: var(--text-caption-size, 12px);
line-height: var(--text-caption-lineHeight, calc(16 / 12));
font-weight: var(--base-text-weight-semibold, 600);
color: var(--color-danger-fg);
fill: var(--color-danger-fg);
flex-direction: row;
align-items: center;
align-items: start;
gap: var(--base-size-4, 4px);

& p {
margin-bottom: 0;
}
}

.FormControl-inlineValidation--visual {
align-items: center;
display: flex;
min-height: var(--base-size-16, 16px);
}

.FormControl-spacingWrapper {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion lib/primer/forms/form_control.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<% end %>
<%= content %>
<%= content_tag(:div, **@input.validation_arguments) do %>
<%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %>
<span class="FormControl-inlineValidation--visual"><%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %></span>
<%= content_tag(:span, @input.invalid? ? @input.validation_messages.first : "", **@input.validation_message_arguments) %>
<% end %>
<%= render(Caption.new(input: @input)) %>
Expand Down

0 comments on commit 607889b

Please sign in to comment.