feat(Localization) Adding localization text. Fixing bugs in toasts

This commit is contained in:
2022-04-10 19:15:41 -04:00
parent 4322be0053
commit 81659a9f84
29 changed files with 287 additions and 122 deletions
@@ -10,8 +10,6 @@
position: relative;
display: inline-block;
width: 100%;
}
.tooltipContent {
@@ -25,17 +23,19 @@
margin-left: -60px;
margin-bottom: 36px;
background-color: #363636;
color: #fff;
border-radius: 6px;
padding-left: 20px;
padding-right: 20px;
padding-bottom: 20px;
padding-top: 20px;
border: 2px solid black;
white-space: break-spaces;
z-index: 2147483647;
background-color: var(--info-secondary);
border: 1px solid var(--info-secondary-border);
border-radius: 2px;
box-shadow: 0 3px 8px rgba(0,0,0,0.5);
}
+27 -17
View File
@@ -9,10 +9,10 @@
}
else
{
<div class="toastContainer @Toast.SeverityType.ToLower() @FadeoutStyle">
<div class="toastTitle">
@Toast.Title
</div>
<div onclick="@Dismiss" class="toastContainer @FadeoutStyle @Toast.SeverityType.ToLower()">
<div class="toastTitle">
@Toast.Title
</div>
<div>
@Toast.Message
</div>
@@ -27,9 +27,9 @@ else
display: flex;
flex-direction: column;
justify-items: stretch;
width: 100%;
width: 250px;
opacity: 1;
cursor: pointer;
}
.fadeout {
@@ -37,22 +37,22 @@ else
opacity: 0;
}
.toastContainer.@SeverityType.Warning.ToLower() {
.@SeverityType.Warning.ToLower() {
background-color: var(--severity-warning-color);
border-color: var(--severity-warning-border-color);
}
.toastContainer.@SeverityType.Error.ToLower() {
.@SeverityType.Error.ToLower() {
background-color: var(--severity-error-color);
border-color: var(--severity-error-border-color);
}
.toastContainer.@SeverityType.Information.ToLower() {
.@SeverityType.Information.ToLower() {
background-color: var(--severity-information-color);
border-color: var(--severity-information-border-color);
}
.toastContainer.@SeverityType.Success.ToLower() {
.@SeverityType.Success.ToLower() {
background-color: var(--severity-success-color);
border-color: var(--severity-success-border-color);
}
@@ -64,6 +64,7 @@ else
</style>
@code {
[Parameter]
public ToastModel? Toast { get; set; } = default!;
@@ -72,9 +73,7 @@ else
private string FadeoutStyle => isFadingOut ? "fadeout" : "";
private int removalTime = 150000;
private int fadeoutTime = 4000;
//private int fade
private int fadeoutTime = 1000;
private Timer removalTimer = null!;
private Timer fadeoutTimer = null!;
@@ -82,7 +81,7 @@ else
protected override void OnInitialized()
{
#if DEBUG
removalTime = 5000;
removalTime = 8000;
#endif
removalTimer = new Timer(removalTime);
@@ -92,23 +91,34 @@ else
fadeoutTimer = new Timer(removalTime - fadeoutTime);
fadeoutTimer.Elapsed += OnFadeout!;
fadeoutTimer.Enabled = true;
toastService.Subscribe(StateHasChanged);
}
void OnFadeout(object source, ElapsedEventArgs eventArgs)
{
isFadingOut = true;
// isFadingOut = true;
StateHasChanged();
}
void OnRemoval(object source, ElapsedEventArgs eventArgs)
{
//toastService.RemoveToast(Toast!);
StateHasChanged();
}
void Dismiss()
{
toastService.RemoveToast(Toast!);
}
public void Dispose()
{
removalTimer.Dispose();
fadeoutTimer.Dispose();
removalTimer.Elapsed -= OnRemoval!;
fadeoutTimer.Elapsed -= OnFadeout!;
toastService.Unsubscribe(StateHasChanged);
}
}