Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
Add Flatware standalone sample
Browse files Browse the repository at this point in the history
  • Loading branch information
tachyus-ryan committed Apr 8, 2018
1 parent 63f1123 commit 1a2217f
Show file tree
Hide file tree
Showing 23 changed files with 1,025 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Trail.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "flatware-standalone", "flat
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Trail.Flatware", "src\Trail.Flatware\Trail.Flatware.fsproj", "{A33BCF9D-E412-45B8-9D53-A0BC7343CA42}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FlatwareLib", "sample\flatware-standalone\FlatwareLib\FlatwareLib.fsproj", "{D4B0D993-109F-499D-9575-9E74FDA5774E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlatwareApp", "sample\flatware-standalone\FlatwareApp\FlatwareApp.csproj", "{51A6C18D-0B8B-4B7E-8821-206A1E1E1819}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -58,6 +62,14 @@ Global
{A33BCF9D-E412-45B8-9D53-A0BC7343CA42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A33BCF9D-E412-45B8-9D53-A0BC7343CA42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A33BCF9D-E412-45B8-9D53-A0BC7343CA42}.Release|Any CPU.Build.0 = Release|Any CPU
{D4B0D993-109F-499D-9575-9E74FDA5774E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4B0D993-109F-499D-9575-9E74FDA5774E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4B0D993-109F-499D-9575-9E74FDA5774E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4B0D993-109F-499D-9575-9E74FDA5774E}.Release|Any CPU.Build.0 = Release|Any CPU
{51A6C18D-0B8B-4B7E-8821-206A1E1E1819}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51A6C18D-0B8B-4B7E-8821-206A1E1E1819}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51A6C18D-0B8B-4B7E-8821-206A1E1E1819}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51A6C18D-0B8B-4B7E-8821-206A1E1E1819}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -70,6 +82,8 @@ Global
{CB98C266-A9A4-42CD-97F4-8128B63831FE} = {E7597390-E323-48F6-8377-CEA51FB27734}
{2F9A1056-3F8C-4BEA-A45B-478CE48283D7} = {E7597390-E323-48F6-8377-CEA51FB27734}
{A33BCF9D-E412-45B8-9D53-A0BC7343CA42} = {7DC7FD7F-318A-41E6-8913-CBB973E03657}
{D4B0D993-109F-499D-9575-9E74FDA5774E} = {2F9A1056-3F8C-4BEA-A45B-478CE48283D7}
{51A6C18D-0B8B-4B7E-8821-206A1E1E1819} = {2F9A1056-3F8C-4BEA-A45B-478CE48283D7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {108ADC24-AA04-4A13-9AEC-2BF801A7FED7}
Expand Down
21 changes: 21 additions & 0 deletions sample/flatware-standalone/FlatwareApp/FlatwareApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web;Microsoft.NET.Sdk.Razor/2.1.0-preview2-30230">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RunCommand>dotnet</RunCommand>
<RunArguments>blazor serve</RunArguments>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Flatware" Version="0.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.0-preview2-30230" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.1.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.1.0" />
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FlatwareLib\FlatwareLib.fsproj" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions sample/flatware-standalone/FlatwareApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Blazor.Browser.Rendering;
using Microsoft.AspNetCore.Blazor.Browser.Services;
using System;
using Flatware;
using Library1;

namespace BlazorApp1
{
class Program
{
static void Main(string[] args)
{
var serviceProvider = new BrowserServiceProvider(configure =>
{
// Add any custom services here
configure.AddFlatware<MyMsg, MyMdl>(MyMdl.Init);
});

new BrowserRenderer(serviceProvider).AddComponent<App>("app");
}
}
}
5 changes: 5 additions & 0 deletions sample/flatware-standalone/FlatwareApp/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "2.1.300-preview1-008174"
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
96 changes: 96 additions & 0 deletions sample/flatware-standalone/FlatwareApp/wwwroot/css/site.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.main-nav li .glyphicon {
margin-right: 10px;
}

/* Highlighting rules for nav menu items */
.main-nav li a.active,
.main-nav li a.active:hover,
.main-nav li a.active:focus {
background-color: #4189C7;
color: white;
}

/* Keep the nav menu independent of scrolling and on top of other items */
.main-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1;
}

