css fix, inputfile

main
Peace 10 months ago
parent f21b467afb
commit aad9b00323
  1. 12
      BlazorFluentUI/Components/App.razor
  2. 1
      BlazorFluentUI/Components/Layout/NavMenu.razor
  3. 139
      BlazorFluentUI/Components/Pages/FormInputs/FormInputFile.razor
  4. 7
      BlazorFluentUI/Components/Pages/Home.razor
  5. 20
      BlazorFluentUI/Components/Pages/Layouts/LayoutGrid.razor
  6. 4
      BlazorFluentUI/Components/Pages/Layouts/LayoutSplitter.razor
  7. 22
      BlazorFluentUI/Components/Pages/Layouts/LayoutStack.razor
  8. 23
      BlazorFluentUI/wwwroot/app-cutom.css
  9. 9
      BlazorFluentUI/wwwroot/app.css
  10. 15
      BlazorFluentUI/wwwroot/fluentcustom.css

@ -7,22 +7,22 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" /> <base href="/" />
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="/fluentcustom.css" />
<link rel="stylesheet" href="app.css" /> <link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="BlazorFluentUI.styles.css" /> <link rel="stylesheet" href="BlazorFluentUI.styles.css" />
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="app-cutom.css"/>
<link rel="icon" type="image/x-icon" href="favicon.ico" /> <link rel="icon" type="image/x-icon" href="favicon.ico" />
<link href="_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css" rel="stylesheet" /> <link href="_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css" rel="stylesheet" />
<HeadOutlet /> <HeadOutlet />
</head> </head>
<body> <body>
<Routes /> <Routes @rendermode="RenderMode.InteractiveServer"/>
<script src="_content/Microsoft.FluentUI.AspNetCore.Components/js/loading-theme.js" type="text/javascript"></script>
<loading-theme storage-name="theme"></loading-theme>
<script src="_framework/blazor.web.js"></script> <script src="_framework/blazor.web.js"></script>
<script src="_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js" type="module" async></script> <script src="_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js" type="module" async></script>
<script src="_content/Microsoft.FluentUI.AspNetCore.Components/js/loading-theme.js" type="text/javascript"></script>
<loading-theme storage-name="theme"></loading-theme>
</body> </body>
</html> </html>

@ -24,6 +24,7 @@
<FluentNavGroup Icon="@(new Icons.Regular.Size20.Form())" Expanded="false" Title="Form & Input"> <FluentNavGroup Icon="@(new Icons.Regular.Size20.Form())" Expanded="false" Title="Form & Input">
<FluentNavLink Href="forminputoverview" Icon="@(new Icons.Regular.Size20.Eye())" IconColor="Color.Accent">Overview</FluentNavLink> <FluentNavLink Href="forminputoverview" Icon="@(new Icons.Regular.Size20.Eye())" IconColor="Color.Accent">Overview</FluentNavLink>
<FluentNavLink Href="forminputcheckbox" Icon="@(new Icons.Regular.Size20.CheckboxChecked())" IconColor="Color.Accent">Checkbox</FluentNavLink> <FluentNavLink Href="forminputcheckbox" Icon="@(new Icons.Regular.Size20.CheckboxChecked())" IconColor="Color.Accent">Checkbox</FluentNavLink>
<FluentNavLink Href="forminputfile" Icon="@(new Icons.Regular.Size20.ArrowUpload())" IconColor="Color.Accent">InputFile</FluentNavLink>
</FluentNavGroup> </FluentNavGroup>
</FluentNavMenu> </FluentNavMenu>

