<?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"
             xmlns:local="clr-namespace:Linaris"
             x:Class="Linaris.MainPage"
             Title="Home"
             Style="{StaticResource PageFlyoutTrigger}">


    <Grid Style="{StaticResource GridFlyoutTrigger}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="100"/>
        </Grid.RowDefinitions>

        <local:Layout Grid.Column="0"/>

        <ScrollView Grid.Column="1" BackgroundColor="#404040">
            
            <VerticalStackLayout>
                
                <SearchBar Style="{StaticResource SearchBar}"/>

                <FlexLayout Direction="Row" AlignItems="Start" BindableLayout.ItemsSource="{Binding Albums}" JustifyContent="SpaceAround" Wrap="Wrap">
                    <BindableLayout.ItemTemplate>
                        <DataTemplate>
                            <Grid ColumnDefinitions="2*,*">
                                <VerticalStackLayout Margin="10" Grid.ColumnSpan="2">
                                    <Image Source="{Binding ImageURL}" Aspect="Fill" HorizontalOptions="Center" VerticalOptions="Center" HeightRequest="150" WidthRequest="150" IsAnimationPlaying="True" InputTransparent="False">
                                        <Image.GestureRecognizers>
                                            <TapGestureRecognizer Tapped="GoToAlbum"/>
                                        </Image.GestureRecognizers>
                                    </Image>
                                    <Label Text="{Binding Name}" Style="{StaticResource Titre}" HorizontalTextAlignment="Center" WidthRequest="250" LineBreakMode="TailTruncation"/>
                                </VerticalStackLayout>
                            </Grid>
                        </DataTemplate>
                    </BindableLayout.ItemTemplate>
                </FlexLayout>

            </VerticalStackLayout>

        </ScrollView>

        <local:FooterPage Grid.Row="1" Grid.ColumnSpan="2"/>

    </Grid>

</ContentPage>
