Skip to content
This repository was archived by the owner on Oct 3, 2022. It is now read-only.

Commit dd44b3d

Browse files
committed
Add project files.
1 parent 73d9d87 commit dd44b3d

File tree

3 files changed

+203
-0
lines changed

3 files changed

+203
-0
lines changed

MudBlazor.MudScrollbar.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32922.545
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MudBlazor.MudScrollbar", "MudBlazor.MudScrollbar\MudBlazor.MudScrollbar.csproj", "{3CE7875B-EA62-4660-85F8-8EC00137AAE5}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{3CE7875B-EA62-4660-85F8-8EC00137AAE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{3CE7875B-EA62-4660-85F8-8EC00137AAE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{3CE7875B-EA62-4660-85F8-8EC00137AAE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{3CE7875B-EA62-4660-85F8-8EC00137AAE5}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {8CB8D11B-DE3C-4F4B-9B83-E7219565DC8F}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
@namespace MudBlazor.MudScrollbar
2+
@inherits MudComponentBase
3+
@using MudBlazor.Extensions
4+
5+
@code{
6+
7+
/// <summary>
8+
/// Supports id and class selection. Use "#idName" for id selectors (ex. <Component id="idName" />) or ".idName" for class selectors (ex. <Component Class="idName" />). Leave it null or empty to effect all scrollbars.
9+
/// </summary>
10+
[Parameter]
11+
[Category(CategoryTypes.Item.Behavior)]
12+
public string Selector { get; set; }
13+
14+
/// <summary>
15+
/// Firefox ignores the other parameters. It can be only done with this parameter.
16+
/// </summary>
17+
[Parameter]
18+
[Category(CategoryTypes.Item.Appearance)]
19+
public string FirefoxStyle { get; set; }
20+
21+
/// <summary>
22+
/// Custom thumb styles for scrollbar. Must end with ";" character for each style. Doesn't support by firefox (see FirefoxStyle).
23+
/// </summary>
24+
[Parameter]
25+
[Category(CategoryTypes.Item.Appearance)]
26+
public string ThumbStyle { get; set; }
27+
28+
/// <summary>
29+
/// Custom track styles for scrollbar. Must end with ";" character for each style. Doesn't support by firefox (see FirefoxStyle).
30+
/// </summary>
31+
[Parameter]
32+
[Category(CategoryTypes.Item.Appearance)]
33+
public string TrackStyle { get; set; }
34+
35+
/// <summary>
36+
/// Width of both scrollbar thumb and track. Doesn't support by firefox (see FirefoxStyle).
37+
/// </summary>
38+
[Parameter]
39+
[Category(CategoryTypes.Item.Appearance)]
40+
public int Width { get; set; }
41+
42+
/// <summary>
43+
/// Width of both scrollbar thumb and track on hover. Doesn't support by firefox (see FirefoxStyle).
44+
/// </summary>
45+
[Parameter]
46+
[Category(CategoryTypes.Item.Appearance)]
47+
public int? HoverWidth { get; set; }
48+
49+
/// <summary>
50+
/// Border radius for scrollbar thumb. Doesn't support by firefox (see FirefoxStyle).
51+
/// </summary>
52+
[Parameter]
53+
[Category(CategoryTypes.Item.Appearance)]
54+
public int BorderRadius { get; set; }
55+
56+
/// <summary>
57+
/// Border radius for scrollbar thumb. Supports hex values, color names and MudTheme color keywords (ex. "primary", "secondary"). Doesn't support by firefox (see FirefoxStyle).
58+
/// </summary>
59+
[Parameter]
60+
[Category(CategoryTypes.Item.Appearance)]
61+
public string Color { get; set; }
62+
63+
/// <summary>
64+
/// Border radius for scrollbar thumb on hover. Supports hex values, color names and MudTheme color keywords (ex. "primary", "secondary"). Doesn't support by firefox (see FirefoxStyle).
65+
/// </summary>
66+
[Parameter]
67+
[Category(CategoryTypes.Item.Appearance)]
68+
public string HoverColor { get; set; }
69+
70+
/// <summary>
71+
/// Border radius for scrollbar track. Supports hex values, color names and MudTheme color keywords (ex. "primary", "secondary"). Doesn't support by firefox (see FirefoxStyle).
72+
/// </summary>
73+
[Parameter]
74+
[Category(CategoryTypes.Item.Appearance)]
75+
public string TrackColor { get; set; }
76+
77+
/// <summary>
78+
/// Hide the scrollbar with securing scroll functionality. Also supported by firefox.
79+
/// </summary>
80+
[Parameter]
81+
[Category(CategoryTypes.Item.Appearance)]
82+
public bool Hide { get; set; }
83+
84+
protected bool IsThemeColor(string color)
85+
{
86+
foreach (Color val in Enum.GetValues(typeof(Color)))
87+
{
88+
if (val.ToDescriptionString() == color)
89+
{
90+
return true;
91+
}
92+
}
93+
return false;
94+
}
95+
}
96+
97+
<style>
98+
@(Selector) {
99+
@if (Hide)
100+
{
101+
<MudRender>scrollbar-width: none;</MudRender>
102+
}
103+
@(FirefoxStyle)
104+
}
105+
106+
@(Selector)::-webkit-scrollbar {
107+
width: @(Width)px;
108+
@if (Hide)
109+
{
110+
<MudRender>display: none;</MudRender>
111+
}
112+
@(Style)
113+
}
114+
115+
@(Selector):hover::-webkit-scrollbar {
116+
@if (HoverWidth != null)
117+
{
118+
<MudRender>width: @(HoverWidth)px;</MudRender>
119+
}
120+
121+
}
122+
123+
@(Selector)::-webkit-scrollbar-thumb {
124+
@if (IsThemeColor(Color))
125+
{
126+
<MudRender>background-color: var(--mud-palette-@(Color));</MudRender>
127+
}
128+
else
129+
{
130+
<MudRender>background-color: @(Color);</MudRender>
131+
}
132+
border-radius: @(BorderRadius)px;
133+
@(ThumbStyle)
134+
}
135+
136+
@(Selector)::-webkit-scrollbar-thumb:hover {
137+
@if (IsThemeColor(HoverColor))
138+
{
139+
<MudRender>background-color: var(--mud-palette-@(HoverColor));</MudRender>
140+
}
141+
else
142+
{
143+
<MudRender>background-color: @(HoverColor);</MudRender>
144+
}
145+
width: @(HoverWidth)px;
146+
}
147+
148+
@(Selector)::-webkit-scrollbar-track {
149+
@if (IsThemeColor(TrackColor))
150+
{
151+
<MudRender>background-color: var(--mud-palette-@(TrackColor));</MudRender>
152+
}
153+
else
154+
{
155+
<MudRender>background-color: @(TrackColor);</MudRender>
156+
}
157+
@(TrackStyle)
158+
}
159+
</style>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>disable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
10+
<ItemGroup>
11+
<SupportedPlatform Include="browser" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.9" />
16+
<PackageReference Include="MudBlazor" Version="6.0.16" />
17+
</ItemGroup>
18+
19+
</Project>

0 commit comments

Comments
 (0)