Skip to content

Commit b3e7669

Browse files
committed
Merge branch 'form-styles'
2 parents a745ed3 + 6fbcf2f commit b3e7669

File tree

12 files changed

+38
-25
lines changed

12 files changed

+38
-25
lines changed

src/Buttercup.Web/Areas/Admin/Views/Users/New.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ViewData["Title"] = Localizer["Title_NewUser"];
55
}
66
<h1>@Localizer["Title_NewUser"]</h1>
7-
<form method="post">
7+
<form class="form" method="post">
88
@Html.EditorForModel()
99
<div class="button-bar">
1010
<button class="push-button push-button--primary">@Localizer["Label_Add"]</button>

src/Buttercup.Web/Views/Account/ChangePassword.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ViewData["Title"] = Localizer["Title_ChangePassword"];
55
}
66
<h1>@Localizer["Title_ChangePassword"]</h1>
7-
<form method="post">
7+
<form class="form" method="post">
88
<div class="form-field">
99
<label class="form-field__label" asp-for="CurrentPassword">@Localizer["Label_CurrentPassword"]</label>
1010
<input class="input-box" asp-for="CurrentPassword" required>

src/Buttercup.Web/Views/Account/Preferences.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
ViewData["Title"] = Localizer["Title_YourPreferences"];
66
}
77
<h1>@Localizer["Title_YourPreferences"]</h1>
8-
<form method="post">
8+
<form class="form" method="post">
99
<div class="form-field">
1010
<label class="form-field__label" asp-for="TimeZone">@Localizer["Label_TimeZone"]</label>
1111
<select class="input-box" asp-for="TimeZone" asp-items="TimeZoneOptions.AllOptions().AsSelectListItems()" required>

src/Buttercup.Web/Views/Authentication/RequestPasswordReset.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ViewData["Title"] = Localizer["Title_ResetPassword"];
55
}
66
<h1>@Localizer["Title_ResetPassword"]</h1>
7-
<form method="post">
7+
<form class="form" method="post">
88
<div asp-validation-summary="ModelOnly"></div>
99
<div class="form-field">
1010
<label class="form-field__label" asp-for="Email">@Localizer["Label_Email"]</label>

src/Buttercup.Web/Views/Authentication/ResetPassword.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ViewData["Title"] = Localizer["Title_ResetPassword"];
55
}
66
<h1>@Localizer["Title_ResetPassword"]</h1>
7-
<form method="post">
7+
<form class="form" method="post">
88
<div class="form-field">
99
<label class="form-field__label" asp-for="Password">@Localizer["Label_NewPassword"]</label>
1010
<input class="input-box" asp-for="Password" required>

src/Buttercup.Web/Views/Authentication/SignIn.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ViewData["Title"] = Localizer["Title_SignIn"];
55
}
66
<h1>@Localizer["Title_SignIn"]</h1>
7-
<form method="post">
7+
<form class="form" method="post">
88
<div asp-validation-summary="ModelOnly"></div>
99
<div class="form-field">
1010
<label class="form-field__label" asp-for="Email">@Localizer["Label_Email"]</label>

src/Buttercup.Web/Views/Recipes/Edit.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ViewData["Title"] = Localizer["Title_EditRecipe", Model!.Attributes.Title];
55
}
66
<h1>@Localizer["Heading_EditRecipe"]</h1>
7-
<form method="post">
7+
<form class="form" method="post">
88
@Html.EditorFor(m => m.Attributes)
99
<input type="hidden" asp-for="BaseRevision">
1010
<div class="button-bar">

src/Buttercup.Web/Views/Recipes/New.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ViewData["Title"] = Localizer["Title_NewRecipe"];
55
}
66
<h1>@Localizer["Title_NewRecipe"]</h1>
7-
<form method="post">
7+
<form class="form" method="post">
88
@Html.EditorForModel()
99
<button class="push-button push-button--primary">@Localizer["Label_Save"]</button>
1010
</form>

src/Buttercup.Web/Views/Recipes/Show.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@
9494
{
9595
<partial name="_Comment" model="@commentViewModel" />
9696
}
97-
<form class="new-comment-form" method="post" asp-action="AddComment" asp-route-id="@Model.Recipe.Id">
97+
<form class="form form--compact new-comment-form" method="post" asp-action="AddComment" asp-route-id="@Model.Recipe.Id">
9898
<p class="new-comment-form__author">@User.Identity?.Name</p>
99-
<div class="new-comment-form__field form-field">
99+
<div class="form-field">
100100
<textarea class="input-box" asp-for="NewCommentAttributes.Body" aria-label="@Localizer["Label_Comment"]" placeholder="@Localizer["Placeholder_Comment"]" required></textarea>
101101
<span asp-validation-for="NewCommentAttributes.Body"></span>
102102
</div>
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
@form-horizontal-padding: 1em;
2-
@form-vertical-padding-large: 1.5em;
3-
@form-vertical-padding-small: 0.5em;
1+
@form-field-vertical-spacing: 0.5em;
2+
@form-validation-error-padding: 0.7em 1em;
3+
4+
.form {
5+
display: flex;
6+
flex-direction: column;
7+
gap: 1.5em;
8+
9+
&.form--compact {
10+
gap: 0.7em;
11+
}
12+
13+
> button {
14+
align-self: flex-start;
15+
}
16+
}
417

518
.form-field {
619
display: flex;
720
flex-direction: column;
8-
margin-bottom: @form-vertical-padding-large;
921
}
1022

1123
.form-field__label {
12-
margin-bottom: @form-vertical-padding-small;
24+
margin-bottom: @form-field-vertical-spacing;
1325
}
1426

1527
.form-field__optional-label {
@@ -22,23 +34,28 @@
2234
}
2335

2436
.form-field__link {
25-
margin-top: @form-vertical-padding-small;
37+
margin-top: @form-field-vertical-spacing;
2638
}
2739

2840
.field-validation-error,
2941
.validation-summary-errors {
3042
background-color: @color-red;
3143
color: @color-white;
3244
font-weight: bold;
33-
padding: @form-vertical-padding-small @form-horizontal-padding;
3445
}
3546

36-
.validation-summary-errors {
37-
margin-bottom: @form-vertical-padding-large;
47+
.field-validation-error {
48+
padding: @form-validation-error-padding;
49+
}
3850

51+
.validation-summary-errors {
3952
> ul {
4053
list-style-type: none;
4154
margin: 0;
4255
padding: 0;
56+
57+
> li {
58+
margin: @form-validation-error-padding;
59+
}
4360
}
4461
}

0 commit comments

Comments
 (0)