<?xml version="1.0" encoding="utf-8" ?>
<ContentView
    x:Class="SeriesTracker.Controls.BottomSheet"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
    x:Name="this">
    <VerticalStackLayout>
        <Border
            BackgroundColor="Transparent"
            HeightRequest="30"
            Stroke="{AppThemeBinding Light={StaticResource Primary},
                                     Dark={StaticResource PrimaryDark}}"
            StrokeThickness="1"
            WidthRequest="30">
            <ImageButton
                x:Name="CloseButton"
                Clicked="CloseButton_Clicked"
                HeightRequest="20"
                HorizontalOptions="Center"
                Source="cross.png"
                WidthRequest="20">
                <ImageButton.Behaviors>
                    <toolkit:IconTintColorBehavior TintColor="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}" />
                </ImageButton.Behaviors>
            </ImageButton>
            <Border.StrokeShape>
                <RoundRectangle CornerRadius="50" />
            </Border.StrokeShape>
        </Border>
        <Border
            x:Name="myBorder"
            Margin="15,2,15,15"
            BackgroundColor="{AppThemeBinding Light={StaticResource LightPopUpBackground},
                                              Dark={StaticResource DarkBottomSheetBackground}}"
            StrokeThickness="0.2">
            <Border.Stroke>
                <LinearGradientBrush EndPoint="0,1">
                    <GradientStop Offset="0.1" Color="{AppThemeBinding Light={StaticResource LightPopUpBackground}, Dark={StaticResource DarkBottomSheetBackground}}" />
                    <GradientStop Color="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}">
                        <GradientStop.Offset>1.0</GradientStop.Offset>
                    </GradientStop>
                </LinearGradientBrush>
            </Border.Stroke>
            <Border.StrokeShape>
                <RoundRectangle CornerRadius="10" />
            </Border.StrokeShape>

            <Grid Margin="10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="45" />
                    <RowDefinition Height="45" />
                    <RowDefinition Height="1" />
                    <RowDefinition Height="45" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Image
                    Grid.Row="0"
                    Grid.Column="0"
                    HeightRequest="22"
                    HorizontalOptions="Center"
                    Source="vision.png"
                    WidthRequest="22">
                    <Image.Behaviors>
                        <toolkit:IconTintColorBehavior TintColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray300}}" />
                    </Image.Behaviors>
                </Image>
                <Label
                    x:Name="DetachButton"
                    Grid.Row="0"
                    Grid.Column="1"
                    BackgroundColor="Transparent"
                    FontSize="15"
                    HorizontalOptions="FillAndExpand"
                    HorizontalTextAlignment="Start"
                    Text="{Binding Source={x:Reference this}, Path=DetachText}"
                    TextColor="{AppThemeBinding Light={StaticResource Gray950},
                                                Dark={StaticResource Gray200}}"
                    VerticalTextAlignment="Center">
                    <Label.GestureRecognizers>
                        <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="DetachButton_Clicked" />
                    </Label.GestureRecognizers>
                </Label>
                <Image
                    Grid.Row="1"
                    Grid.Column="0"
                    HeightRequest="22"
                    HorizontalOptions="Center"
                    Source="edit.png"
                    WidthRequest="22">
                    <Image.Behaviors>
                        <toolkit:IconTintColorBehavior TintColor="{AppThemeBinding Light={StaticResource Gray600}, Dark={StaticResource Gray300}}" />
                    </Image.Behaviors>
                </Image>
                <Label
                    x:Name="EditButton"
                    Grid.Row="1"
                    Grid.Column="1"
                    BackgroundColor="Transparent"
                    FontSize="15"
                    HorizontalOptions="FillAndExpand"
                    HorizontalTextAlignment="Start"
                    Text="Изменить"
                    TextColor="{AppThemeBinding Light={StaticResource Gray950},
                                                Dark={StaticResource Gray200}}"
                    VerticalTextAlignment="Center">
                    <Label.GestureRecognizers>
                        <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="EditButton_Clicked" />
                    </Label.GestureRecognizers>
                </Label>
                <Line
                    Grid.Row="2"
                    Grid.Column="0"
                    Grid.ColumnSpan="2"
                    BackgroundColor="{StaticResource Gray600}" />
                <Image
                    Grid.Row="3"
                    Grid.Column="0"
                    HeightRequest="22"
                    HorizontalOptions="Center"
                    Source="delete.png"
                    WidthRequest="22">
                    <Image.Behaviors>
                        <toolkit:IconTintColorBehavior TintColor="{StaticResource Red}" />
                    </Image.Behaviors>
                </Image>
                <Label
                    x:Name="DeleteButton"
                    Grid.Row="3"
                    Grid.Column="1"
                    BackgroundColor="Transparent"
                    FontSize="15"
                    HorizontalOptions="FillAndExpand"
                    HorizontalTextAlignment="Start"
                    Text="Удалить"
                    TextColor="{StaticResource Red}"
                    VerticalTextAlignment="Center">
                    <Label.GestureRecognizers>
                        <TapGestureRecognizer NumberOfTapsRequired="1" Tapped="DeleteButton_Clicked" />
                    </Label.GestureRecognizers>
                </Label>

            </Grid>
        </Border>
    </VerticalStackLayout>
</ContentView>
