feat: add about us page.
This commit is contained in:
234
demo/Ursa.Demo/Pages/AboutUsDemo.axaml
Normal file
234
demo/Ursa.Demo/Pages/AboutUsDemo.axaml
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
<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"
|
||||||
|
xmlns:collections="clr-namespace:Avalonia.Collections;assembly=Avalonia.Base"
|
||||||
|
xmlns:iri="https://irihi.tech/shared"
|
||||||
|
xmlns:viewModels="clr-namespace:Ursa.Demo.ViewModels"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
x:DataType="viewModels:AboutUsDemoViewModel"
|
||||||
|
x:Class="Ursa.Demo.Pages.AboutUsDemo">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Key="Light">
|
||||||
|
<collections:AvaloniaList x:Key="CanvasPalette" x:TypeArguments="Color">
|
||||||
|
<Color>#FFFDB7A5</Color>
|
||||||
|
<Color>#FFF6A0B5</Color>
|
||||||
|
<Color>#FFDD9BE0</Color>
|
||||||
|
<Color>#FFC4A7E9</Color>
|
||||||
|
<Color>#FFA7B3E1</Color>
|
||||||
|
<Color>#FF98CDFD</Color>
|
||||||
|
<Color>#FF95D8F8</Color>
|
||||||
|
</collections:AvaloniaList>
|
||||||
|
<LinearGradientBrush x:Key="TileTitleForeground" StartPoint="">
|
||||||
|
<GradientStop Offset="0.0" Color="#FFA20B48" />
|
||||||
|
<GradientStop Offset="0.3" Color="#FF71168A" />
|
||||||
|
<GradientStop Offset="0.6" Color="#FF46259E" />
|
||||||
|
<GradientStop Offset="1.0" Color="#FF28348C" />
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Key="Dark">
|
||||||
|
<collections:AvaloniaList x:Key="CanvasPalette" x:TypeArguments="Color">
|
||||||
|
<Color>#FFB42019</Color>
|
||||||
|
<Color>#FFA41751</Color>
|
||||||
|
<Color>#FF731F8A</Color>
|
||||||
|
<Color>#FF582EA0</Color>
|
||||||
|
<Color>#FF29368E</Color>
|
||||||
|
<Color>#FF135CB8</Color>
|
||||||
|
<Color>#FF0366A9</Color>
|
||||||
|
</collections:AvaloniaList>
|
||||||
|
<LinearGradientBrush x:Key="TileTitleForeground">
|
||||||
|
<GradientStop Offset="0.0" Color="#FFF7A8BC" />
|
||||||
|
<GradientStop Offset="0.3" Color="#FFDDA0E1" />
|
||||||
|
<GradientStop Offset="0.6" Color="#FFBEADE9" />
|
||||||
|
<GradientStop Offset="1.0" Color="#FFA7B4E2" />
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ControlTheme x:Key="TileButton" TargetType="Button">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||||
|
<Setter Property="Padding" Value="24" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<ControlTemplate>
|
||||||
|
<Border
|
||||||
|
Padding="0"
|
||||||
|
Classes="Hover"
|
||||||
|
Cursor="Hand"
|
||||||
|
Theme="{DynamicResource CardBorder}">
|
||||||
|
<Border.Transitions>
|
||||||
|
<Transitions>
|
||||||
|
<BrushTransition Property="BorderBrush" Duration="0.5" />
|
||||||
|
</Transitions>
|
||||||
|
</Border.Transitions>
|
||||||
|
<ContentPresenter
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter>
|
||||||
|
<Style Selector="^:pointerover /template/ Border">
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource TileTitleForeground}" />
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<UserControl.Styles>
|
||||||
|
<Style Selector="TextBlock.TileTitle">
|
||||||
|
<Setter Property="FontWeight" Value="700" />
|
||||||
|
<Setter Property="FontSize" Value="24" />
|
||||||
|
<Setter Property="Margin" Value="0 0 0 8" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TileTitleForeground}" />
|
||||||
|
</Style>
|
||||||
|
</UserControl.Styles>
|
||||||
|
<Grid RowDefinitions="*, Auto">
|
||||||
|
<ScrollViewer>
|
||||||
|
<StackPanel>
|
||||||
|
<Grid
|
||||||
|
Margin="0,96,0,48"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
ColumnDefinitions="*, *"
|
||||||
|
RowDefinitions="*, *">
|
||||||
|
<iri:IrihiLogo
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.RowSpan="2"
|
||||||
|
Grid.Column="0"
|
||||||
|
Fill="{DynamicResource TextBlockSecondaryForeground}"
|
||||||
|
Width="96"
|
||||||
|
Margin="0,0,24,0"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Classes="Secondary"
|
||||||
|
FontSize="48"
|
||||||
|
FontWeight="700"
|
||||||
|
Text="铱泓科技" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="12,0,0,0"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Classes="Secondary"
|
||||||
|
FontSize="16"
|
||||||
|
Text="IRIHI Technology" />
|
||||||
|
</Grid>
|
||||||
|
<TextBlock
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Classes="Tertiary"
|
||||||
|
FontSize="20"
|
||||||
|
FontWeight="700"
|
||||||
|
Text="聚焦生产力的美学进化" />
|
||||||
|
<TextBlock
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Classes="Tertiary"
|
||||||
|
FontSize="20"
|
||||||
|
Text="Aesthetic Evolution of Productivity" />
|
||||||
|
<UniformGrid
|
||||||
|
MaxWidth="810"
|
||||||
|
Margin="24"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Columns="2">
|
||||||
|
<Button
|
||||||
|
Margin="8"
|
||||||
|
Command="{Binding NavigateCommand}"
|
||||||
|
CommandParameter="semi"
|
||||||
|
Theme="{DynamicResource TileButton}">
|
||||||
|
<StackPanel HorizontalAlignment="Left">
|
||||||
|
<TextBlock Classes="TileTitle" Text="Semi" />
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0 0 0 8">
|
||||||
|
<Label Theme="{DynamicResource TagLabel}" Classes="Blue Ghost">Open Source</Label>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Text="开箱即用的独立主题库" />
|
||||||
|
<TextBlock Text="A ready-to-use standalone theme library" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="8"
|
||||||
|
Command="{Binding NavigateCommand}"
|
||||||
|
CommandParameter="ursa"
|
||||||
|
Theme="{DynamicResource TileButton}">
|
||||||
|
<StackPanel HorizontalAlignment="Left">
|
||||||
|
<TextBlock Classes="TileTitle" Text="Ursa" />
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0 0 0 8">
|
||||||
|
<Label Theme="{DynamicResource TagLabel}" Classes="Blue Ghost">Open Source</Label>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Text="高性能企业级桌面客户端控件库" />
|
||||||
|
<TextBlock Text="High-performance enterprise level control library for desktop apps" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="8"
|
||||||
|
Command="{Binding NavigateCommand}"
|
||||||
|
CommandParameter="mantra"
|
||||||
|
Theme="{DynamicResource TileButton}">
|
||||||
|
<StackPanel HorizontalAlignment="Left">
|
||||||
|
<TextBlock Classes="TileTitle" Text="Mantra" />
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0 0 0 8">
|
||||||
|
<Label Theme="{DynamicResource TagLabel}" Classes="Purple Ghost">Commercial</Label>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Text="高性能文字排版渲染控件库" />
|
||||||
|
<TextBlock Text="High-performance typography control library" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
Margin="8"
|
||||||
|
Command="{Binding NavigateCommand}"
|
||||||
|
CommandParameter="huska"
|
||||||
|
Theme="{DynamicResource TileButton}">
|
||||||
|
<StackPanel HorizontalAlignment="Left">
|
||||||
|
<TextBlock Classes="TileTitle" Text="Huska" />
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0 0 0 8">
|
||||||
|
<Label Theme="{DynamicResource TagLabel}" Classes="Purple Ghost">Commercial</Label>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Text="手绘风格主题库" />
|
||||||
|
<TextBlock Text="Hand-drawing theme library" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</UniformGrid>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="1"
|
||||||
|
Margin="0,16"
|
||||||
|
Spacing="32"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<HyperlinkButton
|
||||||
|
Classes="WithIcon"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Content="Homepage"
|
||||||
|
NavigateUri="https://irihi.tech">
|
||||||
|
<HyperlinkButton.Styles>
|
||||||
|
<Style Selector=".WithIcon /template/ PathIcon">
|
||||||
|
<Setter Property="Data" Value="{StaticResource SemiIconHome}" />
|
||||||
|
</Style>
|
||||||
|
</HyperlinkButton.Styles>
|
||||||
|
</HyperlinkButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<HyperlinkButton
|
||||||
|
Classes="WithIcon"
|
||||||
|
Content="GitHub"
|
||||||
|
NavigateUri="https://github.com/irihitech">
|
||||||
|
<HyperlinkButton.Styles>
|
||||||
|
<Style Selector=".WithIcon /template/ PathIcon">
|
||||||
|
<Setter Property="Data" Value="{StaticResource SemiIconGithubLogo}" />
|
||||||
|
</Style>
|
||||||
|
</HyperlinkButton.Styles>
|
||||||
|
</HyperlinkButton>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
25
demo/Ursa.Demo/Pages/AboutUsDemo.axaml.cs
Normal file
25
demo/Ursa.Demo/Pages/AboutUsDemo.axaml.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Ursa.Demo.ViewModels;
|
||||||
|
|
||||||
|
namespace Ursa.Demo.Pages;
|
||||||
|
|
||||||
|
public partial class AboutUsDemo : UserControl
|
||||||
|
{
|
||||||
|
public AboutUsDemo()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLoaded(RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLoaded(e);
|
||||||
|
if (DataContext is AboutUsDemoViewModel vm)
|
||||||
|
{
|
||||||
|
var launcher = TopLevel.GetTopLevel(this)?.Launcher;
|
||||||
|
vm.Launcher = launcher;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
demo/Ursa.Demo/ViewModels/AboutUsDemoViewModel.cs
Normal file
37
demo/Ursa.Demo/ViewModels/AboutUsDemoViewModel.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Avalonia.Platform.Storage;
|
||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
|
namespace Ursa.Demo.ViewModels;
|
||||||
|
|
||||||
|
public partial class AboutUsDemoViewModel: ObservableObject
|
||||||
|
{
|
||||||
|
public ICommand NavigateCommand { get; set; }
|
||||||
|
|
||||||
|
internal ILauncher? Launcher { get; set; }
|
||||||
|
|
||||||
|
public AboutUsDemoViewModel()
|
||||||
|
{
|
||||||
|
NavigateCommand = new AsyncRelayCommand<string>(OnNavigateAsync);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly IReadOnlyDictionary<string, string> _keyToUrlMapping = new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
["semi"] = "https://github.com/irihitech/Semi.Avalonia",
|
||||||
|
["ursa"] = "https://github.com/irihitech/Ursa.Avalonia",
|
||||||
|
["mantra"] = "https://www.bilibili.com/video/BV15pfKYbEEQ",
|
||||||
|
};
|
||||||
|
|
||||||
|
private async Task OnNavigateAsync(string? arg)
|
||||||
|
{
|
||||||
|
if (Launcher is not null && arg is not null && _keyToUrlMapping.TryGetValue(arg.ToLower(), out var uri))
|
||||||
|
{
|
||||||
|
await Launcher.LaunchUriAsync(new Uri(uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,6 +35,7 @@ public partial class MainViewViewModel : ViewModelBase
|
|||||||
Content = s switch
|
Content = s switch
|
||||||
{
|
{
|
||||||
MenuKeys.MenuKeyIntroduction => new IntroductionDemoViewModel(),
|
MenuKeys.MenuKeyIntroduction => new IntroductionDemoViewModel(),
|
||||||
|
MenuKeys.MenuKeyAboutUs => new AboutUsDemoViewModel(),
|
||||||
MenuKeys.MenuKeyAutoCompleteBox => new AutoCompleteBoxDemoViewModel(),
|
MenuKeys.MenuKeyAutoCompleteBox => new AutoCompleteBoxDemoViewModel(),
|
||||||
MenuKeys.MenuKeyAvatar => new AvatarDemoViewModel(),
|
MenuKeys.MenuKeyAvatar => new AvatarDemoViewModel(),
|
||||||
MenuKeys.MenuKeyBadge => new BadgeDemoViewModel(),
|
MenuKeys.MenuKeyBadge => new BadgeDemoViewModel(),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public class MenuViewModel : ViewModelBase
|
|||||||
MenuItems = new ObservableCollection<MenuItemViewModel>
|
MenuItems = new ObservableCollection<MenuItemViewModel>
|
||||||
{
|
{
|
||||||
new() { MenuHeader = "Introduction", Key = MenuKeys.MenuKeyIntroduction, IsSeparator = false },
|
new() { MenuHeader = "Introduction", Key = MenuKeys.MenuKeyIntroduction, IsSeparator = false },
|
||||||
|
new() { MenuHeader = "About Us", Key = MenuKeys.MenuKeyAboutUs, IsSeparator = false },
|
||||||
new() { MenuHeader = "Controls", IsSeparator = true },
|
new() { MenuHeader = "Controls", IsSeparator = true },
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
@@ -102,6 +103,7 @@ public class MenuViewModel : ViewModelBase
|
|||||||
public static class MenuKeys
|
public static class MenuKeys
|
||||||
{
|
{
|
||||||
public const string MenuKeyIntroduction = "Introduction";
|
public const string MenuKeyIntroduction = "Introduction";
|
||||||
|
public const string MenuKeyAboutUs = "AboutUs";
|
||||||
public const string MenuKeyAutoCompleteBox = "AutoCompleteBox";
|
public const string MenuKeyAutoCompleteBox = "AutoCompleteBox";
|
||||||
public const string MenuKeyAvatar = "Avatar";
|
public const string MenuKeyAvatar = "Avatar";
|
||||||
public const string MenuKeyBadge = "Badge";
|
public const string MenuKeyBadge = "Badge";
|
||||||
|
|||||||
Reference in New Issue
Block a user