Skip to content

Commit

Permalink
Skins removal (HxButton, HxContextMenuItem), consolidation of HxButto…
Browse files Browse the repository at this point in the history
…n.Defaults + release 1.3.0
  • Loading branch information
hakenr committed Sep 20, 2021
1 parent 481012c commit bdf7a0c
Show file tree
Hide file tree
Showing 36 changed files with 159 additions and 860 deletions.
8 changes: 4 additions & 4 deletions BlazorAppTest/Pages/HxButtonTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<h1>HxButton</h1>

<HxButton Skin="@ButtonSkins.OK" Icon="BootstrapIcon.Bicycle" OnClick="HandleOKClick" />
<HxButton Skin="@ButtonSkins.Cancel" Size="ButtonSize.Large" OnClick="HandleCancelClick" />
<HxButton Icon="BootstrapIcon.X" Skin="@ButtonSkins.Save" />
<HxButton Skin="@ButtonSkins.Filter" />
<HxButton Text="OK" Color="ThemeColor.Primary" Icon="BootstrapIcon.Bicycle" OnClick="HandleOKClick" />
<HxButton Text="Cancel" Color="ThemeColor.Secondary" Size="ButtonSize.Large" OnClick="HandleCancelClick" />
<HxButton Icon="BootstrapIcon.X" Text="Save" Color="ThemeColor.Primary" />
<HxButton Icon="BootstrapIcon.Filter" Color="ThemeColor.Light" />

<HxButton Text="Click me..." Color="ThemeColor.Warning" />
<HxButton Text="Outline..." Color="ThemeColor.Danger" Outline="true" />
Expand Down
14 changes: 7 additions & 7 deletions BlazorAppTest/Pages/HxDialogBaseComponents/MyDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

<HxModal Title="What is on your dice?" @ref="modal">
<BodyTemplate>
<HxButton Text="1" Color="ThemeColor.Secondary" OnClick="async () => await HideAsync(1)" />
<HxButton Text="2" Color="ThemeColor.Secondary" OnClick="async () => await HideAsync(2)" />
<HxButton Text="3" Color="ThemeColor.Secondary" OnClick="async () => await HideAsync(3)" />
<HxButton Text="4" Color="ThemeColor.Secondary" OnClick="async () => await HideAsync(4)" />
<HxButton Text="5" Color="ThemeColor.Secondary" OnClick="async () => await HideAsync(5)" />
<HxButton Text="6" Color="ThemeColor.Secondary" OnClick="async () => await HideAsync(6)" />
<HxButton Text="1" Color="ThemeColor.Primary" OnClick="async () => await HideAsync(1)" />
<HxButton Text="2" Color="ThemeColor.Primary" OnClick="async () => await HideAsync(2)" />
<HxButton Text="3" Color="ThemeColor.Primary" OnClick="async () => await HideAsync(3)" />
<HxButton Text="4" Color="ThemeColor.Primary" OnClick="async () => await HideAsync(4)" />
<HxButton Text="5" Color="ThemeColor.Primary" OnClick="async () => await HideAsync(5)" />
<HxButton Text="6" Color="ThemeColor.Primary" OnClick="async () => await HideAsync(6)" />
</BodyTemplate>
<FooterTemplate>
<HxButton Skin="ButtonSkins.Close" Color="ThemeColor.Secondary" OnClick="async () => await HideAsCancelledAsync()" />
<HxButton Text="Close" Color="ThemeColor.Secondary" OnClick="async () => await HideAsCancelledAsync()" />
</FooterTemplate>
</HxModal>
2 changes: 1 addition & 1 deletion BlazorAppTest/Pages/HxFilterFormTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</HxInputText>
<HxInputNumber Label="Number 1" @bind-Value="@context.Number1" />

<HxSubmit Skin="ButtonSkins.Apply" />
<HxSubmit Text="Apply" Color="ThemeColor.Primary" />

<h2>Values</h2>

