Skip to content

Commit

Permalink
Update to v2.2.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisu-Woniu committed May 15, 2022
1 parent dd9246a commit a120a23
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 64 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Supports both Blazor WebAssembly and Blazor Server.

## Getting started

To start, install it from NuGet.
To start, install it from NuGet:

[![Nuget GiscusBlazor](https://img.shields.io/nuget/v/GiscusBlazor.svg)](https://www.nuget.org/packages/GiscusBlazor/)

Expand All @@ -27,13 +27,13 @@ You might need to fix the version when publish your website. For example:

```html
<!-- Use jsDelivr, recommended -->
<script type="module" src="https://cdn.jsdelivr.net/npm/giscus@0.0.9/+esm"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/giscus@1.0.3/+esm"></script>

<!-- or unpkg -->
<script type="module" src="https://unpkg.com/giscus@0.0.9?module"></script>
<script type="module" src="https://unpkg.com/giscus@1.0.3?module"></script>

<!-- or Skypack -->
<script type="module" src="https://cdn.skypack.dev/giscus@0.0.9"></script>
<script type="module" src="https://cdn.skypack.dev/giscus@1.0.3"></script>
```

Then add this component to your `.razor` files where you want the comments to appear like this:
Expand All @@ -53,9 +53,21 @@ Then add this component to your `.razor` files where you want the comments to ap
EmitMetadata="false"
InputPosition="InputPosition.Bottom"
Theme="light"
Lang="en" />
Lang="en"
LazyLoading="true" />
```

Or you can just add `@using GiscusBlazor` to `_imports`
Or you can just add `@using GiscusBlazor` to `_Imports.razor`.

Most of the parameters can be found from the [giscus official site](https://giscus.app/).
Most of the parameters’ information can be found from the [giscus official site](https://giscus.app/).

## Samples

You can get some sample apps from the [samples](samples) directory, in both Blazor WebAssembly and Blazor Server.

## Changelog

### v2.2.1

- Add support for lazy-loading (see [giscus official site](https://giscus.app/)).
- Removed support for .NET 5.0, which is now [out of support](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core#lifecycle).
3 changes: 2 additions & 1 deletion samples/BlazorServerDemo/Pages/Counter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
EmitMetadata="false"
InputPosition="InputPosition.Bottom"
Theme="light"
Lang="en" />
Lang="en"
LazyLoading="true" />

@code {
private int currentCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorServerDemo/Pages/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link href="css/site.css" rel="stylesheet" />
<link href="BlazorServerDemo.styles.css" rel="stylesheet" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
<script type="module" src="https://unpkg.com/giscus?module"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/giscus/+esm"></script>
</head>
<body>
@RenderBody()
Expand Down
1 change: 1 addition & 0 deletions samples/BlazorWebAssemblyDemo/BlazorWebAssemblyDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion samples/BlazorWebAssemblyDemo/Pages/Counter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
EmitMetadata="false"
InputPosition="InputPosition.Bottom"
Theme="light"
Lang="en"/>
Lang="en"
LazyLoading="true" />

@code {
private int currentCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion samples/BlazorWebAssemblyDemo/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
<link href="BlazorWebAssemblyDemo.styles.css" rel="stylesheet" />
<script type="module" src="https://unpkg.com/giscus?module"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/giscus/+esm"></script>
</head>

<body>
Expand Down
24 changes: 12 additions & 12 deletions src/GiscusBlazor/Giscus.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<giscus-widget
repo="@Repo"
repoid="@RepoId"
category="@Category"
categoryid="@CategoryId"
mapping="@Mapping.ToMappingString()"
term="@Term"
reactionsenabled="@(ReactionsEnabled ? "1" : "0")"
emitmetadata="@(EmitMetadata ? "1" : "0")"
inputposition="@InputPosition"
theme="@Theme"
lang="@Lang">
<giscus-widget repo="@Repo"
repoid="@RepoId"
category="@Category"
categoryid="@CategoryId"
mapping="@Mapping.ToMappingString()"
term="@Term"
reactionsenabled="@(ReactionsEnabled ? "1" : "0")"
emitmetadata="@(EmitMetadata ? "1" : "0")"
inputposition="@InputPosition"
theme="@Theme"
lang="@Lang"
loading="@(LazyLoading ? "lazy" : "")">
</giscus-widget>
3 changes: 3 additions & 0 deletions src/GiscusBlazor/Giscus.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@ public partial class Giscus

[Parameter]
public string? Lang { get; set; }

[Parameter]
public bool LazyLoading { get; set; }
}
}
82 changes: 41 additions & 41 deletions src/GiscusBlazor/GiscusBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/Jisu-Woniu/giscus-blazor</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<Version>2.2.0</Version>
<Description>A Blazor component to embed giscus, a comments system powered by GitHub Discussions.</Description>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>


<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.*" />
</ItemGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<PropertyGroup>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/Jisu-Woniu/giscus-blazor</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<Version>2.2.1</Version>
<Description>A Blazor component to embed giscus, a comments system powered by GitHub Discussions.</Description>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<PackageReleaseNotes>Add support for lazy-loading parameter</PackageReleaseNotes>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>latest-recommended</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>


<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.*" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.*" />
</ItemGroup>

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

</Project>

0 comments on commit a120a23

Please sign in to comment.