Merge pull request 'xaml/my-recipes' (#31) from xaml/my-recipes into master
Reviewed-on: ShopNCook/ShopNCook#31pull/29/head^2
commit
85a80d2cb3
@ -0,0 +1,65 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="ShoopNCook.Pages.MyRecipesPage"
|
||||||
|
Title="MyRecipesPage"
|
||||||
|
xmlns:views="clr-namespace:ShoopNCook.Views"
|
||||||
|
BackgroundColor="{StaticResource BackgroundPrimary}">
|
||||||
|
<Grid
|
||||||
|
RowDefinitions="Auto, *, Auto">
|
||||||
|
<!-- Header label and return button -->
|
||||||
|
<Grid
|
||||||
|
Grid.Row="0"
|
||||||
|
Padding="10, 20, 0, 30">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
Grid.Column="0"
|
||||||
|
HeightRequest="50"
|
||||||
|
WidthRequest="50"
|
||||||
|
Source="arrow_back.svg"
|
||||||
|
HorizontalOptions="Start"/>
|
||||||
|
|
||||||
|
<Label
|
||||||
|
Grid.Column="0"
|
||||||
|
FontSize="24"
|
||||||
|
TextColor="{StaticResource TextColorPrimary}"
|
||||||
|
Text="My Recipes"
|
||||||
|
FontFamily="PoppinsBold"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
VerticalOptions="Center"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Favorite items -->
|
||||||
|
<ScrollView
|
||||||
|
Grid.Row="1">
|
||||||
|
<FlexLayout
|
||||||
|
JustifyContent="Center"
|
||||||
|
AlignItems="Start"
|
||||||
|
AlignContent="Start"
|
||||||
|
Direction="Row"
|
||||||
|
Wrap="Wrap">
|
||||||
|
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="4.5" Title="Spaghetti Bolognese"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="3" Title="Chickend Curry"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="0.2" Title="Beef Stroganoff"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="1.6" Title="Fish And Ships"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="5" Title="Caesar Salad"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="3.5" Title="Vegetables"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="4.6" Title="Guacamole"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="4" Title="Pad Thai"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="3" Title="French Toast"/>
|
||||||
|
<views:OwnedRecipeView Margin="5" Note="2" Title="Margherita Pizza"/>
|
||||||
|
</FlexLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<Border
|
||||||
|
Margin="20, 0, 20, 5"
|
||||||
|
Grid.Row="2"
|
||||||
|
Style="{StaticResource SecondaryBorder}">
|
||||||
|
<Button
|
||||||
|
Style="{StaticResource UserButton}"
|
||||||
|
BackgroundColor="{StaticResource Selected}"
|
||||||
|
Text="Add a new recipe"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</ContentPage>
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace ShoopNCook.Pages;
|
||||||
|
|
||||||
|
public partial class MyRecipesPage : ContentPage
|
||||||
|
{
|
||||||
|
public MyRecipesPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="ShoopNCook.Views.OwnedRecipeView">
|
||||||
|
<Border
|
||||||
|
Style="{StaticResource SecondaryBorderShadow}"
|
||||||
|
StrokeShape="RoundRectangle 30">
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||||
|
Padding="10"
|
||||||
|
MinimumHeightRequest="175"
|
||||||
|
MinimumWidthRequest="150"
|
||||||
|
RowDefinitions="*, Auto">
|
||||||
|
<Border
|
||||||
|
Grid.Row="0"
|
||||||
|
Stroke="Transparent"
|
||||||
|
StrokeShape="RoundRectangle 20"
|
||||||
|
BackgroundColor="AliceBlue">
|
||||||
|
<Grid>
|
||||||
|
<Image />
|
||||||
|
<HorizontalStackLayout
|
||||||
|
x:Name="Stars"
|
||||||
|
VerticalOptions="End"
|
||||||
|
HorizontalOptions="End"
|
||||||
|
Margin="0, 0, 15, 2">
|
||||||
|
<Image
|
||||||
|
WidthRequest="10"
|
||||||
|
Source="star_full.svg"/>
|
||||||
|
<Image
|
||||||
|
WidthRequest="10"
|
||||||
|
Source="star_full.svg"/>
|
||||||
|
<Image
|
||||||
|
WidthRequest="10"
|
||||||
|
Source="star_full.svg"/>
|
||||||
|
<Image
|
||||||
|
WidthRequest="10"
|
||||||
|
Source="star_full.svg"/>
|
||||||
|
<Image
|
||||||
|
WidthRequest="10"
|
||||||
|
Source="star_full.svg"/>
|
||||||
|
</HorizontalStackLayout>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<VerticalStackLayout Grid.Row="1">
|
||||||
|
<Label
|
||||||
|
TextColor="{StaticResource TextColorPrimary}"
|
||||||
|
x:Name="TitleLabel"/>
|
||||||
|
<Border
|
||||||
|
BackgroundColor="{StaticResource Selected}"
|
||||||
|
Stroke="Transparent"
|
||||||
|
StrokeShape="RoundRectangle 250"
|
||||||
|
Margin="8, 0, 8, 0">
|
||||||
|
<Grid
|
||||||
|
ColumnDefinitions="Auto, *"
|
||||||
|
Padding="10, 3, 10, 3"
|
||||||
|
ColumnSpacing="4"
|
||||||
|
HorizontalOptions="Center"
|
||||||
|
>
|
||||||
|
<Grid.GestureRecognizers>
|
||||||
|
<TapGestureRecognizer
|
||||||
|
Tapped="TapGestureRecognizer_Tapped"
|
||||||
|
NumberOfTapsRequired="1"/>
|
||||||
|
</Grid.GestureRecognizers>
|
||||||
|
<Image
|
||||||
|
Grid.Column="0"
|
||||||
|
Source="bin.svg"
|
||||||
|
MaximumHeightRequest="15"/>
|
||||||
|
|
||||||
|
<Label
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="Delete"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ContentView>
|
@ -0,0 +1,44 @@
|
|||||||
|
namespace ShoopNCook.Views;
|
||||||
|
|
||||||
|
public partial class OwnedRecipeView : ContentView
|
||||||
|
{
|
||||||
|
|
||||||
|
public OwnedRecipeView() : this(5, "Title")
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public OwnedRecipeView(float note, string title)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Note = note;
|
||||||
|
Title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Note
|
||||||
|
{
|
||||||
|
set => SetNote(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
set => TitleLabel.Text = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetNote(float note)
|
||||||
|
{
|
||||||
|
int i = 1;
|
||||||
|
foreach (Image img in Stars.Children)
|
||||||
|
{
|
||||||
|
if (i <= note)
|
||||||
|
{
|
||||||
|
img.Opacity = 0;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else img.Opacity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
|
||||||
|
{
|
||||||
|
Console.WriteLine("This is a test");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue