-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AathifMahir/initial
Initial Preview Release of Bridge
- Loading branch information
Showing
100 changed files
with
1,064 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,132 @@ | ||
# MauiBlazorBridge | ||
# MauiBlazorBridge | ||
|
||
MauiBlazorBridge is a Helper Utitlity That Makes Easier for Maui Blazor Hybrid Developers to Seamlessly Detect Platform, FormFactor and Etc.. | ||
|
||
|**Latest Stable** | **Latest Preview**| | ||
| :---: | :---: | | ||
|[![AathifMahir.Maui.MauiShakeDetector](https://img.shields.io/nuget/v/AathifMahir.MauiBlazor.MauiBlazorBridge)](https://www.nuget.org/packages/AathifMahir.MauiBlazor.MauiBlazorBridge/) | [![AathifMahir.Maui.MauiShakeDetector](https://img.shields.io/nuget/vpre/AathifMahir.MauiBlazor.MauiBlazorBridge)](https://nuget.org/packages/AathifMahir.MauiBlazor.MauiBlazorBridge/absoluteLatest) | | ||
|
||
# Get Started | ||
|
||
**1.** In order to use the **MauiBlazorHybrid** you need to call the extension method in your **Program.cs** file as follows: | ||
|
||
```csharp | ||
builder.Services.AddMauiBlazorBridge(); | ||
``` | ||
|
||
**2.** In the `_imports.razor` file, you need to import the namespace as follows: | ||
|
||
```razor | ||
@using MauiBlazorBridge | ||
``` | ||
|
||
**3.** In `MainLayout.razor` file, you need to add `BridgeProvider` to Initialize the Bridge. Additionally Setting `GlobalListener` Property to True Makes Bridge to Listen to FormFactor Changes Globaly Instead of Creating and Disposing Listener During the Usage of `BridgeFormFactor` Component | ||
|
||
```html | ||
@inherits LayoutComponentBase | ||
<div class="page"> | ||
<div class="sidebar"> | ||
<NavMenu /> | ||
</div> | ||
|
||
<main> | ||
<article class="content px-4"> | ||
@Body | ||
</article> | ||
<!-- Add BridgeProvider --> | ||
<BridgeProvider/> | ||
</main> | ||
</div> | ||
``` | ||
|
||
**Disclaimer:** When it comes PreRendering Enabled Blazor Flavor, You don't need to add `BridgeProvider` in `MainLayout.razor` file, Instead you need to add `BridgeProvider` in all the different Blazor Components that Utilizes Bridge. Additionally you need to Enable Interactivity for that Specific Component or Page | ||
|
||
# Usage | ||
|
||
```html | ||
@inject IBridge Bridge | ||
|
||
<BridgeFormFactor> | ||
<Mobile> | ||
<h3>FormFactor : Mobile</h3> | ||
</Mobile> | ||
<Tablet> | ||
<h3>FormFactor : Tablet</h3> | ||
</Tablet> | ||
<Desktop> | ||
<h3>FormFactor : Desktop</h3> | ||
</Desktop> | ||
<Default> | ||
<h3>FormFactor : Unknown</h3> | ||
</Default> | ||
</BridgeFormFactor> | ||
|
||
<h3>Platform : @Bridge.Platform</h3> | ||
<h3>Platform Version : @Bridge.PlatformVersion</h3> | ||
<h3>FrameWork : @Bridge.Framework</h3> | ||
``` | ||
|
||
# Components | ||
|
||
### BridgeFormFactor | ||
|
||
```html | ||
<BridgeFormFactor> | ||
<Mobile> | ||
<h3>FormFactor : Mobile</h3> | ||
</Mobile> | ||
<Tablet> | ||
<h3>FormFactor : Tablet</h3> | ||
</Tablet> | ||
<Desktop> | ||
<h3>FormFactor : Desktop</h3> | ||
</Desktop> | ||
<Default> | ||
<h3>FormFactor : Unknown</h3> | ||
</Default> | ||
</BridgeFormFactor> | ||
``` | ||
|
||
### BridgePlatform | ||
|
||
```html | ||
<BridgePlatform> | ||
<Android> | ||
<h3>Platform : Android</h3> | ||
</Android> | ||
<IOS> | ||
<h3>Platform : iOS</h3> | ||
</IOS> | ||
<Windows> | ||
<h3>Platform : Windows</h3> | ||
</Windows> | ||
<Mac> | ||
<h3>Platform : MacCatalyst</h3> | ||
</Mac> | ||
<Default> | ||
<h3>Platform : Unknown</h3> | ||
</Default> | ||
</BridgePlatform> | ||
``` | ||
|
||
### BridgeFramework | ||
|
||
```html | ||
<BridgeFramework> | ||
<Maui> | ||
<h3>Framework : Maui</h3> | ||
</Maui> | ||
<Blazor> | ||
<h3>Framework : Blazor</h3> | ||
</Blazor> | ||
</BridgeFramework> | ||
``` | ||
|
||
# Note | ||
|
||
The Documentation is Under Construction, More Features and Components will be Added Soon. | ||
|
||
# License | ||
|
||
MauiBlazorBridge is licensed under the **MIT** license | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 9 additions & 8 deletions
17
sample/MauiBlazorBridge.Blazor.Sample/Pages/BridgePage.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
@page "/bridge" | ||
@inject IBridge Bridge | ||
|
||
<BridgeIdiom> | ||
<BridgeFormFactor> | ||
<Mobile> | ||
<h3>Current Idiom : Mobile</h3> | ||
<h3>FormFactor : Mobile</h3> | ||
</Mobile> | ||
<Tablet> | ||
<h3>Current Idiom : Tablet</h3> | ||
<h3>FormFactor : Tablet</h3> | ||
</Tablet> | ||
<Desktop> | ||
<h3>Current Idiom : Desktop</h3> | ||
<h3>FormFactor : Desktop</h3> | ||
</Desktop> | ||
<Default> | ||
<h3>Current Idiom : Unknown</h3> | ||
<h3>FormFactor : Unknown</h3> | ||
</Default> | ||
</BridgeIdiom> | ||
</BridgeFormFactor> | ||
|
||
<h3>Current Platform : @Bridge.Platform</h3> | ||
<h3>Current FrameWork : @Bridge.Framework</h3> | ||
<h3>Platform : @Bridge.Platform</h3> | ||
<h3>Platform Version : @Bridge.PlatformVersion</h3> | ||
<h3>FrameWork : @Bridge.Framework</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
sample/MauiBlazorBridge.Blazor.Server.Sample/Components/App.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<base href="/" /> | ||
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" /> | ||
<link rel="stylesheet" href="app.css" /> | ||
<link rel="stylesheet" href="MauiBlazorBridge.Blazor.Server.Sample.styles.css" /> | ||
<link rel="icon" type="image/png" href="favicon.png" /> | ||
<HeadOutlet /> | ||
</head> | ||
|
||
<body> | ||
<Routes/> | ||
<script src="_framework/blazor.web.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 13 additions & 17 deletions
30
...ed.Sample/Components/Layout/NavMenu.razor → ...er.Sample/Components/Layout/NavMenu.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,35 @@ | ||
<div class="top-row ps-3 navbar navbar-dark"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand" href="">MauiBlazorBridge.SingleProject.Sample</a> | ||
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<a class="navbar-brand" href="">MauiBlazorBridge.Blazor.Server.Sample</a> | ||
</div> | ||
</div> | ||
|
||
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu"> | ||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" /> | ||
|
||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()"> | ||
<nav class="flex-column"> | ||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> | ||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home | ||
</NavLink> | ||
</div> | ||
|
||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="bridge"> | ||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Bridge | ||
<NavLink class="nav-link" href="counter"> | ||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter | ||
</NavLink> | ||
</div> | ||
|
||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="weather"> | ||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather | ||
</NavLink> | ||
</div> | ||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="bridge"> | ||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Bridge | ||
</NavLink> | ||
</div> | ||
</nav> | ||
</div> | ||
|
||
@code { | ||
private bool collapseNavMenu = true; | ||
|
||
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; | ||
|
||
private void ToggleNavMenu() | ||
{ | ||
collapseNavMenu = !collapseNavMenu; | ||
} | ||
} |
Oops, something went wrong.