Skip to content

Commit

Permalink
#354 - Optimize header size on mobile view.
Browse files Browse the repository at this point in the history
Hide sub header.
Rewrite styles for header so main header is ellipsing correctly.
Shrink spacing.
  • Loading branch information
maraf committed May 26, 2021
1 parent f531229 commit c998d13
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 46 deletions.
53 changes: 33 additions & 20 deletions src/Money.Blazor.Host/Components/Title.razor
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
<div class="header">
<div class="container">
<div class="d-flex">
<h3 class="mr-1">
@if (!String.IsNullOrEmpty(Icon))
{
<Icon Identifier="@Icon" class="ml-1 mr-2" />
}

<h3>
@if (!String.IsNullOrEmpty(Icon))
{
<Icon Identifier="@Icon" class="mr-1" />
}
@Main
</h3>
<div class="actions">
@if (!String.IsNullOrEmpty(ButtonText) || ButtonClick != null)
{
<button type="button" class="btn btn-primary" @onclick="@(() => ButtonClick?.Invoke())">
@if (!String.IsNullOrEmpty(ButtonIcon))
{
<Icon Identifier="@ButtonIcon" class="mr-1" />
}

<span class="text">@Main</span>
@ButtonText
</button>
}

@if (!String.IsNullOrEmpty(ButtonText) || ButtonClick != null)
{
<button type="button" class="btn btn-primary" @onclick="@(() => ButtonClick?.Invoke())">
@if (!String.IsNullOrEmpty(ButtonIcon))
{
<Icon Identifier="@ButtonIcon" class="mr-1" />
}
@ButtonContent
</div>
</div>

@ButtonText
</button>
}

@ButtonContent
</h3>
@if (!String.IsNullOrEmpty(Sub))
{
<h6 class="d-none d-md-block">
Expand All @@ -32,4 +35,14 @@

</div>
</div>
<div class="header-append"></div>
@if (!String.IsNullOrEmpty(Sub))
{
<div class="d-none d-md-block">
<div class="header-append"></div>
</div>
}

<div class="d-block d-md-none">
<div class="header-append-small"></div>
</div>

2 changes: 1 addition & 1 deletion src/Money.Blazor.Host/Pages/Overview.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<Title Icon="calendar" Main="@Title" Sub="@SubTitle">
<ButtonContent>
<ExpenseCreateButton CategoryKey="CategoryKey" />
@{
var trendsButton = TrendsTitleUrl();
}
Expand All @@ -15,6 +14,7 @@
</span>
</button>
}
<ExpenseCreateButton CategoryKey="CategoryKey" />
</ButtonContent>
</Title>
<ExceptionPanel />
Expand Down
2 changes: 1 addition & 1 deletion src/Money.Blazor.Host/Pages/Summary.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<Title Icon="signal" Main="Summary" Sub="@SubTitle">
<ButtonContent>
<ExpenseCreateButton />
<IncomeCreateButton OnClick="IncomeCreate.Show" />
<ExpenseCreateButton />
</ButtonContent>
</Title>
<ExceptionPanel />
Expand Down
2 changes: 1 addition & 1 deletion src/Money.Blazor.Host/wwwroot/css/site.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 12 additions & 23 deletions src/Money.Blazor.Host/wwwroot/css/site.scss
Original file line number Diff line number Diff line change
Expand Up @@ -164,33 +164,14 @@ h4 {
font-size: 26px;
color: #0078D7;
}
/*h2 {
position: relative;
height: 40px;
overflow: hidden;

button {
position: absolute;
right: 0;
}
}*/
h3 {
line-height: 1.25;
margin-bottom: 0;

span.text {
position: relative;
top: 6px;
display: inline-block;
overflow: hidden;
max-width: calc(100% - 177px);
text-overflow: ellipsis;
white-space: nowrap;
}

button {
float: right;
}
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

h6 {
Expand All @@ -202,12 +183,20 @@ h4 {
white-space: nowrap;
overflow: hidden;
}

.actions {
white-space: nowrap;
}
}

.header-append {
margin-bottom: 150px;
}

.header-append-small {
margin-bottom: 110px;
}

.bottom-bar {
background: #f5f5f5;
border-top: 1px solid #dddddd;
Expand Down

0 comments on commit c998d13

Please sign in to comment.