<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:vm="using:SourceGit.ViewModels"
             xmlns:v="using:SourceGit.Views"
             xmlns:c="using:SourceGit.Converters"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="SourceGit.Views.OpenLocalRepository"
             x:DataType="vm:OpenLocalRepository">
  <StackPanel Orientation="Vertical" Margin="8,0,0,0">
    <StackPanel Orientation="Horizontal">
      <Path Width="16" Height="16"
            Margin="0,2,0,0"
            Data="{StaticResource Icons.Folder.Open}"/>

      <TextBlock FontSize="18"
                 Margin="8,0,0,0"
                 Classes="bold"
                 Text="{DynamicResource Text.OpenLocalRepository}"/>
    </StackPanel>

    <Grid Margin="8,16,0,0" RowDefinitions="32,32,32" ColumnDefinitions="Auto,*">
      <TextBlock Grid.Row="0" Grid.Column="0"
                 HorizontalAlignment="Right"
                 Margin="0,0,8,0"
                 Text="{DynamicResource Text.OpenLocalRepository.Path}"/>
      <TextBox Grid.Row="0" Grid.Column="1"
               Height="28"
               CornerRadius="3"
               Text="{Binding RepoPath, Mode=TwoWay}">
        <TextBox.InnerRightContent>
          <Button Classes="icon_button" Width="28" Height="28" Margin="4,0,0,0" Click="OnSelectRepositoryFolder">
            <Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
          </Button>
        </TextBox.InnerRightContent>
      </TextBox>

      <TextBlock Grid.Row="1" Grid.Column="0"
                 HorizontalAlignment="Right"
                 Margin="0,0,8,0"
                 Text="{DynamicResource Text.OpenLocalRepository.Group}"/>
      <ComboBox Grid.Row="1" Grid.Column="1"
                Height="28" Padding="8,0"
                VerticalAlignment="Center" HorizontalAlignment="Stretch"
                ItemsSource="{Binding Groups}"
                SelectedItem="{Binding Group, Mode=TwoWay}">
        <ComboBox.ItemTemplate>
          <DataTemplate DataType="vm:RepositoryNode">
            <TextBlock Text="{Binding Name, Mode=OneWay}"/>
          </DataTemplate>
        </ComboBox.ItemTemplate>
      </ComboBox>

      <TextBlock Grid.Row="2" Grid.Column="0"
                 HorizontalAlignment="Right"
                 Margin="0,0,8,0"
                 Text="{DynamicResource Text.OpenLocalRepository.Bookmark}"/>
      <ComboBox Grid.Row="2" Grid.Column="1"
                Height="28" Padding="8,0"
                VerticalAlignment="Center"
                ItemsSource="{Binding Bookmarks}"
                SelectedItem="{Binding Bookmark, Mode=TwoWay}">
        <ComboBox.ItemTemplate>
          <DataTemplate>
            <Grid Height="20">
              <Path Width="12" Height="12"
                    Fill="{Binding Converter={x:Static c:IntConverters.ToBookmarkBrush}}"
                    HorizontalAlignment="Center" VerticalAlignment="Center"
                    Data="{StaticResource Icons.Bookmark}"/>
            </Grid>
          </DataTemplate>
        </ComboBox.ItemTemplate>
      </ComboBox>
    </Grid>
  </StackPanel>
</UserControl>
