View dotnet-core.yml
name: .NET Core | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: |
View PostDetails.razor
@page "/post/{Slug}" | |
@inject HttpClient Http | |
@inject NavigationManager NavigationManager | |
@using System.Text.Json.Serialization | |
@using Models | |
@if (postDetails != null && postDetails.post == null) | |
{ | |
<p><em>Loading...</em></p> | |
} |
View Index.razor
@page "/" | |
@inject HttpClient Http | |
@using Microsoft.Extensions.Configuration; | |
@using Models | |
@inject IConfiguration Configuration | |
@if (allPosts == null) | |
{ | |
<p><em>Loading...</em></p> |
View Post.cs
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace BlazorCosmicBlog.Models | |
{ | |
public class Post | |
{ | |
public string _id { get; set; } |
View Program.cs
using System; | |
using System.Net.Http; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using System.Text; | |
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Logging; | |
using BlazorCosmicBlog.Models; |
View appsettings.json
{ | |
"AppSettings": { | |
"COSMIC_BUCKET_SLUG": "" // replace your bucket slug | |
} | |
} |
View TodoItem.tsx
import React, { useState } from 'react'; | |
import { Stack, Label, IconButton, Dialog, DialogFooter, DefaultButton, PrimaryButton, DialogType } from '@fluentui/react'; | |
function TodoItem(props: any) { | |
const [openDeleteModal, setOpenModal] = useState(true); | |
const deleteTodo = (id: number) => { | |
props.deleteTodo(id); | |
setOpenModal(true); | |
} |
View App.tsx
import React, { useState } from 'react'; | |
import './App.css'; | |
import { Stack } from "@fluentui/react"; | |
import TodoList from './components/TodoList'; | |
import AddTodo from './components/AddTodo'; | |
function App() { | |
const [todos, setTodos] = useState([{ id: 1, name: "Todo Item 1" }, { id: 2, name: "Todo Item 2" }]); | |
const addTodo = (todoName: string) => { |
View AddTodo.tsx
import React, { useState } from 'react'; | |
import { Stack,TextField, PrimaryButton } from "@fluentui/react"; | |
function AddTodo(props:any) { | |
const [todoName, setTodoName] = useState(""); | |
const addTodo = () => { | |
props.addTodo(todoName); | |
setTodoName(""); | |
} | |
const setTodo = (e: any) =>{ |
View App.tsx
import React, { useState } from 'react'; | |
import './App.css'; | |
import { Stack } from "@fluentui/react"; | |
import TodoList from './components/TodoList'; | |
function App() { | |
const [todos, setTodos] = useState([{ id: 1, name: "Todo Item 1" }, { id: 2, name: "Todo Item 2" }]); | |
return ( | |
<div className="wrapper"> | |
<Stack horizontalAlign="center"> |
NewerOlder