@ -0,0 +1,139 @@
@page "/forminputfile"
@using System.Text
@rendermode RenderMode.InteractiveServer
<FluentLabel Typo="Typography.H3">InputFile</FluentLabel>
<FluentDivider class="mt-1 mb-3" Role="DividerRole.Separator" />
<FluentLabel Typo="Typography.Body">
The <code>FluentInputFile</code> wrap the native Blazor <code>InputFile</code> component and extends it with drag/drop zone support.
</FluentLabel>
<FluentLabel class="my-3" Typo="Typography.H4">Default Example</FluentLabel>
<FluentCard Class="mt-3" Width="auto" Height="auto">
<FluentInputFile Class="p-5 fluent-border-d1" Id="my-file-uploader"
Mode="InputFileMode.SaveToTemporaryFolder"
Multiple="true"
MaximumFileCount="4"
MaximumFileSize="@(10 * 1024 * 1024)"
Accept="image/*"
@bind-ProgressPercent="progressPercent"
OnCompleted="@OnCompletedAsync">
<ChildContent>
<label for="my-file-uploader">
<FluentIcon Value="@(new Icons.Regular.Size24.ArrowUpload())"/>
</label>
<div>
Drag files here you wish to upload,
or <label for="my-file-uploader">browse</label>
for them<span style="color: red">*</span>.
<br />
<em>Maximum of 4 files allowed.</em>
</div>
<div>
<br/>
<a href="https://www.fluentui-blazor.net/">Read more about officail FluentUI-Blazor page.</a>
</div>
</ChildContent>
</FluentInputFile>
@if (inputFiles.Any())
{
<FluentLabel Typo="Typography.H5">File(s) uploaded:</FluentLabel>
<ul>
@foreach (var file in inputFiles)
{
<li>
<b>@file.Name</b> 🔸
@($"{Decimal.Divide(file.Size, 1024):N} KB") 🔸
@file.ContentType 🔸
@file.LocalFile?.FullName
@file.ErrorMessage
</li>
}
</ul>
}
<FluentLabel Class="mt-1" Typo="Typography.Body" Weight="FontWeight.Bold">@message</FluentLabel>
</FluentCard>
<FluentLabel class="my-3" Typo="Typography.H4">Manual Upload</FluentLabel>
<FluentCard Class="mt-3" Width="auto" Height="auto">
<FluentInputFile @ref="fileUploader"
DragDropZoneVisible="false"
Mode="InputFileMode.SaveToTemporaryFolder"
Multiple="true"
AnchorId="MyUploadButton"
MaximumFileSize="@(100 * 1024 * 1024)"
Accept=".mp4, .mov, .avi, .jpg, .png, .svg"
OnProgressChange="@(e =>
{
progressPercent = e.ProgressPercent;
progressTitle = e.ProgressTitle;
})"
OnCompleted="OnCompleted"/>
<FluentProgress Min="0" Max="100" Visible="@(progressPercent > 0)" Value="@progressPercent"/>
<FluentLabel Alignment="HorizontalAlignment.Center">@progressTitle</FluentLabel>
<FluentButton Id="MyUploadButton" Appearance="Appearance.Accent">Upload files</FluentButton>
@if (inputFiles.Any())
{
<FluentLabel Typo="Typography.H5">File(s) uploaded:</FluentLabel>
<ul>
@foreach (var file in inputFiles)
{
<li>
<b>@file.Name</b> 🔸
@($"{Decimal.Divide(file.Size, 1024):N} KB") 🔸
@file.ContentType 🔸
@file.LocalFile?.FullName
@file.ErrorMessage
</li>
}
</ul>
}
</FluentCard>
<FluentLabel class="my-3" Typo="Typography.H4">Buffer, Stream Mode</FluentLabel>
<FluentLabel Typo="Typography.Body">
Please refers <a href="https://www.fluentui-blazor.net/InputFile" target="_blank" >Officail FluentUI-Blazor page</a>.
</FluentLabel>
@code {
int progressPercent = 0;
FluentInputFileEventArgs[] inputFiles = Array.Empty<FluentInputFileEventArgs>();
string message = "Message console: ";
StringBuilder stringBuilder = new StringBuilder();
private async Task OnCompletedAsync(IEnumerable<FluentInputFileEventArgs> files)
{
stringBuilder.Clear();
stringBuilder.Append("Meesage console: ");
inputFiles = files.ToArray();
foreach (var file in inputFiles)
{
stringBuilder.Append($"{file.Name} is handled. ");
message = stringBuilder.ToString();
}
await Task.Delay(3000);
progressPercent = 0;
}
FluentInputFile? fileUploader = default;
string? progressTitle;
private void OnCompleted(IEnumerable<FluentInputFileEventArgs> files)
{
stringBuilder.Clear();
stringBuilder.Append("Meesage console: ");
inputFiles = files.ToArray();
progressPercent = fileUploader!.ProgressPercent;
progressTitle = fileUploader!.ProgressTitle;
foreach (var file in inputFiles)
{
stringBuilder.Append($"{file.Name} is handled. ");
message = stringBuilder.ToString();
}
}
}

