Skip to content

Commit

Permalink
improve and rename dismiss button style
Browse files Browse the repository at this point in the history
add ToggleReplaceModeButton animation
  • Loading branch information
United600 committed Jul 22, 2024
1 parent eb08d4e commit af577b9
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 122 deletions.
2 changes: 1 addition & 1 deletion src/Notepads/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<ResourceDictionary Source="Notepads.Controls/Themes/Generic.xaml" />
<ResourceDictionary Source="Controls/TextEditor/TextEditorCore.xaml" />
<ResourceDictionary Source="Controls/FindAndReplace/FindAndReplacePlaceholder.xaml"></ResourceDictionary>
<ResourceDictionary Source="Resource/DismissButtonStyle.xaml"></ResourceDictionary>
<ResourceDictionary Source="Resource/TransparentButtonStyle.xaml" />
<ResourceDictionary Source="Resource/TransparentTextBoxStyle.xaml"></ResourceDictionary>
<ResourceDictionary Source="Resource/CustomSplitViewStyle.xaml"></ResourceDictionary>
<ResourceDictionary Source="Resource/InAppNotificationNoDismissButton.xaml"></ResourceDictionary>
Expand Down
6 changes: 3 additions & 3 deletions src/Notepads/Controls/DiffViewer/SideBySideDiffViewer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
<Grid Grid.Row="0" Background="{ThemeResource HeaderBackgroundThemeBrush}">
<Button x:Name="DismissButton"
x:Uid="FindAndReplace_DismissButton"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="42"
Padding="0"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
Content="&#xE894;"
FontSize="12"
IsTabStop="False">
<FontIcon FontSize="12" Glyph="&#xE894;" />
<Button.KeyboardAccelerators>
<KeyboardAccelerator Key="Escape" />
</Button.KeyboardAccelerators>
Expand Down
69 changes: 46 additions & 23 deletions src/Notepads/Controls/FindAndReplace/FindAndReplaceControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,36 @@
Grid.Column="0">
<Button x:Name="ToggleReplaceModeButton"
x:Uid="FindAndReplace_ToggleReplaceModeButton"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="20"
MinHeight="32"
d:Content="&#xE76C;"
FontSize="12"
Padding="0"
Click="ToggleReplaceModeButton_OnClick"
IsTabStop="False" />
IsTabStop="False">
<Button.Resources>
<x:String x:Key="ExpandCollapseChevronAnimationDuration">00:00:00.200</x:String>
<x:String x:Key="ExpandCollapseChevronKeySpline">0.1,0.25,0.1,0.75</x:String>

<Storyboard x:Name="ReplaceBarClosed">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandCollapseChevronTransform" Storyboard.TargetProperty="Rotation">
<SplineDoubleKeyFrame KeyTime="{StaticResource ExpandCollapseChevronAnimationDuration}" Value="0" KeySpline="{StaticResource ExpandCollapseChevronKeySpline}" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>

<Storyboard x:Name="ReplaceBarOpened">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ExpandCollapseChevronTransform" Storyboard.TargetProperty="Rotation">
<SplineDoubleKeyFrame KeyTime="{StaticResource ExpandCollapseChevronAnimationDuration}" Value="90" KeySpline="{StaticResource ExpandCollapseChevronKeySpline}" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Button.Resources>
<FontIcon FontSize="12"
Glyph="&#xE974;"
RenderTransformOrigin="0.5 0.5">
<FontIcon.RenderTransform>
<CompositeTransform x:Name="ExpandCollapseChevronTransform" />
</FontIcon.RenderTransform>
</FontIcon>
</Button>
</Grid>

