Skip to content

Commit

Permalink
Implement consistent SVG icons (#126)
Browse files Browse the repository at this point in the history
Also adds a warning message when editing a maintenance item.
  • Loading branch information
dougwaldron authored Nov 5, 2024
1 parent 627dfd8 commit 637fccb
Show file tree
Hide file tree
Showing 23 changed files with 244 additions and 80 deletions.
4 changes: 2 additions & 2 deletions src/WebApp/Pages/Account/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<div class="p-3 border rounded-3 bg-light-subtle mb-3">
<form method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
<div>Update failed:</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/WebApp/Pages/Account/Login.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

<form id="external-account" asp-page="ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
</div>
<button type="submit" class="btn btn-lg btn-outline-primary btn-img my-3 py-3 px-4" title="Sign in using your work account">
Expand Down
4 changes: 2 additions & 2 deletions src/WebApp/Pages/Admin/Maintenance/EntryTypes/Add.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<div class="p-3 border rounded-3 bg-light-subtle">
<form method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
</div>
<div class="row">
Expand Down
15 changes: 13 additions & 2 deletions src/WebApp/Pages/Admin/Maintenance/EntryTypes/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@
<h1>Edit @EditModel.ThisOption.SingularName</h1>
<hr />

<div class="alert alert-warning d-flex align-items-center" role="alert">
<svg class="bi me-3" role="img" aria-label="Warning:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
<div>
Warning: Changing the name of @(EditModel.ThisOption.StartsWithVowelSound ? "an" : "a")
@EditModel.ThisOption.SingularName will affect all of its existing uses. Before proceeding, consider
whether it would be better to deactivate this one and create a new one.
</div>
</div>

<h2>@Model.OriginalName</h2>

<div class="p-3 border rounded-3 bg-light-subtle">
<form method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
</div>
<div class="col-md-8 mb-3">
Expand Down
7 changes: 6 additions & 1 deletion src/WebApp/Pages/Admin/Maintenance/EntryTypes/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
}

<p class="d-print-none">
<a asp-page="../Index" class="lead link-offset-2">← Site Maintenance</a>
<a asp-page="../Index" class="lead icon-link">
<svg class="bi">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-arrow-90deg-up"></use>
</svg>
Site Maintenance
</a>
</p>

<h1>@IndexModel.ThisOption.PluralName</h1>
Expand Down
5 changes: 3 additions & 2 deletions src/WebApp/Pages/Admin/Maintenance/MaintenanceOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ public class MaintenanceOption
{
public string SingularName { get; private init; } = string.Empty;
public string PluralName { get; private init; } = string.Empty;
public bool StartsWithVowelSound { get; private init; }

private MaintenanceOption() { }

public static MaintenanceOption EntryType { get; } =
new() { SingularName = "Work Entry Type", PluralName = "Work Entry Types" };
new() { SingularName = "Work Entry Type", PluralName = "Work Entry Types", StartsWithVowelSound = false };

public static MaintenanceOption Office { get; } =
new() { SingularName = "Office", PluralName = "Offices" };
new() { SingularName = "Office", PluralName = "Offices", StartsWithVowelSound = true };
}
4 changes: 2 additions & 2 deletions src/WebApp/Pages/Admin/Maintenance/Offices/Add.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<div class="p-3 border rounded-3 bg-light-subtle">
<form method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
</div>
<div class="row">
Expand Down
15 changes: 13 additions & 2 deletions src/WebApp/Pages/Admin/Maintenance/Offices/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@
<h1>Edit @EditModel.ThisOption.SingularName</h1>
<hr />

<div class="alert alert-warning d-flex align-items-center" role="alert">
<svg class="bi me-3" role="img" aria-label="Warning:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
<div>
Warning: Changing the name of @(EditModel.ThisOption.StartsWithVowelSound ? "an" : "a")
@EditModel.ThisOption.SingularName will affect all of its existing uses. Before proceeding, consider
whether it would be better to deactivate this one and create a new one.
</div>
</div>

<h2>@Model.OriginalName</h2>

<div class="p-3 border rounded-3 bg-light-subtle">
<form method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
</div>
<div class="row">
Expand Down
7 changes: 6 additions & 1 deletion src/WebApp/Pages/Admin/Maintenance/Offices/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
}

<p class="d-print-none">
<a asp-page="../Index" class="lead link-offset-2">← Site Maintenance</a>
<a asp-page="../Index" class="lead icon-link">
<svg class="bi">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-arrow-90deg-up"></use>
</svg>
Site Maintenance
</a>
</p>

<h1>@IndexModel.ThisOption.PluralName</h1>
Expand Down
4 changes: 2 additions & 2 deletions src/WebApp/Pages/Admin/Users/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<div class="p-3 border rounded-3 bg-light-subtle mb-3">
<form method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
<div>User update failed:</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/WebApp/Pages/Admin/Users/EditRoles.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<p>View a detailed description of <a asp-page="Roles" target="_blank">user roles and capabilities</a>.</p>
<form method="post">
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2" />
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@Url.Content("~/images/app-icons.svg")#app-icon-exclamation-triangle-fill"></use>
</svg>
<div>Roles update failed:</div>
</div>
Expand Down
55 changes: 23 additions & 32 deletions src/WebApp/Pages/Shared/Components/MainMenu/Default.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@model MainMenuViewComponent.MenuParams
@{
var iconsFile = Url.Content("~/images/app-icons.svg");
}

