Skip to content
Open
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
2 changes: 1 addition & 1 deletion samples/BlazorApp/BlazorApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<OutputType>Exe</OutputType>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
<ComponentsPackageVersion>3.0.0-preview6.19305.13</ComponentsPackageVersion>
<ComponentsPackageVersion>3.0.0-preview7.19365.7</ComponentsPackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
31 changes: 25 additions & 6 deletions samples/BlazorApp/Pages/TextFieldSample.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,32 @@

<p>See <code>TextField.cshtml</code> for sources.</p>

<MdcTextField Label="Type in some text" @bind-Value="@currentValue" />
<div class="grouping">
<MdcTextField Label="Type in some text" @bind-Value="@currentText" />
@if (currentText != null)
{
<p>You typed: <strong>@currentText</strong></p>
}
</div>

@if (currentValue != null)
{
<p>You typed: <strong>@currentValue</strong></p>
}
<div class="grouping">
<MdcTextField Type="password" Label="Type in a password" @bind-Value="@currentPassword" />
@if (currentPassword != null)
{
<p>You typed: <strong>@currentPassword</strong></p>
}
</div>

<div class="grouping">
<MdcTextArea Label="Type in some lines of text" @bind-Value="@currentMultiLine" />
@if (currentMultiLine != null)
{
<p>You typed: <strong>@currentMultiLine</strong></p>
}
</div>

@functions {
string currentValue;
string currentText;
string currentPassword;
string currentMultiLine;
}
4 changes: 4 additions & 0 deletions samples/BlazorApp/wwwroot/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@ h1 {
.mdc-drawer.mdc-drawer--open:not(.mdc-drawer--closing)+.mdc-drawer-app-content .mdc-top-app-bar {
width: calc(100% - 256px);
}

.grouping {
margin: 10px;
}
6 changes: 3 additions & 3 deletions samples/BlazorApp/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<title>Component Demos</title>
<base href="/" />
<link rel="stylesheet" href="css/site.css" />
<link href="_content/RazorComponentsMaterialDesign/styles.css" rel="stylesheet" />
<script src="_content/RazorComponentsMaterialDesign/script.js"></script>
<script src="_content/RazorComponentsMaterialDesign/lib/material-components-web.js"></script>
<link href="_content/RazorComponents.MaterialDesign/styles.css" rel="stylesheet" />
<script src="_content/RazorComponents.MaterialDesign/script.js"></script>
<script src="_content/RazorComponents.MaterialDesign/lib/material-components-web.js"></script>
</head>
<body class="mdc-typography">
<app>Loading...</app>
Expand Down
6 changes: 3 additions & 3 deletions samples/RazorComponentsApp/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<title>Component Demos</title>
<base href="~/" />
<link rel="stylesheet" href="css/site.css" />
<link href="_content/RazorComponentsMaterialDesign/styles.css" rel="stylesheet" />
<script src="_content/RazorComponentsMaterialDesign/script.js"></script>
<script src="_content/RazorComponentsMaterialDesign/lib/material-components-web.js"></script>
<link href="_content/RazorComponents.MaterialDesign/styles.css" rel="stylesheet" />
<script src="_content/RazorComponents.MaterialDesign/script.js"></script>
<script src="_content/RazorComponents.MaterialDesign/lib/material-components-web.js"></script>
</head>
<body class="mdc-typography">
<app>@(await Html.RenderComponentAsync<BlazorApp.App>())</app>
Expand Down
2 changes: 1 addition & 1 deletion samples/RazorComponentsApp/RazorComponentsApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<ComponentsPackageVersion>3.0.0-preview6.19305.13</ComponentsPackageVersion>
<ComponentsPackageVersion>3.0.0-preview7.19365.7</ComponentsPackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
23 changes: 23 additions & 0 deletions src/RazorComponents.MaterialDesign/MdcTextArea.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@inherits MdcInputComponentBase<string>
@inject IJSRuntime jsRuntime

<div @ref="textFieldElem" class="mdc-text-field mdc-text-field--textarea">
<textarea id=@id class="mdc-text-field__input @FieldClass"
@bind="@CurrentValue" rows="@Rows" cols="@Cols" />

<label class="mdc-floating-label" for=@id>@Label</label>
<div class="mdc-line-ripple"></div>
</div>

@functions {
string id = Guid.NewGuid().ToString();
ElementRef textFieldElem;

[Parameter] string Label { get; set; }
[Parameter] int Rows { get; set; } = 4;
[Parameter] int Cols { get; set; } = 40;

protected override Task OnAfterFirstRenderAsync()
=> jsRuntime.InvokeAsync<object>(
"BlazorMaterial.textField.init", textFieldElem);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>7.3</LangVersion>
<RazorLangVersion>3.0</RazorLangVersion>
<ComponentsPackageVersion>3.0.0-preview6.19305.13</ComponentsPackageVersion>
<ComponentsPackageVersion>3.0.0-preview7.19365.7</ComponentsPackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down