<RelativePanel x:Name="FindBarPlaceHolder"
Expand Down Expand Up @@ -92,12 +115,11 @@
</Line>
<Button x:Name="OptionButton"
x:Uid="FindAndReplace_SearchOptionButton"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="32"
Height="32"
Content="&#xE712;"
FontSize="16"
IsTabStop="False">
<FontIcon FontSize="16" Glyph="&#xE712;" />
<Button.Flyout>
<MenuFlyout Placement="BottomEdgeAlignedRight">
<ToggleMenuFlyoutItem x:Name="MatchCaseToggle"
Expand Down Expand Up @@ -142,14 +164,14 @@
<Button x:Name="SearchBackwardButton"
x:Uid="FindAndReplace_SearchBackwardButton"
Grid.Column="0"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="36"
Height="32"
Content="&#xE74A;"
FontSize="16"
Padding="0"
Click="SearchBackwardButton_OnClick"
IsEnabled="False"
IsTabStop="False">
<FontIcon FontSize="16" Glyph="&#xE74A;" />
<Button.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Shift" Key="F3" />
</Button.KeyboardAccelerators>
Expand All @@ -158,14 +180,14 @@
<Button x:Name="SearchForwardButton"
x:Uid="FindAndReplace_SearchForwardButton"
Grid.Column="1"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="36"
Height="32"
Content="&#xE74B;"
FontSize="16"
Padding="0"
Click="SearchForwardButton_OnClick"
IsEnabled="False"
IsTabStop="False">
<FontIcon FontSize="16" Glyph="&#xE74B;" />
<Button.KeyboardAccelerators>
<KeyboardAccelerator Key="F3" />
</Button.KeyboardAccelerators>
Expand All @@ -174,13 +196,14 @@
<Button x:Name="DismissButton"
x:Uid="FindAndReplace_DismissButton"
Grid.Column="2"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="36"
Height="32"
Content="&#xE894;"
FontSize="16"
Padding="0"
Click="DismissButton_OnClick"
IsTabStop="False" />
IsTabStop="False">
<FontIcon FontSize="16" Glyph="&#xE894;" />
</Button>
</Grid>

<Grid x:Name="ReplaceBarPlaceHolder"
Expand Down Expand Up @@ -215,14 +238,14 @@
<Button x:Name="ReplaceButton"
x:Uid="FindAndReplace_ReplaceButton"
Grid.Column="0"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="36"
Height="32"
Content="&#xE8AB;"
FontSize="16"
Padding="0"
Click="ReplaceButton_OnClick"
IsEnabled="False"
IsTabStop="False">
<FontIcon FontSize="16" Glyph="&#xE8AB;" />
<Button.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Menu" Key="R" />
</Button.KeyboardAccelerators>
Expand All @@ -231,14 +254,14 @@
<Button x:Name="ReplaceAllButton"
x:Uid="FindAndReplace_ReplaceAllButton"
Grid.Column="1"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="36"
Height="32"
Content="&#xE7FD;"
FontSize="16"
Padding="0"
Click="ReplaceAllButton_OnClick"
IsEnabled="False"
IsTabStop="False">
<FontIcon FontSize="16" Glyph="&#xE7FD;" />
<Button.KeyboardAccelerators>
<KeyboardAccelerator Modifiers="Control,Menu" Key="Enter" />
</Button.KeyboardAccelerators>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void ShowReplaceBar(bool showReplaceBar)
{
ToggleReplaceModeButtonGrid.SetValue(Grid.RowSpanProperty, 2);
ToggleReplaceModeButton.VerticalAlignment = VerticalAlignment.Stretch;
ToggleReplaceModeButton.Content = "\uE70D";
ReplaceBarOpened.Begin();
ReplaceBarPlaceHolder.Visibility = Visibility.Visible;
if (!string.IsNullOrEmpty(FindBar.Text))
{
Expand All @@ -130,8 +130,7 @@ public void ShowReplaceBar(bool showReplaceBar)
else
{
ToggleReplaceModeButtonGrid.SetValue(Grid.RowSpanProperty, 1);
ToggleReplaceModeButton.VerticalAlignment = VerticalAlignment.Top;
ToggleReplaceModeButton.Content = "\uE76C";
ReplaceBarClosed.Begin();
ReplaceBarPlaceHolder.Visibility = Visibility.Collapsed;
ReplaceButton.IsEnabled = false;
ReplaceAllButton.IsEnabled = false;
Expand Down
6 changes: 4 additions & 2 deletions src/Notepads/Controls/GoTo/GoToControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@
<Button x:Name="SearchButton"
x:Uid="GoTo_SearchButton"
Grid.Column="2"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="36"
Height="32"
Padding="0"
VerticalAlignment="Top"
Content="&#xEBE7;"
FontSize="16"
Expand All @@ -62,9 +63,10 @@
<Button x:Name="DismissButton"
x:Uid="FindAndReplace_DismissButton"
Grid.Column="3"
Style="{StaticResource DismissButtonStyle}"
Style="{StaticResource TransparentButtonStyle}"
Width="36"
Height="32"
Padding="0"
VerticalAlignment="Top"
Content="&#xE894;"
FontSize="16"
Expand Down
2 changes: 1 addition & 1 deletion src/Notepads/Notepads.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resource\DismissButtonStyle.xaml">
<Page Include="Resource\TransparentButtonStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down
89 changes: 0 additions & 89 deletions src/Notepads/Resource/DismissButtonStyle.xaml

This file was deleted.

Loading

0 comments on commit af577b9

Please sign in to comment.