-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
319 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Inc.TeamAssistant.Stories/Components/RouterLink.stories.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@attribute [Stories("Components/RouterLink")] | ||
|
||
<Stories TComponent="RouterLink"> | ||
<Story Name="Default" Layout="typeof(DarkLayout)"> | ||
<Template> | ||
<RouterLink Href="#" @attributes="context.Args"> | ||
<Content>@_text</Content> | ||
</RouterLink> | ||
</Template> | ||
</Story> | ||
<Story Name="Dark" Layout="typeof(LightLayout)"> | ||
<Arguments> | ||
<Arg For="c => c.IsDark" Value="true" /> | ||
</Arguments> | ||
<Template> | ||
<RouterLink Href="#" @attributes="context.Args"> | ||
<Content>@_text</Content> | ||
</RouterLink> | ||
</Template> | ||
</Story> | ||
</Stories> | ||
|
||
@code { | ||
private readonly string _text = "Link"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@if (string.IsNullOrWhiteSpace(Href)) | ||
{ | ||
<a href="#" class="link @CssClass" @onclick="EmitOnClick" @onclick:preventDefault="true"> | ||
@Content | ||
</a> | ||
} | ||
else | ||
{ | ||
<a href="@Href" class="link @CssClass" target="@Target"> | ||
@Content | ||
</a> | ||
} | ||
|
||
@code { | ||
/// <summary> | ||
/// Html or text content of the button. | ||
/// </summary> | ||
[Parameter, EditorRequired] | ||
public RenderFragment Content { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// Target for navigation. | ||
/// </summary> | ||
[Parameter] | ||
public string Target { get; set; } = RouterTarget.Self; | ||
|
||
/// <summary> | ||
/// Link to navigate. | ||
/// </summary> | ||
[Parameter] | ||
public string Href { get; set; } = default!; | ||
|
||
/// <summary> | ||
/// On click event. | ||
/// </summary> | ||
[Parameter] | ||
public EventCallback OnClick { get; set; } | ||
|
||
/// <summary> | ||
/// Flag for set dark or light theme. | ||
/// </summary> | ||
[Parameter] | ||
public bool IsDark { get; set; } | ||
|
||
private string CssClass => IsDark ? "link_dark" : "link_light"; | ||
|
||
private async Task EmitOnClick() | ||
{ | ||
if (!OnClick.Equals(default(EventCallback))) | ||
await OnClick.InvokeAsync(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Inc.TeamAssistant.WebUI/Components/RouterLink.razor.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.link { | ||
font-size: 1rem; | ||
} | ||
.link:hover { | ||
text-decoration: underline; | ||
} | ||
.link_light { | ||
color: #dfdfdf; | ||
} | ||
.link_dark { | ||
color: #000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Inc.TeamAssistant.WebUI.Components; | ||
|
||
public static class RouterTarget | ||
{ | ||
public static readonly string Blank = "_blank"; | ||
public static readonly string Self = "_self"; | ||
public static readonly string Parent = "_parent"; | ||
public static readonly string Top = "_top"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
.history__body { | ||
margin-top: .5rem; | ||
} | ||
.history__item { | ||
::deep .link { | ||
display: block; | ||
line-height: 1.5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,4 @@ | |
} | ||
.story__item { | ||
line-height: 2rem; | ||
} | ||
.story__link { | ||
color: #dfdfdf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.