bg-blue-300
text-white
p-4
m-8
rounded-md
shadow-lg
https://tailwindcss.com/docs
text-xl
text-2xl
my-8
px-4
hover:
Hover Variant
sm:
Breakpoints
md:
lg:
xl:
640px
768px
1024px
1280px
Render multiple instances of the button on the original page
Make each button have different text
<FancyButton text="Click me"></FancyButton>
<button>@Text</button>
[Parameter]
public string Text { get;set; }
FancyButton.razor
<FancyButton>Click me</FancyButton>
<button>@ChildContent</button>
[Parameter]
public RenderFragment ChildContent { get;set; }
FancyButton.razor
A Panel
Some interesting panel content (could be anything really)
Weather
Forecast
Active Users
Weekly Sales
A Panel
Some interesting panel content (could be anything really)
<button>@ChildContent</button>
[Parameter]
public RenderFragment ChildContent { get;set; }
<div class="flex …">
<div>A Panel</div>
<div>
Some interesting content
</div>
</div>
<div class="flex …">
<div>A Panel</div>
<div>
Some interesting content
</div>
</div>
<div class="flex flex-col …">
<div>A Panel</div>
<div>
Some interesting content
</div>
</div>
<div class="flex …">
<div>A Panel</div>
<div>
Some interesting content
</div>
</div>
<div class="flex flex-col …">
<div>A Panel</div>
<div class="border">
Some interesting content
</div>
</div>
<div class="flex …">
<div>A Panel</div>
<div>
Some interesting content
</div>
</div>
<div class="flex flex-col …">
<div>A Panel</div>
<div class="flex-1">
Some interesting content
</div>
</div>
Weather
Forecast
Active Users
Weekly Sales
flex
flex-row
flex-col
Container
Bonus options
flex-wrap
gap-x
Weather
Forecast
Active Users
Weekly Sales
grid
grid-cols-2
grid-rows-2
Modify the existing Panel component so it can be 'normal' or 'important'
Important panels should look 'different' to 'normal' panels.
Make at least one of your panels important
Start over :)
Make it possible to have an important panel.
This time you cannot make any changes to the existing Panel component
Create a new 'specialised' component which renders the panel with different styles (to visually show it is 'inactive')
Feel free to use Important Panel for inspiration
A Panel
Some interesting panel content (could be anything really)
Links, buttons here
Action bar
A component can have multiple Parameters of type RenderFragment
An alternative way to declare content for render fragments…
Tips
<YourComponent>
<ChildContent>
<h3>Hello World</h3>
</ChildContent>
</YourComponent>
A Panel
Some interesting panel content (could be anything really)
Links, buttons here
<div class="flex flex-col">
<div>@Title</div>
<div class="flex-1">
@ChildContent
</div>
@if (Actions != null)
{
<div>
@Actions
</div>
}
</div>
@code {
[Parameter]
public string Title { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment Actions { get; set; }
}
Panel.razor
<div class="flex gap-4">
<Panel Title="Panel A">
<ChildContent>
A Panel
</ChildContent>
<Actions>
<a href="/">View</a>
</Actions>
</Panel>
<ImportantPanel Title="Panel B">
Panel
</ImportantPanel>
</div>
Index.razor
<Panel Title="@Title" PrimaryBackgroundColor="bg-red-400">
@ChildContent
</Panel>
ImportantPanel.razor
@code {
[Parameter]
public string Title { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
}
<Panel Title="@Title" PrimaryBackgroundColor="bg-red-400"
Actions="@Actions">
@ChildContent
</Panel>
ImportantPanel.razor
@code {
[Parameter]
public string Title { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment Actions { get; set; }
}
<Panel Title="@Title" PrimaryBackgroundColor="bg-red-400"
Actions="@Actions" ChildContent="@ChildContent">
</Panel>
ImportantPanel.razor
@code {
[Parameter]
public string Title { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment Actions { get; set; }
}
<Panel Title="@Title" PrimaryBackgroundColor="bg-red-400">
<ChildContent>
@ChildContent
</ChildContent>
<Actions>
@Actions
</Actions>
</Panel>
ImportantPanel.razor
@code {
[Parameter]
public string Title { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment Actions { get; set; }
}
Refactor the card into its own component
Use the new component in place of the original markup (in the Kanban board)
Classes like gap-x and flex in containing elements enable children to remain layout agnostic
Keep all the markup in the main page (for now)
A
B
A
B
A
B
public class WorkItem
{
public void AssignToUser(User assignedBy, User assignedTo)
{
// assign task to user
if (assignedTo.Role == "manager")
{
// send manager email
// to let them know they've been asked to look at something
}
}
}
Connaescense of Value
A
B
public class User
{
public string Role { get; set; }
public bool IsManager => Role == "Manager";
public void AssignManagementRole()
{
Role = "Manager";
}
}
A
B
public class WorkItem
{
public void AssignToUser(User assignedBy, User assignedTo)
{
// assign task to user
if (assignedTo.IsManager)
{
// send manager email
// to let them know they've been asked to look at something
}
}
}
ProductList
Fetch list from API
Fetch list from API
ProductList
Product Id
ProductCard
Fetch specific details from API
Fetch list from API
ProductList
Product Id
ProductCard
Fetch specific details from API
Price
Delivery
Fetch price from API
Product Id
Product Id
Fetch Delivery Cost from API
Fetch list from API
Fetch specific details from API
Fetch price from API
Fetch Delivery Cost from API
Fetch list from API
Fetch list from API
ProductDetails { id, imageUrl, description, price }
ProductDetails { id, imageUrl, description, price }
ProductDetails { id, imageUrl, description, price }
Fetch list from API
ProductDetails { id, imageUrl, description, price }
DeliveryCost { price }
PriceDetails { price }
Fetch list from API
ProductDetails { id, imageUrl, description, price }
Price
Price
Features
- Components
- Feature A
- Components
- Index.razor
- Feature B
- Components
- Index.razor
Index.razor
Features
- Components
- Profile
- Components
- Index.razor
- Dashboard
- Components
- Index.razor
Index.razor
Features
- Components
- Profile
- Components
- Achievements.razor
- Avatar.razor
- Index.razor
- Dashboard
- Components
- Panel.razor
- ImportantPanel.razor
- Index.razor
Index.razor
Profile
Dashboard
Components
Panel.razor
Index.razor
Index.razor
Courses
Features
Components
Panel.razor
Profile
Index.razor
Index.razor
Features
- Components
- Profile
- Components
- Achievements.razor
- Avatar.razor
- Index.razor
- Dashboard
- Components
- Panel.razor
- ImportantPanel.razor
- Index.razor
Index.razor
Features
- Components
- Panel.razor
- ImportantPanel.razor
- Profile
- Components
- Achievements.razor
- Avatar.razor
- Index.razor
- Dashboard
- Components
- Index.razor
Index.razor
https://jonhilton.net/blazor-component-folder-structure/
Make a call to Api.GetBoards()
(note, the method is async)
Render the list of boards in the UI (using the data returned from the Api call)
https://devblogs.microsoft.com/dotnet/
embracing-nullable-reference-types/
From the command line/terminal
dotnet tool install -g refitgenerator
cd ExampleClient
regen -u https://donatello-9hwr4.ondigitalocean.app/swagger/v1/swagger.json
Where 'ExampleClient' is a folder in which you're happy to create the client!
(AKA phew, we made it!)