Expand Down
10 changes: 1 addition & 9 deletions BlazorAppTest/Pages/HxGridTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
</HeaderTemplate>
</HxGridColumn>
<HxGridColumn TItem="CultureInfo" HeaderText="Name" ItemTextSelector="@(item => item.Name)" SortKeySelector="@(item => item.Name)" ItemCssClassSelector="@(item => item.Name.Contains('Z') ? "text-end" : null)" />
<HxGridColumn TItem="CultureInfo" HeaderText="Order">
<ItemTemplate Context="item">
<HxButton Skin="ButtonSkins.Up" />
<HxButton Skin="ButtonSkins.Down" />
</ItemTemplate>
</HxGridColumn>
<HxGridColumn TItem="CultureInfo" HeaderText="Link">
<ItemTemplate>
<a href="https://www.havit.cz" @onclick:stopPropagation>link to a page</a> @* TODO HxLink, který bude mít default stopPropagation ??? *@
Expand All @@ -31,8 +25,6 @@
<HxContextMenuItem ConfirmationQuestion="Jako fakt?" OnClick="async () => await AlarmClicked(item)">
<HxIcon Icon="BootstrapIcon.Alarm" /> Bacha na to!
</HxContextMenuItem>
<HxContextMenuItem Skin="ContextMenuItemSkins.Delete" />

<HxContextMenuItem Enabled="false" Text="Disabled" OnClick="async () => await AlarmClicked(item)" />
<HxContextMenuItem Enabled="false" ConfirmationQuestion="Jako fakt na disabled prvku?" OnClick="async () => await AlarmClicked(item)">
<HxIcon Icon="BootstrapIcon.Alarm" /> Disabled with icon
Expand Down Expand Up @@ -62,7 +54,7 @@
<HxGridColumn TItem="CultureInfo" HeaderText="Name" ItemTextSelector="@(item => item.Name)" />
</Columns>
<EmptyDataTemplate>
<HxButton Skin="ButtonSkins.New" />
<HxButton Text="Create new item... " Color="ThemeColor.Primary" />
</EmptyDataTemplate>
</HxGrid>

Expand Down
2 changes: 1 addition & 1 deletion BlazorAppTest/Pages/HxGrid_InfiniteScroll_Test.razor
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</Columns>
<ContextMenu Context="item">
<HxContextMenu>
<HxContextMenuItem Skin="ContextMenuItemSkins.Delete" />
<HxContextMenuItem Text="Delete" Icon="BootstrapIcon.Trash" />
</HxContextMenu>
</ContextMenu>
</HxGrid>
Expand Down
6 changes: 3 additions & 3 deletions BlazorAppTest/Pages/HxListLayoutTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<h1>HxListLayout</h1>

