<!--  Copyright (c) Microsoft Corporation. All rights reserved.  -->
<!--  Licensed under the MIT License. See LICENSE in the project root for license information.  -->

<UserControl
    x:Class="Peek.FilePreviewer.Controls.DriveControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:Peek.FilePreviewer.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    SizeChanged="SizeChanged_Handler"
    mc:Ignorable="d">

    <Grid
        MaxWidth="800"
        Margin="24"
        VerticalAlignment="Center"
        ColumnSpacing="24"
        RowSpacing="24">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Image
            Grid.Row="0"
            Grid.Column="0"
            Width="180"
            Height="180"
            Source="{x:Bind Source.IconPreview, Mode=OneWay}" />
        <StackPanel
            Grid.Row="0"
            Grid.Column="1"
            HorizontalAlignment="Left"
            VerticalAlignment="Center"
            Spacing="4">
            <TextBlock Style="{StaticResource TitleTextBlockStyle}" Text="{x:Bind Source.Name, Mode=OneWay}">
                <ToolTipService.ToolTip>
                    <ToolTip Content="{x:Bind Source.Name, Mode=OneWay}" />
                </ToolTipService.ToolTip>
            </TextBlock>
            <TextBlock Text="{x:Bind FormatType(Source.Type), Mode=OneWay}">
                <ToolTipService.ToolTip>
                    <ToolTip Content="{x:Bind FormatType(Source.Type), Mode=OneWay}" />
                </ToolTipService.ToolTip>
            </TextBlock>
            <TextBlock Text="{x:Bind FormatFileSystem(Source.FileSystem), Mode=OneWay}">
                <ToolTipService.ToolTip>
                    <ToolTip Content="{x:Bind FormatFileSystem(Source.FileSystem), Mode=OneWay}" />
                </ToolTipService.ToolTip>
            </TextBlock>
            <TextBlock Text="{x:Bind FormatCapacity(Source.Capacity), Mode=OneWay}">
                <ToolTipService.ToolTip>
                    <ToolTip Content="{x:Bind FormatCapacity(Source.Capacity), Mode=OneWay}" />
                </ToolTipService.ToolTip>
            </TextBlock>
        </StackPanel>

        <Grid
            Grid.Row="1"
            Grid.ColumnSpan="2"
            RowSpacing="4">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Border
                x:Name="CapacityBar"
                Grid.Row="0"
                Grid.ColumnSpan="2"
                Height="16"
                Background="{ThemeResource SurfaceStrokeColorDefaultBrush}"
                CornerRadius="8" />

            <Border
                Grid.Row="0"
                Grid.ColumnSpan="2"
                Height="16"
                Background="{ThemeResource AccentFillColorDefaultBrush}"
                CornerRadius="8">
                <Border.Clip>
                    <RectangleGeometry Rect="{x:Bind SpaceBarClip, Mode=OneWay}" />
                </Border.Clip>
            </Border>

            <TextBlock
                Grid.Row="1"
                Grid.Column="0"
                Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                Text="{x:Bind FormatUsedSpace(Source.UsedSpace), Mode=OneWay}" />
            <TextBlock
                Grid.Row="1"
                Grid.Column="1"
                HorizontalAlignment="Right"
                Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                Text="{x:Bind FormatFreeSpace(Source.FreeSpace), Mode=OneWay}" />
        </Grid>
    </Grid>
</UserControl>
