Skip to content

Commit

Permalink
リファクタリング
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Nov 3, 2023
1 parent 6527df3 commit 7e76755
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 93 deletions.
6 changes: 1 addition & 5 deletions src/Beutl/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:aconverters="using:Avalonia.Markup.Xaml.Converters"
xmlns:asyncImageLoader="using:AsyncImageLoader"
xmlns:convert="using:Beutl.Converters"
xmlns:local="using:Beutl"
xmlns:sty="using:FluentAvalonia.Styling"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:uip="using:FluentAvalonia.UI.Controls.Primitives">
xmlns:sty="using:FluentAvalonia.Styling">
<Application.Resources>
<ResourceDictionary>
<aconverters:ColorToBrushConverter x:Key="ColorToBrushConverter" />
Expand Down
15 changes: 4 additions & 11 deletions src/Beutl/Pages/ExtensionsPages/DevelopPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,10 @@
Spacing="4">
<TextBlock Text="{CompiledBinding Name}" />

<TextBlock IsVisible="{CompiledBinding DisplayName.Value, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Text="{CompiledBinding DisplayName.Value}">
<TextBlock.Styles>
<Style Selector="TextBlock">
<Setter Property="FontFamily" Value="XamlAutoFontFamily" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</TextBlock.Styles>
</TextBlock>
<TextBlock FontSize="16"
IsVisible="{CompiledBinding DisplayName.Value, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Text="{CompiledBinding DisplayName.Value}"
Theme="{StaticResource BaseTextBlockStyle}" />
</StackPanel>

<ui:CommandBarButton Grid.Column="3"
Expand Down
53 changes: 6 additions & 47 deletions src/Beutl/Pages/ExtensionsPages/DiscoverPages/RankingPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,42 +34,8 @@
<ComboBox x:Name="RankingComboBox"
VerticalAlignment="Bottom"
ItemsSource="{Binding Rankings}"
SelectedItem="{Binding SelectedRanking.Value}">
<ComboBox.Styles>
<Style Selector="ComboBox">
<Setter Property="Padding" Value="0,5,0,7" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />

<Style Selector="^:pointerover">
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
</Style>
<Style Selector="^ /template/ TextBlock#PlaceholderTextBlock">
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
</Style>
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</Style>

<Style Selector="^:pressed">
<Style Selector="^ /template/ TextBlock#PlaceholderTextBlock">
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
<Setter Property="Opacity" Value="0.5" />
</Style>
<Style Selector="^ /template/ ContentPresenter#ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
<Setter Property="Opacity" Value="0.5" />
</Style>
<Style Selector="^ /template/ Border#Background">
<Setter Property="Background" Value="Transparent" />
</Style>
</Style>
</Style>
</ComboBox.Styles>
SelectedItem="{Binding SelectedRanking.Value}"
Theme="{StaticResource LiteComboBoxStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="viewModel:RankingModel">
<TextBlock Text="{Binding DisplayName}" />
Expand Down Expand Up @@ -129,17 +95,10 @@
<StackPanel Spacing="4">
<TextBlock Text="{Binding Name}" />

<TextBlock IsVisible="{Binding DisplayName.Value, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Text="{Binding DisplayName.Value}">
<TextBlock.Styles>
<Style Selector="TextBlock">
<Setter Property="FontFamily" Value="XamlAutoFontFamily" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</TextBlock.Styles>
</TextBlock>
<TextBlock FontSize="16"
IsVisible="{Binding DisplayName.Value, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
Text="{Binding DisplayName.Value}"
Theme="{StaticResource BaseTextBlockStyle}" />
</StackPanel>

<TextBlock Grid.Row="1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@

<UserControl.Styles>
<Style Selector="TextBlock.name">
<Setter Property="FontFamily" Value="XamlAutoFontFamily" />
<Setter Property="Theme" Value="{StaticResource BaseTextBlockStyle}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</UserControl.Styles>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@
</Style>

<Style Selector="TextBlock.name">
<Setter Property="FontFamily" Value="XamlAutoFontFamily" />
<Setter Property="Theme" Value="{StaticResource BaseTextBlockStyle}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</UserControl.Styles>

Expand Down
5 changes: 1 addition & 4 deletions src/Beutl/Pages/ExtensionsPages/LibraryPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@

<UserControl.Styles>
<Style Selector="TextBlock.name">
<Setter Property="FontFamily" Value="XamlAutoFontFamily" />
<Setter Property="Theme" Value="{StaticResource BaseTextBlockStyle}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</UserControl.Styles>

Expand Down
29 changes: 11 additions & 18 deletions src/Beutl/Pages/SettingsPage.axaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
<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"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:ui="using:FluentAvalonia.UI.Controls"
x:Class="Beutl.Pages.SettingsPage">
<UserControl.Styles>
<Style Selector="Border.item">
<Setter Property="MaxHeight" Value="64" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />
</Style>
</UserControl.Styles>
<ui:NavigationView IsSettingsVisible="False"
<UserControl x:Class="Beutl.Pages.SettingsPage"
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:ui="using:FluentAvalonia.UI.Controls"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<ui:NavigationView x:Name="nav"
IsBackButtonVisible="True"
IsBackEnabled="{Binding #frame.CanGoBack}"
x:Name="nav">
IsSettingsVisible="False">
<ui:NavigationView.Styles>
<Style Selector="ui|NavigationView /template/ SplitView Border#ContentGridBorder">
<Setter Property="Background" Value="Transparent" />
Expand Down

0 comments on commit 7e76755

Please sign in to comment.