Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7ab2d22
Add rating component
franklupo Jun 25, 2024
aaca1ed
Merge branch 'dev' into rating
vnbaaij Jun 25, 2024
9ef2f20
Fix IconVariant
franklupo Jun 25, 2024
1cebab9
Add IconColor
franklupo Jun 25, 2024
8715dd1
Merge branch 'rating' of https://github.com/franklupo/fluentui-blazor…
franklupo Jun 25, 2024
3b81877
Fix page name
franklupo Jun 25, 2024
fa89df7
Add support disabled
franklupo Jun 25, 2024
d3e007d
Add support label
franklupo Jun 25, 2024
0796e11
Remove area not overable
franklupo Jun 25, 2024
84de233
Imprve icona name
franklupo Jun 25, 2024
1cd1940
Add icon color
franklupo Jun 25, 2024
a099a81
Add support arrowup/arrowdown
franklupo Jun 25, 2024
868c559
Improve sample
franklupo Jun 25, 2024
ae7f412
Add event HoveredValueChanged
franklupo Jun 25, 2024
c3a0607
Add IconCustomColor
franklupo Jun 25, 2024
b379fd0
Fix aria-readonly
franklupo Jun 25, 2024
792ba8d
Fix LabelTemplate
franklupo Jun 25, 2024
56cee95
Improve code style
franklupo Jun 25, 2024
fd99146
Improve icon name
franklupo Jun 25, 2024
62d8475
Add IconWidth
franklupo Jun 25, 2024
833e18a
Fix label documentation
franklupo Jun 25, 2024
872de54
Fix default value
franklupo Jun 25, 2024
45e19ca
Fix HoveredValueChanged to OnPointerOver
franklupo Jun 25, 2024
3b91b0a
Add AllowReset and rewrite HandleKeyDownAsync
franklupo Jun 26, 2024
5fc5059
Add AllowReset
franklupo Jun 26, 2024
99040df
Rewrite key down event
franklupo Jun 26, 2024
111e0e4
Fix Style and Class
franklupo Jun 26, 2024
88a94e9
Component explanation
franklupo Jun 26, 2024
26a4b0f
Merge branch 'dev' into rating
vnbaaij Jun 26, 2024
6fc81f6
Merge branch 'microsoft:dev' into rating
franklupo Jun 26, 2024
37a800e
Improve code
franklupo Jun 26, 2024
dbb9479
Add Unit test
franklupo Jun 27, 2024
b7fbd45
Fix IconWidth like React Component
franklupo Jun 27, 2024
79d25d2
Merge branch 'dev' into rating
vnbaaij Jun 27, 2024
ce9637f
Merge branch 'dev' into rating
vnbaaij Jun 27, 2024
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
Prev Previous commit
Next Next commit
Improve icon name
  • Loading branch information
franklupo committed Jun 25, 2024
commit fd991469324ffe228cdcdca0f5d3485b330f6a39
Original file line number Diff line number Diff line change
Expand Up @@ -7571,12 +7571,12 @@
⚠️ Only available when Color is set to Color.Custom.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentRating.IconFull">
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentRating.IconFilled">
<summary>
Selected or hovered icon.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentRating.IconEmpty">
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentRating.IconOutline">
<summary>
Non-selected item icon.
</summary>
Expand Down
12 changes: 6 additions & 6 deletions examples/Demo/Shared/Pages/Rating/Examples/RatingExample.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<FluentRating MaxValue="@_maxValue"
Label="@_label"
@bind-Value="@_value"
IconFull="@_iconFull"
IconEmpty="@_iconEmpty"
IconFilled="@_iconFilled"
IconOutline="@_iconOutline"
ReadOnly="@_readOnly"
IconColor="@_iconColor"
Disabled="@_disabled" />
Expand All @@ -41,22 +41,22 @@
Color _iconColor = Color.Accent;
string _label;

Icon _iconFull = new Icons.Filled.Size20.Star();
Icon _iconEmpty = new Icons.Regular.Size20.Star();
Icon _iconFilled = new Icons.Filled.Size20.Star();
Icon _iconOutline = new Icons.Regular.Size20.Star();
List<string> _icons = ["Star", "Heart", "Alert", "PersonCircle"];

private void SelectedOptionChanged(string name) => SetIcon(_icons.IndexOf(name));

private void SetIcon(int index)
{
_iconFull = new Icon[]
_iconFilled = new Icon[]
{ new Icons.Filled.Size20.Star(),
new Icons.Filled.Size20.Heart(),
new Icons.Filled.Size20.Alert(),
new Icons.Filled.Size20.PersonCircle(),
}[index];

_iconEmpty = new Icon[]
_iconOutline = new Icon[]
{ new Icons.Regular.Size20.Star(),
new Icons.Regular.Size20.Heart(),
new Icons.Regular.Size20.Alert(),
Expand Down
10 changes: 5 additions & 5 deletions src/Core/Components/Rating/FluentRating.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ public partial class FluentRating : FluentInputBase<int>
public string? IconCustomColor { get; set; }

/// <summary>
/// Selected or hovered icon.
/// The icon to display when the rating value is greater than or equal to the item's value.
/// </summary>
[Parameter]
public Icon IconFull { get; set; } = new CoreIcons.Filled.Size20.Star();
public Icon IconFilled { get; set; } = new CoreIcons.Filled.Size20.Star();

/// <summary>
/// Non-selected item icon.
/// The icon to display when the rating value is less than the item's value.
/// </summary>
[Parameter]
public Icon IconEmpty { get; set; } = new CoreIcons.Regular.Size20.Star();
public Icon IconOutline { get; set; } = new CoreIcons.Regular.Size20.Star();

/// <summary>
/// Fires when hovered value changes. Value will be null if no rating item is hovered.
/// </summary>
[Parameter]
public EventCallback<int?> HoveredValueChanged { get; set; }

private Icon GetIcon(int index) => index <= (_mouseOverValue ?? Value) ? IconFull : IconEmpty;
private Icon GetIcon(int index) => index <= (_mouseOverValue ?? Value) ? IconFilled : IconOutline;

protected override bool TryParseValueFromString(string? value, [MaybeNullWhen(false)] out int result, [NotNullWhen(false)] out string?
validationErrorMessage)
Expand Down