Merge pull request 'xaml/my-recipes' (#31) from xaml/my-recipes into master

Reviewed-on: ShopNCook/ShopNCook#31
pull/29/head^2
Maxime BATISTA 2 years ago
commit 85a80d2cb3

@ -43,5 +43,11 @@
Title="Favorites Page"
ContentTemplate="{DataTemplate pages:FavoritesPage}"
Route="Favorites" />
<ShellContent
Title="My Recipes Page"
ContentTemplate="{DataTemplate pages:MyRecipesPage}"
Route="MyRecipes" />
</TabBar>
</Shell>

@ -11,21 +11,26 @@
<!-- Header label and return button -->
<Grid
Grid.Row="0"
ColumnDefinitions="Auto, *"
Padding="10, 20, 0, 30">
Padding="20, 40, 0, 30"
ColumnDefinitions="*"
MaximumHeightRequest="60">
<ImageButton
Grid.Column="0"
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"/>
Source="arrow_back.svg"
HorizontalOptions="Start"/>
<Label
Grid.Column="1"
Grid.Column="0"
FontSize="24"
TextColor="{StaticResource TextColorPrimary}"
Text="Favorites recipes"
Text="Favorites Recipes"
MaximumHeightRequest="60"
FontFamily="PoppinsBold"
HorizontalOptions="Center"/>
HorizontalOptions="Center"
VerticalOptions="Center"/>
</Grid>
<!-- Favorite items -->

@ -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();
}
}

@ -13,23 +13,25 @@
<!-- Profile label and return button -->
<Grid
Grid.Row="0"
RowDefinitions="Auto, *"
ColumnDefinitions="*, 1.5*"
Margin="0, 0, 0, 40">
<HorizontalStackLayout>
<ImageButton
Grid.Column="0"
Padding="10, 20, 0, 30"
ColumnDefinitions="*"
MaximumHeightRequest="60">
<ImageButton
Grid.Column="0"
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"
HorizontalOptions="Start"/>
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"/>
</HorizontalStackLayout>
<Label
Grid.Column="1"
Grid.Column="0"
FontSize="24"
TextColor="{StaticResource TextColorPrimary}"
Text="Profile"
MaximumHeightRequest="60"
FontFamily="PoppinsBold"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</Grid>

@ -140,9 +140,7 @@
HorizontalOptions="Center"
Text="Submit"/>
</Border>
</HorizontalStackLayout>
</Grid>
</ScrollView>

@ -12,26 +12,31 @@
<!-- Search label and return button -->
<Grid
RowDefinitions="Auto, *"
ColumnDefinitions="*, 1.5*"
Margin="0, 0, 0, 30">
Grid.Row="0"
Padding="10, 20, 0, 30"
ColumnDefinitions="*"
MaximumHeightRequest="60">
<ImageButton
Grid.Column="0"
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"
HorizontalOptions="Start"/>
<HorizontalStackLayout>
<ImageButton
Grid.Column="0"
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"/>
</HorizontalStackLayout>
<Label
Grid.Column="1"
Grid.Column="0"
FontSize="24"
TextColor="{StaticResource TextColorPrimary}"
Text="Search"
MaximumHeightRequest="60"
FontFamily="PoppinsBold"
HorizontalOptions="Center"
VerticalOptions="Center"/>
</Grid>
<!-- Search input and filter button -->
<Grid

@ -0,0 +1,3 @@
<svg width="66" height="77" viewBox="0 0 66 77" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.4156 77C8.76563 77 7.32188 76.3583 6.08438 75.075C4.84688 73.7917 4.22813 72.2944 4.22813 70.5833V9.625H3.09375C2.21719 9.625 1.48242 9.31575 0.889453 8.69726C0.296484 8.07869 0 7.31226 0 6.39795C0 5.48358 0.296484 4.72338 0.889453 4.11736C1.48242 3.51134 2.21719 3.20833 3.09375 3.20833H19.3875C19.3875 2.28148 19.684 1.51505 20.277 0.909028C20.8699 0.303009 21.6047 0 22.4813 0H43.5188C44.3953 0 45.1301 0.307465 45.7231 0.922396C46.316 1.53733 46.6125 2.29931 46.6125 3.20833H62.9062C63.7828 3.20833 64.5176 3.51758 65.1105 4.13608C65.7035 4.75464 66 5.52108 66 6.43538C66 7.34976 65.7035 8.10995 65.1105 8.71597C64.5176 9.32199 63.7828 9.625 62.9062 9.625H61.7719V70.5833C61.7719 72.2944 61.1531 73.7917 59.9156 75.075C58.6781 76.3583 57.2344 77 55.5844 77H10.4156ZM21.3469 58.1778C21.3469 59.0868 21.6451 59.8488 22.2415 60.4637C22.838 61.0786 23.577 61.3861 24.4587 61.3861C25.3404 61.3861 26.0734 61.0786 26.6578 60.4637C27.2422 59.8488 27.5344 59.0868 27.5344 58.1778V21.9236C27.5344 21.0146 27.2362 20.2526 26.6398 19.6377C26.0433 19.0227 25.3042 18.7153 24.4226 18.7153C23.5409 18.7153 22.8078 19.0227 22.2234 19.6377C21.6391 20.2526 21.3469 21.0146 21.3469 21.9236V58.1778ZM38.4656 58.1778C38.4656 59.0868 38.7638 59.8488 39.3602 60.4637C39.9567 61.0786 40.6958 61.3861 41.5774 61.3861C42.4591 61.3861 43.1922 61.0786 43.7766 60.4637C44.3609 59.8488 44.6531 59.0868 44.6531 58.1778V21.9236C44.6531 21.0146 44.3549 20.2526 43.7585 19.6377C43.162 19.0227 42.423 18.7153 41.5413 18.7153C40.6596 18.7153 39.9266 19.0227 39.3422 19.6377C38.7578 20.2526 38.4656 21.0146 38.4656 21.9236V58.1778Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -7,7 +7,8 @@
<Style TargetType="Border"
x:Key="SecondaryBorder">
<Setter Property="StrokeShape" Value="RoundRectangle 25"/>
<Setter Property="Stroke" Value="{StaticResource BackgroundSecondary}"/>
<Setter Property="Stroke" Value="Transparent"/>
<Setter Property="StrokeThickness" Value="0"/>
<Setter Property="BackgroundColor" Value="{StaticResource BackgroundSecondary}"/>
</Style>
@ -15,7 +16,8 @@
x:Key="SecondaryBorderShadow">
<Setter Property="StrokeShape" Value="RoundRectangle 25"/>
<Setter Property="Stroke" Value="{StaticResource BackgroundSecondary}"/>
<Setter Property="Stroke" Value="Transparent"/>
<Setter Property="StrokeThickness" Value="0"/>
<Setter Property="BackgroundColor" Value="{StaticResource BackgroundSecondary}"/>
<Setter Property="Shadow">
<Setter.Value>
@ -42,6 +44,7 @@
x:Key="UserButton">
<Setter Property="FontFamily" Value="PoppinsMedium"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="TextColor" Value="{StaticResource ButtonText}"></Setter>
</Style>
<Style

@ -86,6 +86,9 @@
</ItemGroup>
<ItemGroup>
<MauiXaml Update="Pages\MyList.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\HeadedButton.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -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");
}
}

@ -3,7 +3,6 @@ namespace ShoopNCook.Views;
public partial class RecipeView : ContentView
{
public RecipeView(): this(5, "Title", "Subtitle")
{}

Loading…
Cancel
Save