<HxListLayout Title="Nadpis" TFilterModel="FilterModelDto" FilterModel="filterModel" FilterModelChanged="HandleFilterModelChanged">
<HxListLayout Title="Title" TFilterModel="FilterModelDto" FilterModel="filterModel" FilterModelChanged="HandleFilterModelChanged">
<NamedViewsTemplate>
<HxNamedViewList TFilterModel="FilterModelDto" FilterModel="filterModel" FilterModelChanged="HandleFilterModelChanged" NamedViews="namedViews" OnNamedViewSelected="NamedViewSelected" /> @* TODO *@
</NamedViewsTemplate>
Expand All @@ -16,7 +16,7 @@
<HxInputNumber Label="Maximum Age" @bind-Value="filterContext.MaximumAge" />
</FilterTemplate>
<CommandsTemplate>
<HxButton Text="Add" Skin="ButtonSkins.New" Icon="BootstrapIcon.Plus" OnClick="NewItemClicked" />
<HxButton Text="Add" Icon="BootstrapIcon.Plus" Color="ThemeColor.Secondary" OnClick="NewItemClicked" />
</CommandsTemplate>
<DataTemplate>
<HxGrid @ref="gridComponent" TItem="DataItemDto" PageSize="20" DataProvider="LoadDataItems" SelectedDataItem="currentItem" SelectedDataItemChanged="HandleSelectedDataItemChanged">
Expand All @@ -29,7 +29,7 @@
</Columns>
<ContextMenu Context="item">
<HxContextMenu>
<HxContextMenuItem Text="Smazat" OnClick="async () => await DeleteItemClicked(item)" ConfirmationQuestion="@($"Do you realy want to delete {item.Name}?")" />
<HxContextMenuItem Text="Delete" OnClick="async () => await DeleteItemClicked(item)" ConfirmationQuestion="@($"Do you realy want to delete {item.Name}?")" />
</HxContextMenu>
</ContextMenu>
</HxGrid>
Expand Down
2 changes: 1 addition & 1 deletion BlazorAppTest/Pages/HxListLayoutWithoutFilterTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<HxListLayout Title="Title" TFilterModel="HxListLayout.NoFilter">
<CommandsTemplate>
<HxButton Text="New invoice" Skin="ButtonSkins.New" CssClass="ms-1" OnClick="@HandleNewItemClicked" />
<HxButton Text="New invoice" Color="ThemeColor.Secondary" CssClass="ms-1" OnClick="@HandleNewItemClicked" />
</CommandsTemplate>
<DataTemplate>
<HxGrid @ref="gridComponent" TItem="DataItemDto" PageSize="20" DataProvider="LoadDataItems">
Expand Down
4 changes: 3 additions & 1 deletion BlazorAppTest/Pages/HxModalTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

<HxModal @ref="myNestedModal" />
</BodyTemplate>
<FooterTemplate><HxButton Skin="ButtonSkins.Close" OnClick="HandleHideClick" Color="ThemeColor.Primary" /></FooterTemplate>
<FooterTemplate>
<HxButton Text="Close" OnClick="HandleHideClick" Color="ThemeColor.Secondary" />
</FooterTemplate>
</HxModal>

@code
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,16 @@
<Demo Type="typeof(HxButton_Demo_Sizes)" Tabs="false" />
<Demo Type="typeof(HxButton_Demo_Sizes_Small)" Tabs="false" />

<h3>Skins</h3>
<p>Common buttons (OK, Save, Apply, Export, ...) can be defined using a skin. Skin is a shared configuration of a button defined in this library or in a custom code. Skins are localizable, embedded skins are localized (English, Czech).</p>
<p>Skins are used as readonly instances (strong-type), no string identifiers (such as SkinID in WebForms) are used.</p>
<p>See the demo on how to define custom skins. To make a skin localizable, use <code>ResourceType</code> property to set where to find the translations.</p>
<p>See <TypeLink Type="typeof(ButtonSkins)">available skins</TypeLink>.</p>
<Demo Type="typeof(HxButton_Demo_Skins)" Tabs="false" />

<h3>Custom Skins</h3>
<p>Create custom reusable skins for the button configurations you use the most often.</p>
<Demo Type="typeof(HxButton_Demo_CustomSkins)" Tabs="false" />

<h3>Spinners</h3>
<Demo Type="typeof(HxButton_Demo_BasicSpinner)" Tabs="false" />

<h5>OnValidClick with spinner</h5>
<h4>OnValidClick with spinner</h4>
<Demo Type="typeof(HxButton_Demo_OnValidClickWithSpinner)" />
<h5>Manual Spinner</h5>

<h4>Manual Spinner</h4>
<Demo Type="typeof(HxButton_Demo_ManualSpinner)" />

<h3>Spinner &amp; Single click protection</h3>
<h4>Spinner &amp; Single click protection</h4>
<HxAlert Color="ThemeColor.Warning">
EditForm's <code>OnSubmit</code> events are not captured for spinner automation. Use HxButton's <code>OnClick</code>, <code>OnValidClick</code> and <code>OnInvalidClick</code> instead.
</HxAlert>
Expand All @@ -44,9 +34,6 @@
set which would have been blocked if the button is disabled (see above).
</HxAlert>

