Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Card component #39

Merged
merged 3 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public partial class Index
- [Blind](#blind)
- [Breadcrumb](#breadcrumb)
- [Button](#button)
- [Card](#card)
- [Card List](#card-list) **(since v0.3.3)**
- [Push Card](#push-card) **(since v0.3.3)**
- [Action Card](#action-card) **(since v0.3.3)**
Expand Down Expand Up @@ -418,6 +419,21 @@ Test content
<Button>Test Button</Button>
```

## Card

```razor
<Card Id="card-1" Variant="CardVariant.info">
<ix-icon name="capacity"></ix-icon>
<ix-typography bold>Number of components</ix-typography>
<ix-typography>
Item 1<br />
Item 2<br />
Item 3
</ix-typography>
<ix-typography format="h1">3</ix-typography>
</Card>
```

## Card List

```razor
Expand Down
14 changes: 14 additions & 0 deletions SiemensIXBlazor/Components/Card/Card.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@namespace SiemensIXBlazor.Components
@inherits IXBaseComponent
@using SiemensIXBlazor.Helpers

<ix-card @attributes="UserAttributes"
id=@Id
class=@Class
style=@Style
variant=@Variant
selected=@Selected>
<ix-card-content>
@ChildContent
</ix-card-content>
</ix-card>
17 changes: 17 additions & 0 deletions SiemensIXBlazor/Components/Card/Card.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Components;
using SiemensIXBlazor.Enums;

namespace SiemensIXBlazor.Components
{
public partial class Card
{
[Parameter, EditorRequired]
public string Id { get; set; } = string.Empty;
Copy link
Contributor

@yagizhanNY yagizhanNY Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The card component doesn't have an event, so the id property isn't required.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I removed the Id property.

[Parameter]
public bool? Selected { get; set; }
[Parameter]
public CardVariant Variant { get; set; } = CardVariant.insight;
[Parameter]
public RenderFragment? ChildContent { get; set; }
}
}
16 changes: 16 additions & 0 deletions SiemensIXBlazor/Enums/Card/CardVariant.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

namespace SiemensIXBlazor.Enums
{
public enum CardVariant
{
alarm,
critical,
info,
insight,
neutral,
notification,
primary,
success,
warning
}
}