Skip to content

Commit

Permalink
5.0.0 from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
skclusive committed Nov 10, 2020
2 parents 6e8240c + 40f79f4 commit 1029ead
Show file tree
Hide file tree
Showing 519 changed files with 14,667 additions and 7,716 deletions.
8 changes: 3 additions & 5 deletions AppBar/src/AppBar.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<VersionPrefix>2.0.1</VersionPrefix>
<VersionPrefix>5.0.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<AssemblyName>Skclusive.Material.AppBar</AssemblyName>
<PackageId>Skclusive.Material.AppBar</PackageId>
<RootNamespace>Skclusive.Material.AppBar</RootNamespace>
Expand All @@ -17,8 +16,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Core\src\Core.csproj" Version="2.0.1" />
<ProjectReference Include="..\..\Paper\src\Paper.csproj" Version="2.0.1" />
<ProjectReference Include="..\..\Paper\src\Paper.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion AppBar/src/AppBar/AppBar.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@namespace Skclusive.Material.AppBar
@inherits AppBarComponent
@inherits MaterialComponent

<Paper
RootRef="@RootRef"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace Skclusive.Material.AppBar
{
public class AppBarComponent : MaterialComponent
public partial class AppBar: MaterialComponent
{
public AppBarComponent() : base("AppBar")
public AppBar() : base("AppBar")
{
}

Expand Down
121 changes: 58 additions & 63 deletions AppBar/src/AppBar/AppBarStyle.razor
Original file line number Diff line number Diff line change
@@ -1,66 +1,61 @@
@namespace Skclusive.Material.AppBar
@inherits StyleComponentBase

<Styled
Name="AppBar">

.AppBar-Root {
width: 100%;
display: flex;
z-index: var(--theme-zindex-appbar, 1100);
box-sizing: border-box;
flex-shrink: 0;
flex-direction: column;
}

.AppBar-Position-Fixed {
top: 0;
left: auto;
right: 0;
position: fixed;
}

.AppBar-Position-Absolute {
top: 0;
left: auto;
right: 0;
position: absolute;
}

.AppBar-Position-Sticky {
top: 0;
left: auto;
right: 0;
position: sticky;
}

.AppBar-Position-Static {
position: static;
transform: translateZ(0);
}

.AppBar-Position-Relative {
position: relative;
}

.AppBar-Color-Default {
color: var(--theme-palette-grey300-contrast-text, rgba(0, 0, 0, 0.87));
background-color: var(--theme-palette-grey-background-default, #f5f5f5);
}

.AppBar-Color-Primary {
color: var(--theme-palette-primary-contrast-text, #fff);
background-color: var(--theme-palette-primary-main, #1976d2);
}

.AppBar-Color-Secondary {
color: var(--theme-palette-secondary-contrast-text, #fff);
background-color: var(--theme-palette-secondary-main, rgb(220, 0, 78));
}

.AppBar-Color-Custom {
color: var(--theme-custom-palette-primary-contrast-text, #fff);
background-color: var(--theme-custom-palette-primary-main, #1976d2);
}

</Styled>
.AppBar-Root {
width: 100%;
display: flex;
z-index: var(--theme-zindex-appbar);
box-sizing: border-box;
flex-shrink: 0;
flex-direction: column;
}

.AppBar-Position-Fixed {
top: 0;
left: auto;
right: 0;
position: fixed;
}

.AppBar-Position-Absolute {
top: 0;
left: auto;
right: 0;
position: absolute;
}

.AppBar-Position-Sticky {
top: 0;
left: auto;
right: 0;
position: sticky;
}

.AppBar-Position-Static {
position: static;
transform: translateZ(0);
}

.AppBar-Position-Relative {
position: relative;
}

.AppBar-Color-Default {
color: var(--theme-palette-grey-contrast-text-default);
background-color: var(--theme-palette-grey-background-default);
}

.AppBar-Color-Primary {
color: var(--theme-palette-primary-contrast-text);
background-color: var(--theme-palette-primary-main);
}

.AppBar-Color-Secondary {
color: var(--theme-palette-secondary-contrast-text);
background-color: var(--theme-palette-secondary-main);
}

.AppBar-Color-Custom {
color: var(--theme-custom-palette-primary-contrast-text);
background-color: var(--theme-custom-palette-primary-main);
}
18 changes: 18 additions & 0 deletions AppBar/src/Extension/AppBarExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.Extensions.DependencyInjection;
using Skclusive.Core.Component;
using Skclusive.Material.Core;
using Skclusive.Material.Paper;

namespace Skclusive.Material.AppBar
{
public static class AppBarExtension
{
public static void TryAddAppBarServices(this IServiceCollection services, IMaterialConfig config)
{
// Theme service would be added by Paper
services.TryAddPaperServices(config);

services.TryAddStyleTypeProvider<AppBarStyleProvider>();
}
}
}
11 changes: 11 additions & 0 deletions AppBar/src/Provider/AppBarStyleProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Skclusive.Core.Component;

namespace Skclusive.Material.AppBar
{
public class AppBarStyleProvider : StyleTypeProvider
{
public AppBarStyleProvider() : base(typeof(AppBarStyle))
{
}
}
}
7 changes: 3 additions & 4 deletions Avatar/src/Avatar.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<VersionPrefix>2.0.1</VersionPrefix>
<VersionPrefix>5.0.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<TargetFramework>net5.0</TargetFramework>
<AssemblyName>Skclusive.Material.Avatar</AssemblyName>
<PackageId>Skclusive.Material.Avatar</PackageId>
<RootNamespace>Skclusive.Material.Avatar</RootNamespace>
Expand All @@ -17,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Core\src\Core.csproj" Version="2.0.1" />
<ProjectReference Include="..\..\Theme\src\Theme.csproj" />
</ItemGroup>

</Project>
5 changes: 4 additions & 1 deletion Avatar/src/Avatar/Avatar.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
@namespace Skclusive.Material.Avatar
@inherits AvatarComponent
@inherits MaterialComponent

<Component
RootRef="@RootRef"
Tag="@Component"
Class="@_Class"
Style="@_Style"
OnClick="@HandleClickAsync"
OnClickStop="@OnClickStop"
OnClickPrevent="@OnClickPrevent"
@attributes="Attributes">
@if (IsImage)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace Skclusive.Material.Avatar
{
public class AvatarComponent : MaterialComponent
public partial class Avatar : MaterialComponent
{
public AvatarComponent() : base("Avatar")
public Avatar() : base("Avatar")
{
}

Expand Down Expand Up @@ -98,5 +98,10 @@ protected virtual IEnumerable<string> ImageClasses
yield return "Image";
}
}

[CascadingParameter]
public IAvatarContext AvatarContext { set; get; }

protected override IComponentContext _Context => AvatarContext;
}
}
55 changes: 25 additions & 30 deletions Avatar/src/Avatar/AvatarStyle.razor
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
@namespace Skclusive.Material.Avatar
@inherits StyleComponentBase

<Styled
Name="Avatar">
.Avatar-Root {
font-family: var(--theme-typography-font-family);
font-size: var(--theme-typography-font-size-medium);
width: 40px;
height: 40px;
display: flex;
position: relative;
overflow: hidden;
flex-shrink: 0;
align-items: center;
user-select: none;
border-radius: 50%;
line-height: 1;
justify-content: center;
}

.Avatar-Root {
font-family: var(--theme-typography-font-family, "Roboto", "Helvetica", "Arial", sans-serif);
font-size: var(--theme-typography-font-size-medium, 1.25rem);
width: 40px;
height: 40px;
display: flex;
position: relative;
overflow: hidden;
flex-shrink: 0;
align-items: center;
user-select: none;
border-radius: 50%;
line-height: 1;
justify-content: center;
}
.Avatar-Color-Default {
color: var(--theme-palette-background-default);
background-color: var(--theme-component-avatar-background);
}

.Avatar-Color-Default {
color: var(--theme-palette-background-default, #fff);
background-color: var(--theme-palette-grey, #bdbdbd);
}

.Avatar-Image {
width: 100%;
height: 100%;
text-align: center;
object-fit: cover;
}

</Styled>
.Avatar-Image {
width: 100%;
height: 100%;
text-align: center;
object-fit: cover;
}
24 changes: 24 additions & 0 deletions Avatar/src/Avatar/IAvatarContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Skclusive.Core.Component;

namespace Skclusive.Material.Avatar
{
public interface IAvatarContext : IComponentContext
{
}

public class AvatarContextBuilder : ComponentContextBuilder<AvatarContextBuilder, IAvatarContext>
{
protected class AvatarContext : ComponentContext, IAvatarContext
{
}

public AvatarContextBuilder() : base(new AvatarContext())
{
}

protected override AvatarContextBuilder This()
{
return this;
}
}
}
19 changes: 19 additions & 0 deletions Avatar/src/Extension/AvatarExtension.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.Extensions.DependencyInjection;
using Skclusive.Core.Component;
using Skclusive.Material.Core;
using Skclusive.Material.Theme;

namespace Skclusive.Material.Avatar
{
public static class AvatarExtension
{
public static void TryAddAvatarServices(this IServiceCollection services, IMaterialConfig config)
{
services.TryAddThemeServices(config);

services.TryAddStyleTypeProvider<AvatarStyleProvider>();

services.TryAddStyleProducer<AvatarStyleProducer>();
}
}
}
22 changes: 22 additions & 0 deletions Avatar/src/Producer/AvatarStyleProducer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Globalization;
using Skclusive.Core.Component;
using Skclusive.Material.Theme;

namespace Skclusive.Material.Avatar
{
public class AvatarStyleProducer : IStyleProducer
{
public IDictionary<string, string> Variables(ThemeValue theme)
{
var isDark = theme.IsDark();

var palette = theme.Palette;

return new Dictionary<string, string>
{
{ "--theme-component-avatar-background", (isDark ? palette.Grey.X600 : palette.Grey.X400).ToString(CultureInfo.InvariantCulture) }
};
}
}
}
Loading

0 comments on commit 1029ead

Please sign in to comment.