Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions browser/IgBlazorSamples.Gulp/tasks/Transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,23 +1218,23 @@ class PackageDependency {

// used in updateCodeViewer script to serialize JSON files
class CodeViewer {
public path: string;
public hasRelativeAssetsUrls: Boolean;
public content: string;
public isMain: Boolean;
public fileExtension: string;
public fileHeader: string;
public path: string;
public content: string;

constructor(filePath: string, content: string, fileExtension: string, fileHeader: string, isMain: Boolean) {

var jsonContent = content;
// jsonContent = jsonContent.replace(/\/\//g, "/");

this.hasRelativeAssetsUrls = false;
this.path = filePath;
this.content = jsonContent;
this.isMain = isMain;
this.fileExtension = fileExtension;
this.fileHeader = fileHeader;
this.path = filePath;
this.content = jsonContent;
}
}
33 changes: 27 additions & 6 deletions browser/IgBlazorSamples.Gulp/tasks/gulp-samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ var sampleSource = [

// igConfig.SamplesCopyPath + '/excel/spreadsheet/**/App.razor',
// igConfig.SamplesCopyPath + '/gauges/bullet-graph/animation/App.razor',
// igConfig.SamplesCopyPath + '/charts/data-chart/data-annotation-multiple-with-stocks/App.razor',
// igConfig.SamplesCopyPath + '/grids/**/binding-live-data/App.razor',
// igConfig.SamplesCopyPath + '/grids/**/overview/App.razor',
// igConfig.SamplesCopyPath + '/grids/**/column-types/App.razor',
Expand Down Expand Up @@ -1105,10 +1106,11 @@ function updateCodeViewer(cb) {
// path = path.replace("/", "-");

var codeViewPath = "../IgBlazorSamples.Client/wwwroot/code-viewer" + path + ".json";
// log("generating " + codeViewPath);
log("generating " + codeViewPath);

var content = "{\r\n \"sampleFiles\":\r\n";
var contentItems = [];
var dataFiles = [];

for (const file of sample.SourceFiles) {
// console.log("SourceFiles " + file.Name);
Expand All @@ -1131,23 +1133,42 @@ function updateCodeViewer(cb) {
//code = code.replace(/\n\n/gm, '\n');
var item = new CodeViewer(file.Path, code, "razor", "razor", true);
contentItems.push(item);
}
else if (file.isProgramCS()) {

} else if (file.isProgramCS()) {
var item = new CodeViewer(file.Path, file.Content, "cs", "MODULES", true);
contentItems.push(item);
}
else if (file.isCS()) {

} else if (file.isCS()) {
var name = file.Name.toLowerCase();
var header = "DATA";
if (sample.DataFilesCount > 1) {
var isGenerator = name.indexOf("generator") >= 0;
header = isGenerator ? "DATA GENERATOR" : "DATA SOURCE";
}
var item = new CodeViewer(file.Path, file.Content, "cs", header, true);
contentItems.push(item);
// contentItems.push(item);
dataFiles.push(item);
}
}

if (dataFiles.length === 1) {
contentItems.push(dataFiles[0]);
} else if (dataFiles.length > 1) {
// combining multiple data files into one data source
var dataPath = dataFiles[0].path;
var dataFolder = dataPath.substring(0, dataPath.lastIndexOf("/"));
var dataContent = "// NOTE this file contains multiple data sources:\r\n";

for (let i = 0; i < dataFiles.length; i++) {
const data = dataFiles[i];
dataContent += "\r\n\r\n" + "// Data Source #" + (i+1) + "\r\n";
dataContent += data.content + "\r\n";
}

var dataItem = new CodeViewer(dataFolder + "/DataSources.cs", dataContent, "cs", "DATA", true);
contentItems.push(dataItem);
}

if (sample.PublicFiles_JS.length > 0) {
for(const file of sample.PublicFiles_JS) {
var item = new CodeViewer(file.Path, file.Content, "js", "js", true);
Expand Down
18 changes: 18 additions & 0 deletions samples/layouts/avatar/styling/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@using IgniteUI.Blazor.Controls


<div class="container horizontal" style="gap: 10px;">
<IgbAvatar
src="https://static.infragistics.com/xplatform/images/people/men/1.jpg"
alt="A photo of a man."
className='size-large'/>

<div className="sizes">
<IgbAvatar Initials="L" class="size-large" />
<IgbAvatar Initials="M" class="size-medium" />
<IgbAvatar Initials="S" class="size-small" />
</div>
</div>
@code {

}
25 changes: 25 additions & 0 deletions samples/layouts/avatar/styling/BlazorClientApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<AssemblyName>Infragistics.Samples</AssemblyName>
<RootNamespace>Infragistics.Samples</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702,IDE0028,BL0005,0219,CS1998</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IgniteUI.Blazor" Version="24.2.85" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.0" />
<PackageReference Include="System.Net.Http.Json" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions samples/layouts/avatar/styling/BlazorClientApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorClientApp", "BlazorClientApp.csproj", "{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC52AAC8-4488-40AE-9621-75F6BA744B18}
EndGlobalSection
EndGlobal
28 changes: 28 additions & 0 deletions samples/layouts/avatar/styling/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using IgniteUI.Blazor.Controls; // for registering Ignite UI modules

namespace Infragistics.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// registering Ignite UI modules
builder.Services.AddIgniteUIBlazor(
typeof(IgbAvatarModule)
);
await builder.Build().RunAsync();
}
}
}
27 changes: 27 additions & 0 deletions samples/layouts/avatar/styling/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4200",
"sslPort": 44385
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorClientApp": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:4200"
}
}
}
70 changes: 70 additions & 0 deletions samples/layouts/avatar/styling/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!-- NOTE: do not change this file because it's auto re-generated from template: -->
<!-- https://github.com/IgniteUI/igniteui-blazor-examples/tree/vnext/templates/sample/ReadMe.md -->

This folder contains implementation of Blazor application with example of Styling feature using [Avatar](https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/general-getting-started.html) component.


<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body>
<!-- https://static.infragistics.com/xplatform/images/browsers -->
<a target="_blank" href="https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/general-getting-started.html" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-docs.png"/>
</a>
<a target="_blank" href="./App.razor" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-code.png"/>
</a>
<a target="_blank" href="https://infragistics.com/blazor-client/samples/layouts/avatar/styling" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-run.png"/>
</a>
<!-- <a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-blazor-examples/tree/master/samples/layouts/avatar/styling?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/App.razor" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://github.com/IgniteUI/igniteui-blazor-examples/raw/vnext/templates/sample/images/button-sandbox.png"/>
</a> -->
</body>
</html>

## Branches

> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-blazor-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-blazor-examples/tree/vnext) branch only when you want to contribute new samples to this repository.

## Setup

- instal **.NET SDK** from this [website](https://dotnet.microsoft.com/learn/aspnet/blazor-tutorial/install)

## Running App in Visual Studio 2019

NOTE: VS 2019 has better code highlighting and error detection than VS Code does.

- open **Visual Studio 2019** as an administrator

- open the **BlazorClientApp.sln** solution

- right click solution and select **Restore NuGet Packages** menu item

- click **Debug** menu and select **Start Debugging** or press **F5** key


## Running App in VS Code

- open **VS Code** as an administrator

- open this folder in **VS Code**

- open a terminal window

- to restore assemblies, run this command:
```dotnet restore```

- to run samples, run this command:
```dotnet watch run```

- wait for for message:
**Now listening on: http://localhost:4200**

- open **http://localhost:4200** in your browser


## Resources

- [Razor Component Models](https://www.codemag.com/article/1911052)
- [Razor Syntax](https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-3.1#razor-syntax)
- [Getting reference to components](https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-3.1#capture-references-to-components)
8 changes: 8 additions & 0 deletions samples/layouts/avatar/styling/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using Infragistics.Samples
52 changes: 52 additions & 0 deletions samples/layouts/avatar/styling/wwwroot/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
CSS styles are loaded from the shared CSS file located at:
https://static.infragistics.com/xplatform/css/samples/
*/
.sizes .size-small {
--ig-size: var(--ig-size-small);
}

.sizes .size-medium {
--ig-size: var(--ig-size-medium);
}

.sizes .size-large,
.size-large {
--ig-size: var(--ig-size-large);
}

.container {
display: flex;
flex-direction: row;
justify-content: space-around;
gap: 10px;
margin-top: 20px;
}

.sizes {
display: flex;
flex-direction: row;
gap: 10px;
}

igc-avatar::part(base) {
background: var(--ig-success-100);
border: 2px solid var(--ig-error-500);
}

igc-avatar::part(initials) {
color: var(--ig-success-500-contrast);
background: var(--ig-error-500);
padding: 5px 10px;
margin: 10px;
border-radius: 50px;
/* border: 1px solid greenyellow; */
}

igc-avatar::part(image) {
border-radius: 20px;
padding: 5px;
border: 2px solid var(--ig-primary-500);
}


32 changes: 32 additions & 0 deletions samples/layouts/avatar/styling/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="description" content="Explore samples of IgniteUI for Blazor components.">
<meta name="keywords" content="Sample, Example, Blazor, IgniteUI for Blazor, Components, Infragistics">
<meta name="author" content="Infragistics">
<title>Samples | IgniteUI for Blazor | Infragistics</title>
<base href="/" />
<link href="https://static.infragistics.com/xplatform/images/browsers/blazor.ico" rel="icon" type="image/x-icon">
<link href="https://static.infragistics.com/xplatform/css/samples/shared.v6.css" rel="stylesheet" />
<link href="https://static.infragistics.com/xplatform/css/samples/blazor.css" rel="stylesheet" />
<link href="_content/IgniteUI.Blazor/themes/light/bootstrap.css" rel="stylesheet" />
<link href="index.css" rel="stylesheet" />
</head>

<body>
<app class="app"><img class="app-loading" src="https://static.infragistics.com/xplatform/images/browsers/loading.gif" /></app>
<div class="app-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="app-error-dismiss">🗙</a>
</div>
<!-- importing blazor bundle for IG controls: -->
<script src="_content/IgniteUI.Blazor/app.bundle.js"></script>
<script src="_framework/blazor.webassembly.js"></script>

</body>

</html>
Loading
Loading