<h3>HxSubmit</h3>
<p>There is a <code>HxSubmit</code> component (as direct ancestor of <code>HxButton</code>) which renders as <code>&lt;button type="submit"&gt;</code>. The API is the same.</p>

<h3>Button with a badge</h3>
<Demo Type="typeof(HxButton_Demo_Badge)" Tabs="false" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<HxButton Text="6" Color="ThemeColor.Secondary" OnClick="async () => await HideAsync(6)" />
</BodyTemplate>
<FooterTemplate>
<HxButton Skin="ButtonSkins.Close" Color="ThemeColor.Secondary" OnClick="async () => await HideAsCancelledAsync()" />
<HxButton Text="Close" Color="ThemeColor.Secondary" OnClick="async () => await HideAsCancelledAsync()" />
</FooterTemplate>
</HxModal>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</HxInputText>
<HxInputNumber Label="Number 1" @bind-Value="@context.Number1" />

<HxSubmit Skin="ButtonSkins.Apply" />
<HxSubmit Text="Apply" Color="ThemeColor.Primary" />

<h2>Values</h2>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
@attribute [Route("/components/" + nameof(HxFilterForm<string>))]

<ComponentApiDoc Type="typeof(HxFilterForm<>)">
<Demo Type="typeof(HxFilterForm_Demo)" />

<h3>Used in @nameof(HxListLayout)</h3>
<p>
See <a href="/components/@nameof(HxListLayout)">@nameof(HxListLayout)</a> demo with its filter and chips
to see the real usage of the <code>HxFilterForm</code>.
</p>

<h3>Standalone demo</h3>
<Demo Type="typeof(HxFilterForm_Demo)" />

</ComponentApiDoc>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<HxInputNumber Label="MinimumItemId" @bind-Value="filterContext.MinimumItemId" />
</FilterTemplate>
<CommandsTemplate>
<HxButton Text="Add an invoice" Skin="ButtonSkins.New" Icon="BootstrapIcon.Plus" CssClass="ms-1" OnClick="NewItemClicked" />
<HxButton Text="Add an invoice" Color="ThemeColor.Light" Icon="BootstrapIcon.Plus" CssClass="ms-1" OnClick="NewItemClicked" />
</CommandsTemplate>
<DataTemplate>
<HxGrid @ref="gridComponent" TItem="DataItemDto" PageSize="20" DataProvider="LoadDataItems" SelectedDataItem="currentItem" SelectedDataItemChanged="HandleSelectedDataItemChanged">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Modal body
</BodyTemplate>
<FooterTemplate>
<HxButton Skin="ButtonSkins.Close" OnClick="HandleHideClick" Color="ThemeColor.Primary" />
<HxButton Text="Close" OnClick="HandleHideClick" Color="ThemeColor.Primary" />
</FooterTemplate>
</HxModal>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Modal body
</BodyTemplate>
<FooterTemplate>
<HxButton Skin="ButtonSkins.Close" OnClick="HandleHideClick" Color="ThemeColor.Primary" />
<HxButton Text="Close" OnClick="HandleHideClick" Color="ThemeColor.Primary" />
</FooterTemplate>
</HxModal>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<p>This content should appear at the bottom after you scroll.</p>
</BodyTemplate>
<FooterTemplate>
<HxButton Skin="ButtonSkins.Close" OnClick="() => myModal.HideAsync()" Color="ThemeColor.Primary" />
<HxButton Text="Close" OnClick="() => myModal.HideAsync()" Color="ThemeColor.Primary" />
</FooterTemplate>
</HxModal>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
This is a vertically centered modal.
</BodyTemplate>
<FooterTemplate>
<HxButton Skin="ButtonSkins.Close" OnClick="() => myModal.HideAsync()" Color="ThemeColor.Primary" />
<HxButton Text="Close" OnClick="() => myModal.HideAsync()" Color="ThemeColor.Primary" />
</FooterTemplate>
</HxModal>

Expand Down
Loading

0 comments on commit bdf7a0c

Please sign in to comment.