Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/TextForge.Desktop/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
<local:ViewLocator />
</Application.DataTemplates>

<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
</Application.Styles>
<Application.Resources>
<!-- Color Primitives -->
<Color x:Key="SurfaceDarkColor">#1E1E1E</Color>
Expand Down Expand Up @@ -52,4 +48,12 @@
<Thickness x:Key="PaddingContainer">8</Thickness>
<Thickness x:Key="PaddingStatusBar">8,4</Thickness>
</Application.Resources>

<!-- Application Styles -->
<Application.Styles>
<FluentTheme />
<StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
<StyleInclude Source="avares://TextForge.Desktop/Styles/ButtonStyles.axaml" />
</Application.Styles>

</Application>
37 changes: 37 additions & 0 deletions src/TextForge.Desktop/Styles/ButtonStyles.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Styles xmlns="https://github.com/avaloniaui">
<!-- Base Button defaults: standard padding, corner radius -->
<Style Selector="Button">
<Setter Property="CornerRadius" Value="4" />
<Setter Property="Padding" Value="12,6" />
</Style>

<!-- Primary Button -->
<Style Selector="Button.primary">
<Setter Property="Background" Value="{DynamicResource ShellAccentBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
</Style>
<!-- Pointer-over state targeting the template ContentPresenter -->
<Style Selector="Button.primary:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="#005A9E" />
</Style>

<!-- Secondary Button -->
<Style Selector="Button.secondary">
<Setter Property="Background" Value="{DynamicResource SurfaceLightBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ShellBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
</Style>
<Style Selector="Button.secondary:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SurfaceMediumBrush}" />
</Style>

<!-- Destructive Button -->
<Style Selector="Button.destructive">
<Setter Property="Background" Value="#D83B01" /> <!-- Or define a DestructiveBrush token -->
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
</Style>
<Style Selector="Button.destructive:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="#A80000" />
</Style>
</Styles>
19 changes: 10 additions & 9 deletions src/TextForge.Desktop/Views/Components/TopCommandBarView.axaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:TextForge.Desktop.ViewModels"
x:Class="TextForge.Desktop.Views.Components.TopCommandBarView"
x:DataType="vm:TopCommandBarViewModel"
x:CompileBindings="True">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:TextForge.Desktop.ViewModels"
x:Class="TextForge.Desktop.Views.Components.TopCommandBarView"
x:DataType="vm:TopCommandBarViewModel"
x:CompileBindings="True">

<Border Background="{DynamicResource SurfaceLightBrush}"
Padding="{StaticResource PaddingContainer}">
Padding="{StaticResource PaddingContainer}">
<StackPanel Orientation="Horizontal" Spacing="{StaticResource SpacingXsValue}">
<Button Background="{DynamicResource BackgroundLightBrush}" Foreground="{DynamicResource TextPrimaryBrush}" Content="New" Command="{Binding NewDocumentCommand}" />
<Button Background="{DynamicResource BackgroundLightBrush}" Foreground="{DynamicResource TextPrimaryBrush}" Content="Open" Command="{Binding OpenDocumentCommand}" />
<Button Background="{DynamicResource BackgroundLightBrush}" Foreground="{DynamicResource TextPrimaryBrush}" Content="Save" Command="{Binding SaveDocumentCommand}" />
<Button Classes="primary" Content="New" Command="{Binding NewDocumentCommand}"
ToolTip.Tip="New Document (Ctrl+N)" />
<Button Classes="secondary" Content="Open" Command="{Binding OpenDocumentCommand}" />
<Button Classes="secondary" Content="Save" Command="{Binding SaveDocumentCommand}" />
</StackPanel>
</Border>
</UserControl>
9 changes: 9 additions & 0 deletions tests/TextForge.Desktop.Tests/ResourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@ public void AppResources_ContainRequiredSpacingTokens(string resourceKey)
Assert.True(app.Resources.ContainsKey(resourceKey), $"Resource '{resourceKey}' should be defined in App.axaml.");
Assert.NotNull(app.Resources[resourceKey]);
}
[Fact]
public void App_LoadsButtonStyles()
{
var app = new App();
app.Initialize();

// There should be 3 top-level styles: FluentTheme, ColorPicker, and ButtonStyles
Assert.True(app.Styles.Count >= 3, $"Expected at least 3 styles, got {app.Styles.Count}");
}
}
Loading