Skip to content

Commit

Permalink
Be more resilient to different element sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSandersonMS committed Oct 27, 2020
1 parent 496967d commit d431f52
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
49 changes: 26 additions & 23 deletions Client/Shared/CodeCell.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,34 @@
@inject HttpClient Http

<div class="code-cell">
<div class="toolbar">
<button @onclick="RunCell">
&#x25BA;
</button>
<div class="top">
<div class="toolbar">
<button @onclick="RunCell">&#x25BA;</button>
</div>
<CodeEditor @bind-Code="cell.Content" OnCompletionsRequested="GetCompletionsAsync" />
</div>
<CodeEditor @bind-Code="cell.Content" OnCompletionsRequested="GetCompletionsAsync" />
<div class="break" />

@* TODO: Create a cleaner system for formatting different kinds of output/status *@
@if (isEvaluating)
{
<div class="output">...</div>
}
else if (result != null)
{
if (!string.IsNullOrEmpty(result.CommandFailedMessage))
<div class="output @ResultCssClass">
@* TODO: Create a cleaner system for formatting different kinds of output/status *@
@if (isEvaluating)
{
<div class="output command-failed">@result.CommandFailedMessage</div>
<text>...</text>
}
else if (result.Output != null)
else if (result != null)
{
<div class="output">@result.Output</div>
if (!string.IsNullOrEmpty(result.CommandFailedMessage))
{
@result.CommandFailedMessage
}
else if (result.Output != null)
{
@result.Output
}
else
{
<text>(No output)</text>
}
}
else
{
<div class="output">(No output)</div>
}
}
</div>
</div>

@code {
Expand All @@ -41,6 +41,9 @@
private ExecuteResult result;
private bool isEvaluating;

private string ResultCssClass
=> !string.IsNullOrEmpty(result?.CommandFailedMessage) ? "command-failed" : null;

private async Task RunCell()
{
try
Expand Down
9 changes: 2 additions & 7 deletions Client/Shared/CodeCell.razor.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
.code-cell {
display: flex;
flex: 0 0 100%;
flex-wrap: wrap;
margin: 10px;
border: 1px solid #bfbfbf;
}

.break {
flex-basis: 100%;
height: 0;
.top {
display: flex;
}

input {
Expand All @@ -27,7 +23,6 @@ input {
}

.output {
width: 100%;
padding: 10px;
background-color: #eee;
}
Expand Down

0 comments on commit d431f52

Please sign in to comment.