Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeferreir2k21 authored Dec 21, 2024
1 parent 3513c12 commit 3f3f41f
Showing 1 changed file with 211 additions and 0 deletions.
211 changes: 211 additions & 0 deletions CodeBlock.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<UserControl x:ConnectionId='1' x:Class="Microsoft.Terminal.UI.Markdown.CodeBlock"
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:Microsoft.Terminal.UI.Markdown"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
d:DesignHeight="256"
d:DesignWidth="1024"
mc:Ignorable="d">
<UserControl.Resources>

<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<Color x:Key="BlockBackgroundColor">#1e1e1e</Color>
<Color x:Key="BlockBorderColor">#30363d</Color>
<Color x:Key="PlayButtonHoveredColor">#90ef90</Color>
<Color x:Key="PlayButtonNormalColor">#88888888</Color>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<Color x:Key="BlockBackgroundColor">#f6f8fa</Color>
<Color x:Key="BlockBorderColor">#d3d3d3</Color>
<Color x:Key="PlayButtonHoveredColor">#257f01</Color>
<Color x:Key="PlayButtonNormalColor">#88222222</Color>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="BlockBackgroundColor"
ResourceKey="SystemColorWindowColorBrush" />
<StaticResource x:Key="BlockBorderColor"
ResourceKey="SystemColorWindowColorBrush" />
<StaticResource x:Key="PlayButtonHoveredColor"
ResourceKey="SystemColorHighlightColor" />
<StaticResource x:Key="PlayButtonNormalColor"
ResourceKey="SystemColorHighlightColor" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>


<Style x:Key="PlayButtonTemplate"
TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="4" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Background" Value="Transparent" />

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="ButtonBaseElement"
Padding="{TemplateBinding Padding}"
AutomationProperties.AccessibilityView="Raw"
Background="{TemplateBinding Background}"
BackgroundSizing="{TemplateBinding BackgroundSizing}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<Viewbox Width="20"
Height="20">
<Grid>
<FontIcon x:Name="ButtonBackgroundIcon"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
Foreground="{ThemeResource PlayButtonHoveredColor}"
Glyph="&#xF5b0;"
Visibility="Collapsed" />
<FontIcon x:Name="ButtonOutlineIcon"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
Foreground="{ThemeResource PlayButtonNormalColor}"
Glyph="&#xE768;" />
<muxc:ProgressRing x:Name="StatusProgress"
IsActive="False" />
</Grid>
</Viewbox>

<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">

<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter Target="ButtonBackgroundIcon.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>

<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="ButtonBackgroundIcon.Visibility" Value="Visible" />
</VisualState.Setters>
</VisualState>


<VisualState x:Name="Disabled" />
</VisualStateGroup>

<VisualStateGroup x:Name="PlayButtonStates">
<VisualState x:Name="Ready">
<VisualState.Setters>
<Setter Target="ButtonBackgroundIcon.Glyph" Value="&#xF5b0;" />
<Setter Target="ButtonOutlineIcon.Glyph" Value="&#xE768;" />
<Setter Target="StatusProgress.IsActive" Value="False" />
</VisualState.Setters>
</VisualState>

<VisualState x:Name="Running">
<VisualState.Setters>
<Setter Target="ButtonBackgroundIcon.Glyph" Value=" " />
<Setter Target="ButtonOutlineIcon.Glyph" Value=" " />
<Setter Target="StatusProgress.IsActive" Value="True" />
</VisualState.Setters>
</VisualState>

<VisualState x:Name="AlreadyRan">
<VisualState.Setters>
<Setter Target="ButtonBackgroundIcon.Glyph" Value="&#xe72c;" />
<Setter Target="ButtonOutlineIcon.Glyph" Value="&#xe72c;" />
<Setter Target="StatusProgress.IsActive" Value="False" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>

</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>

</Style>
<Style x:Key="CodeBlockLineTemplate"
TargetType="TextBlock">
<Setter Property="FontFamily" Value="Cascadia Mono, Consolas" />
</Style>

</ResourceDictionary>

</UserControl.Resources>

<Grid HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button x:ConnectionId='15' x:Name="RunButton"
Grid.Column="0"
Margin="0,9,0,0"
Padding="0"
VerticalAlignment="Top"
Style="{StaticResource PlayButtonTemplate}"

>
<Button.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="{StaticResource SystemAccentColor}" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="{StaticResource SystemAccentColor}" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="{StaticResource SystemAccentColor}" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="{StaticResource SystemAccentColor}" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="ButtonBackground"
Color="{ThemeResource SystemColorButtonFaceColor}" />
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="ButtonBackgroundPressed"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="ButtonForeground"
Color="{ThemeResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="{ThemeResource SystemColorHighlightTextColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Button.Resources>
</Button>
<Border Grid.Column="1"
Padding="0"
HorizontalAlignment="Stretch"
Background="{ThemeResource BlockBackgroundColor}"
BorderBrush="{ThemeResource BlockBorderColor}"
BorderThickness="1"
CornerRadius="4">
<ScrollViewer HorizontalAlignment="Stretch"
HorizontalScrollBarVisibility="Auto"
HorizontalScrollMode="Auto">
<Grid x:ConnectionId='16' x:Name="CommandsAndOutput"
Margin="14"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock x:ConnectionId='17' FontFamily="Cascadia Mono, Consolas"
IsTextSelectionEnabled="True"
/>
</Grid>
</ScrollViewer>
</Border>
</Grid>

</UserControl>

0 comments on commit 3f3f41f

Please sign in to comment.