feat: Add banner infra.
This commit is contained in:
15
src/Ursa.Themes.Semi/Controls/Banner.axaml
Normal file
15
src/Ursa.Themes.Semi/Controls/Banner.axaml
Normal file
@@ -0,0 +1,15 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:u="https://irihi.tech/ursa">
|
||||
<!-- Add Resources Here -->
|
||||
<ControlTheme x:Key="{x:Type u:Banner}" TargetType="u:Banner">
|
||||
<Setter Property="u:Banner.Template">
|
||||
<ControlTemplate TargetType="u:Banner">
|
||||
<Border>
|
||||
<!-- -->
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
6
src/Ursa.Themes.Semi/Controls/_index.axaml
Normal file
6
src/Ursa.Themes.Semi/Controls/_index.axaml
Normal file
@@ -0,0 +1,6 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="Banner.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
21
src/Ursa.Themes.Semi/Index.axaml
Normal file
21
src/Ursa.Themes.Semi/Index.axaml
Normal file
@@ -0,0 +1,21 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Design.PreviewWith>
|
||||
<Border Padding="20">
|
||||
<!-- Add Controls for Previewer Here -->
|
||||
</Border>
|
||||
</Design.PreviewWith>
|
||||
<Styles.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceInclude x:Key="Dark" Source="./Themes/Dark/_index.axaml" />
|
||||
<ResourceInclude x:Key="Light" Source="Themes/Light/_index.axaml" />
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="../Controls/Banner.axaml" />
|
||||
<ResourceInclude Source="Themes/Shared/_index.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Styles.Resources>
|
||||
|
||||
<!-- Add Styles Here -->
|
||||
</Styles>
|
||||
3
src/Ursa.Themes.Semi/Themes/Dark/Banner.axaml
Normal file
3
src/Ursa.Themes.Semi/Themes/Dark/Banner.axaml
Normal file
@@ -0,0 +1,3 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
</ResourceDictionary>
|
||||
6
src/Ursa.Themes.Semi/Themes/Dark/_index.axaml
Normal file
6
src/Ursa.Themes.Semi/Themes/Dark/_index.axaml
Normal file
@@ -0,0 +1,6 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="Banner.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
3
src/Ursa.Themes.Semi/Themes/Light/Banner.axaml
Normal file
3
src/Ursa.Themes.Semi/Themes/Light/Banner.axaml
Normal file
@@ -0,0 +1,3 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
</ResourceDictionary>
|
||||
6
src/Ursa.Themes.Semi/Themes/Light/_index.axaml
Normal file
6
src/Ursa.Themes.Semi/Themes/Light/_index.axaml
Normal file
@@ -0,0 +1,6 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="Banner.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
3
src/Ursa.Themes.Semi/Themes/Shared/Banner.axaml
Normal file
3
src/Ursa.Themes.Semi/Themes/Shared/Banner.axaml
Normal file
@@ -0,0 +1,3 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
</ResourceDictionary>
|
||||
6
src/Ursa.Themes.Semi/Themes/Shared/_index.axaml
Normal file
6
src/Ursa.Themes.Semi/Themes/Shared/_index.axaml
Normal file
@@ -0,0 +1,6 @@
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- Add Resources Here -->
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceInclude Source="Banner.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
@@ -1,22 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>11</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview5" />
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Ursa\Ursa.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controls" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
||||
4
src/Ursa/AssemblyInfo.cs
Normal file
4
src/Ursa/AssemblyInfo.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
using Avalonia.Metadata;
|
||||
|
||||
[assembly:XmlnsDefinition("https://irihi.tech/ursa", "Ursa")]
|
||||
[assembly:XmlnsDefinition("https://irihi.tech/ursa", "Ursa.Controls")]
|
||||
44
src/Ursa/Controls/Banner.cs
Normal file
44
src/Ursa/Controls/Banner.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
public enum BannerType
|
||||
{
|
||||
None,
|
||||
Info,
|
||||
Warning,
|
||||
Danger,
|
||||
Success,
|
||||
}
|
||||
public class Banner: ContentControl
|
||||
{
|
||||
public static readonly StyledProperty<bool> CanCloseProperty = AvaloniaProperty.Register<Banner, bool>(
|
||||
nameof(CanClose));
|
||||
|
||||
public bool CanClose
|
||||
{
|
||||
get => GetValue(CanCloseProperty);
|
||||
set => SetValue(CanCloseProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> ShowIconProperty = AvaloniaProperty.Register<Banner, bool>(
|
||||
nameof(ShowIcon));
|
||||
|
||||
public bool ShowIcon
|
||||
{
|
||||
get => GetValue(ShowIconProperty);
|
||||
set => SetValue(ShowIconProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<object?> HeaderProperty = AvaloniaProperty.Register<Banner, object?>(
|
||||
nameof(Header));
|
||||
|
||||
public object? Header
|
||||
{
|
||||
get => GetValue(HeaderProperty);
|
||||
set => SetValue(HeaderProperty, value);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,18 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>11</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview5" />
|
||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controls\Menu" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user