@ -31,11 +31,14 @@
</FluentGridItem> </FluentGridItem>
</FluentGrid> </FluentGrid>
<FluentStack Style="margin: 30px 0px; padding: 30px; border: 1px solid var(--accent-fill-rest);"> <FluentStack Class="m-3 p-3 fluent-border-s1" HorizontalAlignment="HorizontalAlignment.Center" Orientation="Orientation.Vertical" VerticalGap="5">
<FluentIcon Value="@(new Icons.Regular.Size24.Airplane())" /> <FluentIcon Value="@(new Icons.Regular.Size24.Airplane())" />
<FluentLabel>Example of content</FluentLabel> <FluentLabel>Example of content</FluentLabel>
<FluentButton Appearance="Appearance.Outline">Outline</FluentButton> <FluentButton Appearance="Appearance.Neutral">Neutral</FluentButton>
<FluentButton Appearance="Appearance.Accent">Accent</FluentButton> <FluentButton Appearance="Appearance.Accent">Accent</FluentButton>
<FluentButton Appearance="Appearance.Stealth">Stealth</FluentButton>
<FluentButton Appearance="Appearance.Outline">Outline</FluentButton>
<FluentButton Appearance="Appearance.Lightweight">Lightweight</FluentButton>
</FluentStack> </FluentStack>
</FluentCard> </FluentCard>

@ -20,50 +20,50 @@
</FluentStack> </FluentStack>
<FluentStack Orientation="Orientation.Horizontal"> <FluentStack Orientation="Orientation.Horizontal">
<FluentLabel>Spacing</FluentLabel> <FluentLabel>Spacing</FluentLabel>
<FluentSlider class="fluentslider-300" @bind-Value="@spacing" Min="0" Max="10" Step="1" /> <FluentSlider class="fluent-slider-w300px" @bind-Value="@spacing" Min="0" Max="10" Step="1" />
</FluentStack> </FluentStack>
</FluentStack> </FluentStack>
<FluentGrid class="p-3 round-edge" Justify="@justification" Spacing="@spacing" <FluentGrid class="fluent-border-s1-r10" Justify="@justification" Spacing="@spacing"
OnBreakpointEnter="@OnBreakpointEnterHandler" OnBreakpointEnter="@OnBreakpointEnterHandler"
AdaptiveRendering="true"> AdaptiveRendering="true">
<FluentGridItem xs="12"> <FluentGridItem xs="12">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="12" xs="12"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>
<FluentGridItem xs="12" sm="6" HiddenWhen="GridItemHidden.SmAndDown"> <FluentGridItem xs="12" sm="6" HiddenWhen="GridItemHidden.SmAndDown">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="12" sm="6" HiddenWhen="GridItemHidden.SmAndDown" xs="12" sm="6" HiddenWhen="GridItemHidden.SmAndDown"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>
<FluentGridItem xs="12" sm="6"> <FluentGridItem xs="12" sm="6">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="12" sm="6" xs="12" sm="6"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>
<FluentGridItem xs="6" sm="3"> <FluentGridItem xs="6" sm="3">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="6" sm="3" xs="6" sm="3"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>
<FluentGridItem xs="6" sm="3"> <FluentGridItem xs="6" sm="3">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="6" sm="3" xs="6" sm="3"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>
<FluentGridItem xs="6" sm="3"> <FluentGridItem xs="6" sm="3">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="6" sm="3" xs="6" sm="3"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>
<FluentGridItem xs="6" sm="3"> <FluentGridItem xs="6" sm="3">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="6" sm="3" xs="6" sm="3"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>
<FluentGridItem xs="3"> <FluentGridItem xs="3">
<FluentLabel class="round-edge" Alignment="HorizontalAlignment.Center"> <FluentLabel class="fluent-border-s1-r10" Alignment="HorizontalAlignment.Center">
xs="3" xs="3"
</FluentLabel> </FluentLabel>
</FluentGridItem> </FluentGridItem>

