<?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:MangaMap"
             xmlns:modeles="clr-namespace:Models;assembly=Models"
             x:Class="MangaMap.Views.homePage"
             xmlns:views="clr-namespace:MangaMap.Views.Composants">


    <ContentPage.BindingContext>
        <modeles:Manager/>
    </ContentPage.BindingContext>

    <Grid RowDefinitions="40, *" >
        <local:NewContent1 HeightRequest="40" VerticalOptions="Start" Padding="10, 0"/>
        
    <ScrollView 
        BackgroundColor="#1E1E1E"
        Grid.Row="1">
            <VerticalStackLayout
            VerticalOptions="Center">

                <SearchBar 
                        Placeholder="Recherche"
                        TextChanged="OnTextChanged"
                        TextColor="Black"
                        BackgroundColor="White"
                        HorizontalTextAlignment="Center"
                        Margin="30"
                       />

                    <ScrollView>
                    <CollectionView ItemsSource="{Binding Oeuvre}" VerticalScrollBarVisibility="Always" x:Name="searchResults">
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <ImageButton
                                            HeightRequest="190"
                                            WidthRequest="170"
                                            Aspect="Fill"
                                            CornerRadius="15"
                                            Source="{Binding Affiche}"
                                            Clicked="AnimeImageClicked"
                                        />
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                        <CollectionView.ItemsLayout>
                            <GridItemsLayout Span="4" Orientation="Vertical" VerticalItemSpacing="30" HorizontalItemSpacing="15"/>
                        </CollectionView.ItemsLayout>
                    </CollectionView>
                    </ScrollView>

            </VerticalStackLayout>


        </ScrollView>
    </Grid>
</ContentPage>