Browse Source

Update documentation for Desktop and Mobile toolbar

pull/22218/head
liangshiwei 12 months ago
parent
commit
e6916701dc
  1. 16
      docs/en/framework/ui/blazor/toolbars.md
  2. 16
      docs/en/framework/ui/mvc-razor-pages/toolbars.md
  3. BIN
      docs/en/images/leptonx-toolbar-main-example.png
  4. BIN
      docs/en/images/leptonx-toolbar-mainmobile-example.png
  5. 26
      docs/en/ui-themes/lepton-x/mvc.md

16
docs/en/framework/ui/blazor/toolbars.md

@ -8,13 +8,25 @@ There is only one **standard toolbar** named "Main" (defined as a constant: `Sta
In the screenshot above, there are two items added to the main toolbar: Language switch component & user menu. You can add your own items here.
Also, [LeptonX Lite Theme](../../../ui-themes/lepton-x-lite/blazor.md) has 2 different toolbars for desktop and mobile views which defined as constants: `LeptonXLiteToolbars.Main`, `LeptonXLiteToolbars.MainMobile`.
Also, [LeptonX Lite Theme](../../../ui-themes/lepton-x-lite/blazor.md) and [LeptonX Theme](../../../ui-themes/lepton-x/blazor.md) has 2 different toolbars for desktop and mobile views which defined as constants.
**LeptonX Lite Theme**
- `LeptonXLiteToolbars.Main`
- `LeptonXLiteToolbars.MainMobile`
| LeptonXLiteToolbars.Main | LeptonXLiteToolbars.MainMobile |
| :---: | :---: |
| ![leptonx](../../../images/leptonxlite-toolbar-main-example.png) | ![leptonx](../../../images/leptonxlite-toolbar-mainmobile-example.png) |
Also, [LeptonX Theme](../../../ui-themes/lepton-x/blazor.md) has 2 different toolbars for desktop and mobile views which defined as constants: `LeptonXToolbars.Main`, `LeptonXToolbars.MainMobile`.
**LeptonX Theme**
- `LeptonXToolbars.Main`
- `LeptonXToolbars.MainMobile`
| LeptonXToolbars.Main | LeptonXToolbars.MainMobile |
| :---: | :---: |
| ![leptonx](../../../images/leptonx-toolbar-main-example.png) | ![leptonx](../../../images/leptonx-toolbar-mainmobile-example.png) |
## Example: Add a Notification Icon

16
docs/en/framework/ui/mvc-razor-pages/toolbars.md

@ -8,12 +8,26 @@ There is only one **standard toolbar** named "Main" (defined as a constant: `Sta
In the screenshot above, there are two items added to the main toolbar: Language switch component & user menu. You can add your own items here.
Also, [LeptonX Lite Theme](../../../ui-themes/lepton-x-lite/asp-net-core.md) has 2 different toolbars for desktop and mobile views which defined as constants: `LeptonXLiteToolbars.Main`, `LeptonXLiteToolbars.MainMobile`.
Also, [LeptonX Lite Theme](../../../ui-themes/lepton-x-lite/asp-net-core.md) and [LeptonX Theme](../../../ui-themes/lepton-x/mvc.md) has 2 different toolbars for desktop and mobile views which defined as constants.
**LeptonX Lite Theme**
- `LeptonXLiteToolbars.Main`
- `LeptonXLiteToolbars.MainMobile`
| LeptonXLiteToolbars.Main | LeptonXLiteToolbars.MainMobile |
| :---: | :---: |
| ![leptonx](../../../images/leptonxlite-toolbar-main-example.png) | ![leptonx](../../../images/leptonxlite-toolbar-mainmobile-example.png) |
**LeptonX Theme**
- `LeptonXToolbars.Main`
- `LeptonXToolbars.MainMobile`
| LeptonXToolbars.Main | LeptonXToolbars.MainMobile |
| :---: | :---: |
| ![leptonx](../../../images/leptonx-toolbar-main-example.png) | ![leptonx](../../../images/leptonx-toolbar-mainmobile-example.png) |
## Example: Add a Notification Icon
In this example, we will add a **notification (bell) icon** to the left of the language switch item. A item in the toolbar should be a **view component**. So, first, create a new view component in your project:

BIN
docs/en/images/leptonx-toolbar-main-example.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

BIN
docs/en/images/leptonx-toolbar-mainmobile-example.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

26
docs/en/ui-themes/lepton-x/mvc.md

@ -81,8 +81,32 @@ Configure<LeptonXThemeOptions>(options =>
>
> If your layout is **TopMenu**, then you have to add them under the **wwwroot/Themes/LeptonX/Global/top-menu/css/** folder.
### Toolbars
LeptonX includes separeted toolbars for desktop & mobile. You can manage toolbars independently. Toolbar names can be accessible in the **LeptonXToolbars** class.
- `LeptonXToolbars.Main`
- `LeptonXToolbars.MainMobile`
```csharp
public async Task ConfigureToolbarAsync(IToolbarConfigurationContext context)
{
if (context.Toolbar.Name == LeptonXToolbars.Main)
{
context.Toolbar.Items.Add(new ToolbarItem(typeof(MyDesktopComponent)));
}
if (context.Toolbar.Name == LeptonXToolbars.MainMobile)
{
context.Toolbar.Items.Add(new ToolbarItem(typeof(MyMobileComponent)));
}
return Task.CompletedTask;
}
```
> _You can visit the [Toolbars Documentation](../../framework/ui/mvc-razor-pages/toolbars.md) for better understanding._
#### Handling Style Changes
You can add extra logic by using javascript API when style is changed with the following event.
```js

Loading…
Cancel
Save