Skip to content

Commit

Permalink
Clean up and corrections (#7)
Browse files Browse the repository at this point in the history
* Remove unnecessary dependency on Themes.Simple

* Cleanup & correction on CheckBox

* Change 'Primary' button class to 'accent'

This it to match class name already in use in prod
  • Loading branch information
apman authored Dec 6, 2024
1 parent ecc1810 commit 76cffcc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
2 changes: 0 additions & 2 deletions samples/SampleApp/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
</Application.Resources>

<Application.Styles>
<!-- <StyleInclude Source="avares://Avalonia.Themes.Simple/SimpleTheme.axaml" /> -->
<!-- <StyleInclude Source="avares://Avalonia.Themes.Fluent/FluentTheme.axaml" /> -->
<StyleInclude Source="avares://Devolutions.MacOS.Avalonia.Theme/MacOSTheme.axaml" />
</Application.Styles>
</Application>
14 changes: 7 additions & 7 deletions samples/SampleApp/DemoPages/ButtonDemo.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
<Grid ColumnDefinitions="100, 72, 40, 72, Auto" RowDefinitions="50, 50, 50" Margin="20">
<TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">Default</TextBlock>
<Button Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">Cancel</Button>
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">Primary</TextBlock>
<Button Grid.Row="1" Grid.Column="1" Classes="Primary" VerticalAlignment="Center">Open</Button>
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">accent</TextBlock>
<Button Grid.Row="1" Grid.Column="1" Classes="accent" VerticalAlignment="Center">Open</Button>
<TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Disabled</TextBlock>
<Button Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Classes="Primary" IsEnabled="False">Submit</Button>
<Button Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Classes="accent" IsEnabled="False">Submit</Button>
<TextBlock Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center">/</TextBlock>
<Button Grid.Row="1" Grid.Column="3" Classes="PrimaryPrecise" VerticalAlignment="Center">Open</Button>
<Button Grid.Row="1" Grid.Column="3" Classes="accentPrecise" VerticalAlignment="Center">Open</Button>
<TextBlock Grid.Row="1" Grid.Column="4" VerticalAlignment="Center" Margin="10 0 0 0">(More precise look, but not responsive to user-selected accent colour)</TextBlock>
</Grid>
</Border>
<Border Background="{DynamicResource LayoutBackgroundLowBrush}" Margin="20 0">
<Grid ColumnDefinitions="100, 72, 40, 72, Auto" RowDefinitions="50, 50, 50" Margin="20">
<TextBlock Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">Default</TextBlock>
<Button Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">Cancel</Button>
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">Primary</TextBlock>
<Button Grid.Row="1" Grid.Column="1" Classes="Primary" VerticalAlignment="Center">Open</Button>
<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">accent</TextBlock>
<Button Grid.Row="1" Grid.Column="1" Classes="accent" VerticalAlignment="Center">Open</Button>
<TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Disabled</TextBlock>
<Button Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Classes="Primary" IsEnabled="False">Submit</Button>
<Button Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Classes="accent" IsEnabled="False">Submit</Button>
</Grid>
</Border>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<FontWeight x:Key="ButtonFontWeight">400</FontWeight>

<!-- TODO: To be replaced by templated button control (accent colour with hard-coded gradient overlay) -->
<VisualBrush x:Key="TempButtonPrimaryBackgroundPrecise" Stretch="Fill">
<VisualBrush x:Key="TempButtonaccentBackgroundPrecise" Stretch="Fill">
<VisualBrush.Visual>
<Panel>
<!-- <Rectangle Fill="{StaticResource SystemAccentColor}" Width="20" Height="20" /> // might not have access to Logical tree where resources are defined-->
Expand All @@ -87,7 +87,7 @@
</VisualBrush.Visual>
</VisualBrush>

<VisualBrush x:Key="TempButtonPrimaryPressedBackgroundPrecise" Stretch="Fill">
<VisualBrush x:Key="TempButtonaccentPressedBackgroundPrecise" Stretch="Fill">
<VisualBrush.Visual>
<Panel>
<!-- <Rectangle Fill="{StaticResource ControlBackgroundAccentMidBrush}" Width="20" Height="20" /> -->
Expand Down
12 changes: 6 additions & 6 deletions src/Devolutions.MacOS.Avalonia.Theme/Controls/Button.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<StackPanel Width="110">
<Button Content="Cancel" Margin="10" />
<Button Content="Test" Margin="10 " IsEnabled="False" />
<Button Classes="Primary" Content="Open" Margin="10 " />
<Button Classes="Primary" Content="Open" Margin="10 " IsEnabled="False" />
<Button Classes="accent" Content="Open" Margin="10 " />
<Button Classes="accent" Content="Open" Margin="10 " IsEnabled="False" />
</StackPanel>
</Design.PreviewWith>

Expand All @@ -30,7 +30,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource ControlBorderDisabledBrush}" />
</Style>

<Style Selector="^.Primary">
<Style Selector="^.accent">
<Setter Property="Background" Value="{DynamicResource ControlBackgroundAccentRaisedBrush}" />
<Setter Property="Foreground" Value="{DynamicResource ControlForegroundAccentHighBrush}" />
<Setter Property="BorderThickness" Value="0" />
Expand All @@ -44,12 +44,12 @@
</Style>
</Style>

<Style Selector="^.PrimaryPrecise">
<Setter Property="Background" Value="{DynamicResource TempButtonPrimaryBackgroundPrecise}" />
<Style Selector="^.accentPrecise">
<Setter Property="Background" Value="{DynamicResource TempButtonaccentBackgroundPrecise}" />
<Setter Property="Foreground" Value="{DynamicResource ControlForegroundAccentHighBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Style Selector="^:pressed">
<Setter Property="Background" Value="{DynamicResource TempButtonPrimaryPressedBackgroundPrecise}" />
<Setter Property="Background" Value="{DynamicResource TempButtonaccentPressedBackgroundPrecise}" />
</Style>
<Style Selector="^:disabled">
<Setter Property="Foreground" Value="{DynamicResource ForegroundLowBrush}" />
Expand Down
3 changes: 1 addition & 2 deletions src/Devolutions.MacOS.Avalonia.Theme/Controls/CheckBox.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
</Border>
</Design.PreviewWith>

<StreamGeometry x:Key="CheckMarkPathData">M5.5 10.586 1.707 6.793A1 1 0 0 0 .293 8.207l4.5 4.5a1 1 0 0 0 1.414 0l11-11A1 1 0 0 0 15.793.293L5.5 10.586Z</StreamGeometry>

<ControlTheme x:Key="{x:Type CheckBox}"
TargetType="CheckBox">
<Setter Property="Foreground" Value="{DynamicResource ForegroundHighBrush}" />
Expand Down Expand Up @@ -99,6 +97,7 @@
<Setter Property="Background" Value="{DynamicResource ControlBackgroundAccentRaisedBrush}" />
<Style Selector="^/template/ Border#border">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BoxShadow" Value="0 0 Transparent" /> <!-- TODO: How do you set it to None? -->
</Style>
<Style Selector="^/template/ Rectangle#indeterminateMark">
<Setter Property="IsVisible" Value="True" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.2.1" />
<PackageReference Include="Avalonia.Themes.Simple" Version="11.2.1"/>
<PackageReference Include="Avalonia" Version="11.2.1"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.1"/>
</ItemGroup>
</Project>
Expand Down

0 comments on commit 76cffcc

Please sign in to comment.