@ -24,14 +24,14 @@
OnResized="@OnResizedChanged" OnCollapsed="@OnCollapsedChanged" OnExpanded="@OnExpandedChanged" OnResized="@OnResizedChanged" OnCollapsed="@OnCollapsedChanged" OnExpanded="@OnExpandedChanged"
BarSize="6" Panel1MinSize="15%" Panel2MinSize="50px"> BarSize="6" Panel1MinSize="15%" Panel2MinSize="50px">
<Panel1> <Panel1>
<div class="dashed-edge p-2"> <div class="p-2 fluent-border-d1">
Panel 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Panel 1 - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Eget dolor morbi non arcu risus quis varius. Turpis tincidunt id aliquet risus feugiat in ante. Eros donec ac odio tempor orci Eget dolor morbi non arcu risus quis varius. Turpis tincidunt id aliquet risus feugiat in ante. Eros donec ac odio tempor orci
dapibus ultrices in iaculis. dapibus ultrices in iaculis.
</div> </div>
</Panel1> </Panel1>
<Panel2> <Panel2>
<div class="dashed-edge p-2"> <div class="p-2 fluent-border-d1">
Panel 2 - Neque laoreet suspendisse interdum consectetur libero id faucibus nisl tincidunt. Suspendisse faucibus interdum posuere lorem ipsum Panel 2 - Neque laoreet suspendisse interdum consectetur libero id faucibus nisl tincidunt. Suspendisse faucibus interdum posuere lorem ipsum
dolor sit amet. Imperdiet sed euismod nisi porta lorem mollis aliquam. dolor sit amet. Imperdiet sed euismod nisi porta lorem mollis aliquam.
</div> </div>

@ -48,22 +48,22 @@
</FluentStack> </FluentStack>
<div class="mt-1">Result</div> <div class="mt-1">Result</div>
<FluentStack Class="dashed-edge" Style="height:200px" <FluentStack Class="fluent-border-d1" Style="height:200px"
Wrap="@wrap" Wrap="@wrap"
Orientation="@orientation" Orientation="@orientation"
HorizontalAlignment="@horizontalAlignment" HorizontalAlignment="@horizontalAlignment"
VerticalAlignment="@verticalAlignment"> VerticalAlignment="@verticalAlignment">
<div class="dashed-edge">Item1</div> <div class="fluent-border-d1">Item1</div>
<div class="dashed-edge">Item2</div> <div class="fluent-border-d1">Item2</div>
<div class="dashed-edge"> <div class="fluent-border-d1">
<p class="dashed-edge" style="width:150px">Item3-1</p> <p class="fluent-border-d1" style="width:150px">Item3-1</p>
<p class="dashed-edge" style="width:100px">Item3-2</p> <p class="fluent-border-d1" style="width:100px">Item3-2</p>
</div> </div>
<div class="dashed-edge">Item4</div> <div class="fluent-border-d1">Item4</div>
<div class="dashed-edge">Item5</div> <div class="fluent-border-d1">Item5</div>
<div class="dashed-edge"> <div class="fluent-border-d1">
<p class="dashed-edge" style="width:150px">Item4-1</p> <p class="fluent-border-d1" style="width:150px">Item4-1</p>
<p class="dashed-edge" style="width:200px">Item4-2</p> <p class="fluent-border-d1" style="width:200px">Item4-2</p>
</div> </div>
</FluentStack> </FluentStack>
</FluentCard> </FluentCard>

@ -0,0 +1,23 @@
.fluent-slider-w300px {
max-width: 300px;
margin-top: 10px
}
.fluent-border-s1 {
border-style: solid;
border-color: var(--accent-fill-rest);
border-width: 1px
}
.fluent-border-s1-r10 {
border-radius: 10px;
border-style: solid;
border-color: var(--accent-fill-rest);
border-width: 1px
}
.fluent-border-d1 {
border-style: dashed;
border-color: var(--accent-fill-rest);
border-width: 1px
}

@ -2,10 +2,15 @@
body { body {
--body-font: "Segoe UI Variable", "Segoe UI", sans-serif; --body-font: "Segoe UI Variable", "Segoe UI", sans-serif;
margin: 0;
padding: 0;
height: 100vh;
font-family: var(--body-font); font-family: var(--body-font);
font-size: var(--type-ramp-base-font-size); font-size: var(--type-ramp-base-font-size);
line-height: var(--type-ramp-base-line-height); line-height: var(--type-ramp-base-line-height);
margin: 0; font-weight: var(--font-weight);
color: var(--neutral-foreground-rest);
background: var(--neutral-fill-layer-rest);
} }
.navmenu-icon { .navmenu-icon {
@ -188,4 +193,4 @@ code {
left: 20px; left: 20px;
right: unset; right: unset;
} }
} }

@ -1,15 +0,0 @@
.fluentslider-300 {
max-width: 300px;
margin-top: 10px
}
.round-edge {
border-radius: 10px;
border-style: solid;
border-width: 1px
}
.dashed-edge {
border-style: dashed;
border-width: 1px
}
Loading…
Cancel
Save