@media (max-width: 767px) {
/* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */
body {
padding-top: 50px;
}
}

@media (min-width: 768px) {
/* On small screens, convert the nav menu to a vertical sidebar */
.main-nav {
height: 100%;
width: calc(25% - 20px);
}
.main-nav .navbar {
border-radius: 0px;
border-width: 0px;
height: 100%;
}
.main-nav .navbar-header {
float: none;
}
.main-nav .navbar-collapse {
border-top: 1px solid #444;
padding: 0px;
}
.main-nav .navbar ul {
float: none;
}
.main-nav .navbar li {
float: none;
font-size: 15px;
margin: 6px;
}
.main-nav .navbar li a {
padding: 10px 16px;
border-radius: 4px;
}
.main-nav .navbar a {
/* If a menu item's text is too long, truncate it */
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}

/*
Temporary workaround due to the <blazor-component> wrapper element. The wrapper element
will be eliminated in a future update, making this workaround unnecessary.
*/
.navbar-nav > li a {
color: #9d9d9d;
line-height: 20px;
position: relative;
display: block;
}
.navbar-nav > li a:hover {
color: #fff;
background-color: transparent;
text-decoration: none;
}
.navbar-nav > li a:focus {
text-decoration: none;
}

.alert-survey {
color: #6a6969;
background-color: #e8e8e8;
border-color: #d3d3d3;
margin-top: 25px;
}

.alert-survey a {
font-weight: bold;
}
16 changes: 16 additions & 0 deletions sample/flatware-standalone/FlatwareApp/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>BlazorApp1</title>
<base href="/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/site.css" rel="stylesheet" />
</head>
<body>
<app>Loading...</app>

<script src="css/bootstrap/bootstrap-native.min.js"></script>
<script type="blazor-boot"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
"Date": "2018-05-06",
"TemperatureC": 1,
"Summary": "Freezing",
"TemperatureF": 33
},
{
"Date": "2018-05-07",
"TemperatureC": 14,
"Summary": "Bracing",
"TemperatureF": 57
},
{
"Date": "2018-05-08",
"TemperatureC": -13,
"Summary": "Freezing",
"TemperatureF": 9
},
{
"Date": "2018-05-09",
"TemperatureC": -16,
"Summary": "Balmy",
"TemperatureF": 4
},
{
"Date": "2018-05-10",
"TemperatureC": -2,
"Summary": "Chilly",
"TemperatureF": 29
}
]
42 changes: 42 additions & 0 deletions sample/flatware-standalone/FlatwareLib/App.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace BlazorApp1

open System
open System.Collections.Generic
open System.Linq
open System.Threading.Tasks
open System.Net.Http
open Microsoft.AspNetCore.Blazor
open Microsoft.AspNetCore.Blazor.Browser.Rendering
open Microsoft.AspNetCore.Blazor.Browser.Services
open Microsoft.AspNetCore.Blazor.Components
open Microsoft.AspNetCore.Blazor.Layouts
open Microsoft.AspNetCore.Blazor.Routing
open Trail
open BlazorApp1
open BlazorApp1.Shared
open Library1

type Marker = class end

type App() =
inherit MyAppComponent()

override __.Render() =
Dom.comp<Router> [Dom.BlazorObjAttribute("AppAssembly", box typeof<Marker>.Assembly)] []

override this.OnInitAsync() =
this.DispatchAsync(MyMsg.LoadWeather) :> Task

(*
// TODO: can we go ALL the way?
module Program =
[<EntryPoint>]
let main _ =
let serviceProvider = new BrowserServiceProvider(fun configure ->
// Add any custom services here
()
)
(new BrowserRenderer(serviceProvider)).AddComponent<App>("app")
0
*)
Loading

0 comments on commit 1a2217f

Please sign in to comment.