From 3887fa96e6c9a467822b123e50d53132553fe940 Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Fri, 17 Dec 2021 12:34:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20LinkButton=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Button/LinkButton.razor | 20 +++++++ .../Components/Button/LinkButton.razor.cs | 59 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 src/BootstrapBlazor/Components/Button/LinkButton.razor create mode 100644 src/BootstrapBlazor/Components/Button/LinkButton.razor.cs diff --git a/src/BootstrapBlazor/Components/Button/LinkButton.razor b/src/BootstrapBlazor/Components/Button/LinkButton.razor new file mode 100644 index 000000000..f9188bff4 --- /dev/null +++ b/src/BootstrapBlazor/Components/Button/LinkButton.razor @@ -0,0 +1,20 @@ +@namespace BootstrapBlazor.Components +@inherits TooltipComponentBase + + + @if (!string.IsNullOrEmpty(Text)) + { + @Text + } + @if (!string.IsNullOrEmpty(Img)) + { + img + } + @ChildContent + @if (!string.IsNullOrEmpty(Title)) + { + + + + } + diff --git a/src/BootstrapBlazor/Components/Button/LinkButton.razor.cs b/src/BootstrapBlazor/Components/Button/LinkButton.razor.cs new file mode 100644 index 000000000..c3ab8364c --- /dev/null +++ b/src/BootstrapBlazor/Components/Button/LinkButton.razor.cs @@ -0,0 +1,59 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; + +namespace BootstrapBlazor.Components +{ + /// + /// + /// + public partial class LinkButton + { + /// + /// + /// + [Parameter] + public string? Text { get; set; } + + /// + /// + /// + [Parameter] + public string Url { get; set; } = "#"; + + /// + /// + /// + [Parameter] + public string? Title { get; set; } + + /// + /// + /// + [Parameter] + public string? Img { get; set; } + + /// + /// + /// + [Parameter] + public Placement TooltipPlacement { get; set; } = Placement.Top; + + /// + /// + /// + [Parameter] + public RenderFragment? ChildContent { get; set; } + + /// + /// + /// + [Parameter] + public EventCallback OnClick { get; set; } + + private bool Prevent => Url.StartsWith('#'); + } +} -- Gitee