Skip to content

Commit d291649

Browse files
committed
other controls to use the output control
1 parent 12afab1 commit d291649

14 files changed

+39
-118
lines changed

MyDevTools/Components/Pages/BranchNameFormatter.razor

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,18 @@
1313
</div>
1414

1515
<button class="btn btn-primary btn-block" @onclick="FormatGitBranchName">Format Git Branch Name</button>
16-
<button class="btn btn-success btn-block" @onclick="CopyToClipboard">Copy to Clipboard</button>
1716
</div>
1817
</div>
1918

2019
@if (!string.IsNullOrEmpty(formattedString))
2120
{
22-
<div class="row mt-4">
23-
<div class="col-md-6 offset-md-3">
24-
<div class="alert alert-success" role="alert">
25-
<strong>Formatted Branch Name:</strong>
26-
<textarea readonly class="form-control" rows="3">@formattedString</textarea>
27-
<div class="mt-2 text-success">@copyConfirmationMessage</div>
28-
</div>
29-
</div>
30-
</div>
21+
<OutputAndCopyToClipboard OutputText="@formattedString" />
3122
}
3223
</div>
3324

3425
@code {
3526
private string inputString = "Feature 12345 : Example work item name";
3627
private string formattedString = "";
37-
private string copyConfirmationMessage = "";
3828

3929
protected override async Task OnInitializedAsync()
4030
{
@@ -59,17 +49,4 @@
5949
formattedString = "Error: " + ex.Message;
6050
}
6151
}
62-
63-
private async Task CopyToClipboard()
64-
{
65-
try
66-
{
67-
await ClipboardService.CopyToClipboardAsync(formattedString);
68-
copyConfirmationMessage = "Text copied to clipboard!";
69-
}
70-
catch (Exception ex)
71-
{
72-
copyConfirmationMessage = "Error: " + ex.Message;
73-
}
74-
}
7552
}

MyDevTools/Components/Pages/ColorPickerConverter.razor

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
</select>
2222
</div>
2323

24-
<div class="alert alert-success" role="alert">
25-
<strong>Converted Color:</strong>
26-
<pre>@convertedColor</pre>
27-
</div>
24+
<OutputAndCopyToClipboard OutputText="@convertedColor" />
2825
</div>
2926
</div>
3027
</div>

MyDevTools/Components/Pages/Components/DiffOutput.razor.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
.line-numbers {
33
counter-reset: line-number;
44
font-family: 'Courier New', monospace;
5-
background-color: #f4f4f4;
6-
border: 1px solid #ccc;
5+
background-color: var(--background-color);
6+
border: 1px solid var(--border-color);
77
padding: 10px;
88
line-height: 1;
99
margin: 0;

MyDevTools/Components/Pages/ContainerIds.razor

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@
2727

2828
@if (!string.IsNullOrEmpty(generatedCodes))
2929
{
30-
<div class="row mt-4">
31-
<div class="col-md-6 offset-md-3">
32-
<label>Generated Codes:</label>
33-
<textarea readonly class="form-control monospace-font" style="width: 180px;" rows="6">@generatedCodes</textarea>
34-
<div class="mt-2 text-success">@copyConfirmationMessage</div>
35-
</div>
36-
</div>
30+
<OutputAndCopyToClipboard OutputText="@generatedCodes" />
3731
}
3832
</div>
3933

MyDevTools/Components/Pages/ContainerIds.razor.css

Lines changed: 0 additions & 7 deletions
This file was deleted.

MyDevTools/Components/Pages/CronGenerator.razor

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,7 @@
6565

6666
@if (!string.IsNullOrEmpty(cronExpression))
6767
{
68-
<div class="row mt-4">
69-
<div class="col-md-10 offset-md-1">
70-
<div class="alert alert-success" role="alert">
71-
<strong>Generated Cron Expression:</strong>
72-
<textarea readonly id="cronExpression" class="form-control" rows="3">@cronExpression</textarea>
73-
<div class="mt-2 text-success">@copyConfirmationMessage</div>
74-
</div>
75-
</div>
76-
</div>
68+
<OutputAndCopyToClipboard OutputText="@cronExpression" />
7769
}
7870
</div>
7971

MyDevTools/Components/Pages/GuidGenerator.razor

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,7 @@
2929

3030
@if (guidResults != null && guidResults.Count > 0)
3131
{
32-
<div class="row mt-4">
33-
<div class="col-md-6 offset-md-3">
34-
<div class="alert alert-success" role="alert">
35-
<strong>GUID Results:</strong>
36-
<pre>@string.Join("\n", guidResults)</pre>
37-
</div>
38-
</div>
39-
</div>
32+
<OutputAndCopyToClipboard OutputText="@string.Join("\n", guidResults)" />
4033
}
4134
</div>
4235

MyDevTools/Components/Pages/HashGenerator.razor

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,7 @@
2929

3030
@if (!string.IsNullOrEmpty(hashResult))
3131
{
32-
<div class="row mt-4">
33-
<div class="col-md-6 offset-md-3">
34-
<div class="alert alert-success" role="alert">
35-
<strong>Hash Result:</strong>
36-
<pre>@hashResult</pre>
37-
</div>
38-
</div>
39-
</div>
32+
<OutputAndCopyToClipboard OutputText="@hashResult" />
4033
}
4134
</div>
4235

MyDevTools/Components/Pages/JwtDecoder.razor

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,7 @@
2121

2222
@if (!string.IsNullOrEmpty(decodedJson))
2323
{
24-
<div class="row mt-4">
25-
<div class="col-md-10 offset-md-1">
26-
<div class="alert alert-success" role="alert">
27-
<strong>Decoded JWT:</strong>
28-
<textarea readonly class="form-control" rows="8">@decodedJson</textarea>
29-
</div>
30-
</div>
31-
</div>
24+
<OutputAndCopyToClipboard OutputText="@decodedJson" />
3225
}
3326
</div>
3427

MyDevTools/Components/Pages/OutputAndCopyToClipboard.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<h5 class="mb-0">Results</h5>
77
</div>
88
<div class="card-body">
9-
<textarea class="form-control mb-3" @bind="OutputText" rows="6" placeholder="Your output will appear here..."></textarea>
9+
<textarea class="form-control mb-3 monospace-font" @bind="OutputText" rows="6" placeholder="Your output will appear here..."></textarea>
1010
<button class="btn btn-success w-100" @onclick="CopyToClipboard">Copy to Clipboard</button>
1111
<div class="mt-3">
1212
<span class="text-success">@copyConfirmationMessage</span>

0 commit comments

Comments
 (0)