View dotnet-core.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Core | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: |
View PostDetails.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/" | |
@inject HttpClient Http | |
@using Microsoft.Extensions.Configuration; | |
@using Models | |
@inject IConfiguration Configuration | |
@if (allPosts == null) | |
{ | |
<p><em>Loading...</em></p> |
View Post.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AppSettings": { | |
"COSMIC_BUCKET_SLUG": "" // replace your bucket slug | |
} | |
} |
View TodoItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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