Skip to content

Commit

Permalink
Merge pull request #103 from emregokrem/master
Browse files Browse the repository at this point in the history
  • Loading branch information
emncnozge authored Oct 23, 2024
2 parents 13c2e07 + 28bfda3 commit 5ebd7a1
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 71 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public partial class Index
- [Drawer](#drawer)
- [Dropdown Button](#dropdown-button)
- [Dropdown](#dropdown)
- [Dropdown Header](#dropdown-header)
- [Empty State](#empty-state) **(since v0.3.3)**
- [Event List](#event-list)
- [Expanding Search](#expanding-search)
Expand Down Expand Up @@ -845,7 +846,7 @@ private void DrawerButtonClicked()
}
```

## Dropdown button
## Dropdown Button

```razor
<DropdownButton Label="Dropdown" Variant="Primary" Icon="checkboxes">
Expand All @@ -866,6 +867,18 @@ private void DrawerButtonClicked()
</Dropdown>
```

## Dropdown Header

```razor
<Button Id="triggerId">Open</Button>
<Dropdown Trigger="triggerId">
<DropdownHeader Label="Category"></DropdownHeader>
<DropdownItem Label="Item 1"></DropdownItem>
<DropdownItem Label="Item 2"></DropdownItem>
<DropdownItem Label="Item 3"></DropdownItem>
</Dropdown>
```

## Empty State

```razor
Expand Down
46 changes: 46 additions & 0 deletions SiemensIXBlazor.Tests/Dropdown/DropdownHeaderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// -----------------------------------------------------------------------
// 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 SiemensIXBlazor.Components;

namespace SiemensIXBlazor.Tests.Dropdown
{
public class DropdownHeaderTests : TestContextBase
{
[Fact]
public void DropdownHeaderRendersWithoutCrashing()
{
// Arrange
var cut = RenderComponent<DropdownHeader>(parameters => {
parameters.Add(p => p.Label, "testLabel");
});

// Assert
cut.MarkupMatches("<ix-dropdown-header label='testLabel'></ix-dropdown-header>");
}

[Fact]
public void DropdownHeaderRendersChildContent()
{
// Arrange
var expectedContent = "Expected content";

// Act
var cut = RenderComponent<DropdownHeader>(parameters => parameters
.Add(p => p.ChildContent, builder =>
{
builder.AddContent(0, expectedContent);
}));

// Assert
Assert.Contains(expectedContent, cut.Markup);
}
}
}
20 changes: 20 additions & 0 deletions SiemensIXBlazor/Components/Dropdown/DropdownHeader.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@* -----------------------------------------------------------------------
// 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.Components
@inherits IXBaseComponent

<ix-dropdown-header @attributes="UserAttributes"
label="@Label"
style="@Style"
class="@Class">
@ChildContent
</ix-dropdown-header>

11 changes: 11 additions & 0 deletions SiemensIXBlazor/Components/Dropdown/DropdownHeader.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Microsoft.AspNetCore.Components;

namespace SiemensIXBlazor.Components;

public partial class DropdownHeader
{
[Parameter]
public string? Label { get; set; }
[Parameter]
public RenderFragment? ChildContent { get; set; }
}
7 changes: 7 additions & 0 deletions SiemensIXBlazor/SiemensIXBlazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,11 @@
<Folder Include="Components\ActionCard\" />
</ItemGroup>

<PropertyGroup>
<IsWindows Condition="'$(OS)' == 'Windows_NT'">true</IsWindows>
</PropertyGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent" Condition="'$(IsWindows)' == 'true'">
<Exec Command="call $(SolutionDir)scripts\pre-build.bat"/>
</Target>
</Project>
126 changes: 63 additions & 63 deletions SiemensIXBlazor/SiemensIXBlazor_NpmJS/package-lock.json

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

14 changes: 7 additions & 7 deletions SiemensIXBlazor/SiemensIXBlazor_NpmJS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"author": "",
"license": "ISC",
"dependencies": {
"@ag-grid-community/core": "30.2.0",
"@siemens/ix": "2.1.2",
"@siemens/ix-aggrid": "2.1.2",
"@siemens/ix-echarts": "2.1.2",
"@siemens/ix-icons": "2.1.0",
"ag-grid-community": "30.2.0",
"echarts": "5.4.1"
"@ag-grid-community/core": "^30.2.0",
"@siemens/ix": "latest",
"@siemens/ix-aggrid": "latest",
"@siemens/ix-echarts": "latest",
"@siemens/ix-icons": "latest",
"ag-grid-community": "^30.2.0",
"echarts": "^5.4.1"
},
"devDependencies": {
"webpack": "^5.75.0",
Expand Down
2 changes: 2 additions & 0 deletions scripts/pre-build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd SiemensIXBlazor_NpmJS
npm install && npm run build

0 comments on commit 5ebd7a1

Please sign in to comment.