<UserControl x:Class="PixiEditor.Views.UserControls.NewsFeed.NewsItem"
             x:ClassModifier="internal"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:PixiEditor.Views.UserControls.NewsFeed"
             xmlns:xaml="clr-namespace:PixiEditor.Models.Commands.XAML"
             xmlns:converters="clr-namespace:PixiEditor.Helpers.Converters"
             xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:gl="clr-namespace:System.Globalization;assembly=System.Runtime"
             mc:Ignorable="d" Name="newsItem"
             d:DesignHeight="300" d:DesignWidth="300">
    <Border Background="{StaticResource MainColor}" CornerRadius="5">
        <StackPanel Orientation="Vertical">
            <Grid>
                <Border Background="White" Name="Mask" CornerRadius="8 8 0 0"/>
                <StackPanel>
                    <Image Cursor="Hand" Margin="-1" Source="{Binding ElementName=newsItem, Path=News.CoverImageUrl}"
                           MouseDown="CoverImageClicked" Name="coverImage"/>
                    <StackPanel.OpacityMask>
                        <VisualBrush Visual="{Binding ElementName=Mask}" />
                    </StackPanel.OpacityMask>
                </StackPanel>
            </Grid>
            <StackPanel Margin="8 0" Orientation="Horizontal">
                <Image Margin="0 0 5 0" Width="25"
                       Source="{Binding ElementName=newsItem, Path=News.ResolvedIconUrl}"/>
                <Label VerticalAlignment="Center" Foreground="White" FontSize="14" HorizontalAlignment="Center">
                    <Hyperlink
                               Command="{xaml:Command PixiEditor.Links.OpenHyperlink, UseProvided=True}"
                               CommandParameter="{Binding ElementName=newsItem, Path=News.Url}"
                               Style="{StaticResource SettingsLink}">
                        <TextBlock Width="200" TextTrimming="CharacterEllipsis" MaxHeight="50"
                                   ToolTip="{Binding ElementName=newsItem, Path=News.Title}"
                                   Style="{StaticResource LinkTextBlock}" TextWrapping="Wrap"
                                   Text="{Binding ElementName=newsItem, Path=News.Title}"/>
                        <Run Text="" FontFamily="{StaticResource Feather}"/>
                    </Hyperlink>
                </Label>
            </StackPanel>
            <Grid>
                <Border Visibility="{Binding ElementName=newsItem, Path=News.IsNew, Converter={converters:BoolToVisibilityConverter}}"
                        Margin="2.5 2.5" Background="{StaticResource AccentRed}" HorizontalAlignment="Left"
                        Padding="5 2.5" CornerRadius="5">
                    <TextBlock Text="New!" Foreground="White" FontSize="12" FontStyle="Italic"/>
                </Border>
                <TextBlock Margin="8 5" HorizontalAlignment="Right" FontSize="12" Foreground="LightGray"
                           Text="{Binding ElementName=newsItem, Path=News.Date, StringFormat=d,
                           ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}"/>
            </Grid>
        </StackPanel>
    </Border>
</UserControl>
