From 4c0e2e7b6ac8d68659267f0747b5d5dbd107af95 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Sat, 10 Dec 2022 00:51:23 +0800 Subject: [PATCH] feat: add typography related themes. for TextBlock, SelectableTextBlock, and Label. --- src/Semi.Avalonia.Demo/MainWindow.axaml | 3 + .../Pages/TextBlockDemo.axaml | 76 +++++++++++++++++ .../Pages/TextBlockDemo.axaml.cs | 18 +++++ src/Semi.Avalonia/Controls/Controls.axaml | 3 + src/Semi.Avalonia/Controls/Label.axaml | 81 +++++++++++++++++++ .../Controls/SelectableTextBlock.axaml | 62 ++++++++++++++ src/Semi.Avalonia/Controls/TextBlock.axaml | 65 +++++++++++++++ src/Semi.Avalonia/Themes/Base.axaml | 1 + src/Semi.Avalonia/Themes/Light/Light.axaml | 1 + .../Themes/Light/TextBlock.axaml | 42 ++++++++++ 10 files changed, 352 insertions(+) create mode 100644 src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml create mode 100644 src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml.cs create mode 100644 src/Semi.Avalonia/Controls/Label.axaml create mode 100644 src/Semi.Avalonia/Controls/SelectableTextBlock.axaml create mode 100644 src/Semi.Avalonia/Controls/TextBlock.axaml create mode 100644 src/Semi.Avalonia/Themes/Light/TextBlock.axaml diff --git a/src/Semi.Avalonia.Demo/MainWindow.axaml b/src/Semi.Avalonia.Demo/MainWindow.axaml index 1b98c8e..cc96feb 100644 --- a/src/Semi.Avalonia.Demo/MainWindow.axaml +++ b/src/Semi.Avalonia.Demo/MainWindow.axaml @@ -5,6 +5,9 @@ Title="Semi.Demo" d:DesignHeight="450" d:DesignWidth="800" mc:Ignorable="d"> + + + diff --git a/src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml b/src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml new file mode 100644 index 0000000..44e8fef --- /dev/null +++ b/src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml @@ -0,0 +1,76 @@ + + + + Styles for TextBlock + Header 1 + Header 1 + Header 1 + Header 1 + Header 1 + Header 1 + + Text + Secondary + Tertiary + Quaternary + Warning + Danger + Success + Disabled + Default Mark + Underline + Delete + + + Styles for SelectableTextBlock + Header 1 + Header 1 + Header 1 + Header 1 + Header 1 + Header 1 + + Text + Secondary + Tertiary + Quaternary + Warning + Danger + Success + Disabled + Default Mark + Underline + Delete + + + Styles for Label + + + + + + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml.cs b/src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml.cs new file mode 100644 index 0000000..1b509a5 --- /dev/null +++ b/src/Semi.Avalonia.Demo/Pages/TextBlockDemo.axaml.cs @@ -0,0 +1,18 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace Semi.Avalonia.Demo.Pages; + +public partial class TextBlockDemo : UserControl +{ + public TextBlockDemo() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } +} \ No newline at end of file diff --git a/src/Semi.Avalonia/Controls/Controls.axaml b/src/Semi.Avalonia/Controls/Controls.axaml index 448a2b8..e805b53 100644 --- a/src/Semi.Avalonia/Controls/Controls.axaml +++ b/src/Semi.Avalonia/Controls/Controls.axaml @@ -3,9 +3,12 @@ + + + diff --git a/src/Semi.Avalonia/Controls/Label.axaml b/src/Semi.Avalonia/Controls/Label.axaml new file mode 100644 index 0000000..c70f024 --- /dev/null +++ b/src/Semi.Avalonia/Controls/Label.axaml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Controls/SelectableTextBlock.axaml b/src/Semi.Avalonia/Controls/SelectableTextBlock.axaml new file mode 100644 index 0000000..e548da5 --- /dev/null +++ b/src/Semi.Avalonia/Controls/SelectableTextBlock.axaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Controls/TextBlock.axaml b/src/Semi.Avalonia/Controls/TextBlock.axaml new file mode 100644 index 0000000..06ff10c --- /dev/null +++ b/src/Semi.Avalonia/Controls/TextBlock.axaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Themes/Base.axaml b/src/Semi.Avalonia/Themes/Base.axaml index fa1a177..d7bf344 100644 --- a/src/Semi.Avalonia/Themes/Base.axaml +++ b/src/Semi.Avalonia/Themes/Base.axaml @@ -4,4 +4,5 @@ 14 Inter,-apple-system,BlinkMacSystemFont,Segoe UI,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif + Cascadia Code, Consolas, Inconsolata, monospace diff --git a/src/Semi.Avalonia/Themes/Light/Light.axaml b/src/Semi.Avalonia/Themes/Light/Light.axaml index f507da3..970f3b5 100644 --- a/src/Semi.Avalonia/Themes/Light/Light.axaml +++ b/src/Semi.Avalonia/Themes/Light/Light.axaml @@ -5,6 +5,7 @@ + diff --git a/src/Semi.Avalonia/Themes/Light/TextBlock.axaml b/src/Semi.Avalonia/Themes/Light/TextBlock.axaml new file mode 100644 index 0000000..4f7474b --- /dev/null +++ b/src/Semi.Avalonia/Themes/Light/TextBlock.axaml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + 12 + + 14 + 32 + 28 + 24 + 20 + 18 + 16 + 400 + 600 + 600 + 600 + + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 2 +