<header role="banner">
<nav id="main-nav" class="navbar nav-underline navbar-expand-sm text-bg-brand bg-gradient border-bottom shadow-sm mb-3 d-print-none">
Expand Down Expand Up @@ -44,7 +47,11 @@
@if (Model.IsStaffUser)
{
<li class="nav-item">
<a class="nav-link" asp-page="/Staff/WorkEntries/Add" title="Add New Work Entry">&#x2795;&nbsp;<span class="d-inline d-sm-none">Add&nbsp;</span>New <span class="d-inline d-sm-none d-lg-inline">Work Entry</span></a>
<a class="nav-link" asp-page="/Staff/WorkEntries/Add" title="Add New Work Entry">
<svg class="bi">
<use href="/images/app-icons.svg#app-icon-plus-lg"></use>
</svg>&nbsp;<span class="d-inline d-sm-none">Add&nbsp;</span>New <span class="d-inline d-sm-none d-lg-inline">Work Entry</span>
</a>
</li>
}
@if (Model.IsActiveUser)
Expand Down Expand Up @@ -98,41 +105,41 @@
<button class="nav-link dropdown-toggle" id="bd-theme" type="button"
aria-haspopup="menu" aria-expanded="false" data-bs-toggle="dropdown" data-bs-display="static" title="Toggle theme">
<svg class="bi me-1 theme-icon-active">
<use href="#circle-half"></use>
<use href="@iconsFile#app-icon-circle-half"></use>
</svg>
<span class="ms-2 visually-hidden" id="bd-theme-text">Toggle theme</span>
<span class="visually-hidden" id="bd-theme-text">Toggle theme</span>
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-theme">
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-theme-text">
<li>
<button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="light">
<svg class="bi me-2 opacity-50 theme-icon">
<use href="#sun-fill"></use>
<svg class="bi me-2 opacity-50">
<use href="@iconsFile#app-icon-sun-fill"></use>
</svg>
Light
<svg class="bi ms-auto d-none">
<use href="#check2"></use>
<svg class="bi ms-auto theme-checkmark d-none">
<use href="@iconsFile#app-icon-check2"></use>
</svg>
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center" data-bs-theme-value="dark">
<svg class="bi me-2 opacity-50 theme-icon">
<use href="#moon-stars-fill"></use>
<svg class="bi me-2 opacity-50">
<use href="@iconsFile#app-icon-moon-stars-fill"></use>
</svg>
Dark
<svg class="bi ms-auto d-none">
<use href="#check2"></use>
<svg class="bi ms-auto theme-checkmark d-none">
<use href="@iconsFile#app-icon-check2"></use>
</svg>
</button>
</li>
<li>
<button type="button" class="dropdown-item d-flex align-items-center active" data-bs-theme-value="auto">
<svg class="bi me-2 opacity-50 theme-icon">
<use href="#circle-half"></use>
<svg class="bi me-2 opacity-50">
<use href="@iconsFile#app-icon-circle-half"></use>
</svg>
Auto
<svg class="bi ms-auto d-none">
<use href="#check2"></use>
<svg class="bi ms-auto theme-checkmark d-none">
<use href="@iconsFile#app-icon-check2"></use>
</svg>
</button>
</li>
Expand All @@ -143,19 +150,3 @@
</div>
</nav>
</header>

<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="check2" viewBox="0 0 16 16">
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" />
</symbol>
<symbol id="circle-half" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 0 8 1v14zm0 1A8 8 0 1 1 8 0a8 8 0 0 1 0 16z" />
</symbol>
<symbol id="moon-stars-fill" viewBox="0 0 16 16">
<path d="M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z" />
<path d="M10.794 3.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387a1.734 1.734 0 0 0-1.097 1.097l-.387 1.162a.217.217 0 0 1-.412 0l-.387-1.162A1.734 1.734 0 0 0 9.31 6.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387a1.734 1.734 0 0 0 1.097-1.097l.387-1.162zM13.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732l-.774-.258a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L13.863.1z" />
</symbol>
<symbol id="sun-fill" viewBox="0 0 16 16">
<path d="M8 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z" />
</symbol>
</svg>
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
@model string
@{
var iconsFile = Url.Content("~/images/app-icons.svg");
}
@if (Model == ViewData["ValidatingSection"]!.ToString())
{
<div asp-validation-summary="All" class="alert alert-danger d-flex align-items-center" role="alert">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@iconsFile#app-icon-exclamation-triangle-fill"></use>
</svg>
</div>
}
else
{
<div class="alert alert-danger validation-summary-valid d-flex align-items-center" role="alert" data-valmsg-summary="true">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle-fill me-2" viewBox="0 0 16 16">
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5m.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2"/>
</svg>
<svg class="bi me-2" role="img" aria-label="Danger:">
<use href="@iconsFile#app-icon-exclamation-triangle-fill"></use>
</svg>
<ul>
<li style="display:none"></li>
</ul>
</div>
}

Loading

0 comments on commit 637fccb

Please sign in to comment.