diff --git a/SiemensIXBlazor.Tests/TooltipTest.cs b/SiemensIXBlazor.Tests/TooltipTest.cs new file mode 100644 index 0000000..2e49f47 --- /dev/null +++ b/SiemensIXBlazor.Tests/TooltipTest.cs @@ -0,0 +1,39 @@ +// ----------------------------------------------------------------------- +// SPDX-FileCopyrightText: 2024 Siemens AG +// +// SPDX-License-Identifier: MIT +// +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. +// ----------------------------------------------------------------------- + + +using Bunit; +using Microsoft.AspNetCore.Components; +using SiemensIXBlazor.Components; +using SiemensIXBlazor.Enums.Tooltip; +using Xunit; + +namespace SiemensIXBlazor.Tests +{ + public class TooltipTests : TestContextBase + { + [Fact] + public void TooltipRendersCorrectly() + { + // Arrange + var cut = RenderComponent( + ("Id", "tooltipId"), + ("TitleContent", "Test Tooltip"), + ("Interactive", true), + ("Placement", TooltipVariant.bottom), + ("For", "testElement") + ); + + // Assert + cut.MarkupMatches(""); + } + + + } +} diff --git a/SiemensIXBlazor/Components/Tooltip/Tooltip.Razor.cs b/SiemensIXBlazor/Components/Tooltip/Tooltip.Razor.cs new file mode 100644 index 0000000..f2e5a41 --- /dev/null +++ b/SiemensIXBlazor/Components/Tooltip/Tooltip.Razor.cs @@ -0,0 +1,37 @@ +// ----------------------------------------------------------------------- +// SPDX-FileCopyrightText: 2024 Siemens AG +// +// SPDX-License-Identifier: MIT +// +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. +// ----------------------------------------------------------------------- + + + +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using SiemensIXBlazor.Enums.Chip; +using SiemensIXBlazor.Enums.Tooltip; +using SiemensIXBlazor.Interops; + +namespace SiemensIXBlazor.Components +{ + public partial class Tooltip + { + [Parameter, EditorRequired] + public string Id { get; set; } = string.Empty; + [Parameter] + public bool Interactive { get; set; } = false; + [Parameter] + public string? TitleContent { get; set; } + [Parameter] + public TooltipVariant Placement { get; set; } = TooltipVariant.top; + [Parameter] + public string? For { get; set; } + [Parameter] + public RenderFragment? ChildContent { get; set; } + private BaseInterop _interop; + } +} + diff --git a/SiemensIXBlazor/Components/Tooltip/Tooltip.razor b/SiemensIXBlazor/Components/Tooltip/Tooltip.razor new file mode 100644 index 0000000..282f44f --- /dev/null +++ b/SiemensIXBlazor/Components/Tooltip/Tooltip.razor @@ -0,0 +1,25 @@ +@* ----------------------------------------------------------------------- +// SPDX-FileCopyrightText: 2024 Siemens AG +// +// SPDX-License-Identifier: MIT +// +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. +// ----------------------------------------------------------------------- +*@ + +@using Microsoft.JSInterop; +@namespace SiemensIXBlazor.Components +@inject IJSRuntime JSRuntime +@inherits IXBaseComponent + + + @ChildContent + diff --git a/SiemensIXBlazor/Enums/Tooltip/TooltipVariant.cs b/SiemensIXBlazor/Enums/Tooltip/TooltipVariant.cs new file mode 100644 index 0000000..77904ec --- /dev/null +++ b/SiemensIXBlazor/Enums/Tooltip/TooltipVariant.cs @@ -0,0 +1,19 @@ +// ----------------------------------------------------------------------- +// SPDX-FileCopyrightText: 2024 Siemens AG +// +// SPDX-License-Identifier: MIT +// +// This source code is licensed under the MIT license found in the +// LICENSE file in the root directory of this source tree. +// --- + +namespace SiemensIXBlazor.Enums.Tooltip +{ + public enum TooltipVariant + { + bottom, + left, + right, + top + } +} \ No newline at end of file