From 2a6d31e9bbbcc847c63f333b59c6ef900d3ea98c Mon Sep 17 00:00:00 2001 From: kikipoulet Date: Sat, 25 May 2024 17:55:28 +0200 Subject: [PATCH] notification redesign and action --- .../ControlsLibrary/Toasts/ToastsView.axaml | 7 ++ .../ControlsLibrary/Toasts/ToastsViewModel.cs | 6 ++ SukiUI/ColorTheme/Dark.axaml | 1 + SukiUI/ColorTheme/Light.axaml | 1 + SukiUI/Content/Icons.cs | 4 +- SukiUI/Controls/SukiToast.axaml | 81 ++++++++++++------- SukiUI/Controls/SukiToast.axaml.cs | 47 ++++++++++- SukiUI/Models/ToastModel.cs | 7 +- SukiUI/Theme/Index.axaml.cs | 1 + 9 files changed, 119 insertions(+), 36 deletions(-) diff --git a/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml b/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml index 482c96801..f4a6acb07 100644 --- a/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml +++ b/SukiUI.Demo/Features/ControlsLibrary/Toasts/ToastsView.axaml @@ -78,6 +78,13 @@ Content="Show Toast" /> + + + + + + + + + + + + + + + + diff --git a/SukiUI/Controls/SukiToast.axaml.cs b/SukiUI/Controls/SukiToast.axaml.cs index 90b983767..bbea9b7bd 100644 --- a/SukiUI/Controls/SukiToast.axaml.cs +++ b/SukiUI/Controls/SukiToast.axaml.cs @@ -5,6 +5,7 @@ using SukiUI.Models; using System; using System.Timers; +using Avalonia.Interactivity; using Avalonia.Media; using SukiUI.Content; using SukiUI.Enums; @@ -20,6 +21,7 @@ public class SukiToast : ContentControl private readonly Timer _timer = new(); private Action? _onClickedCallback; + private Action? _onActionCallback; public SukiToast() { @@ -49,12 +51,36 @@ public string Title get => GetValue(TitleProperty); set => SetValue(TitleProperty, value); } + + public static readonly StyledProperty ShowActionButtonProperty = + AvaloniaProperty.Register(nameof(ShowActionButton)); + + public bool ShowActionButton + { + get => GetValue(ShowActionButtonProperty); + set => SetValue(ShowActionButtonProperty, value); + } + + public static readonly StyledProperty ActionButtonContentProperty = + AvaloniaProperty.Register(nameof(ActionButtonContent)); + + public string ActionButtonContent + { + get => GetValue(ActionButtonContentProperty); + set => SetValue(ActionButtonContentProperty, value); + } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); e.NameScope.Get("PART_ToastCard").PointerPressed += ToastCardClickedHandler; + e.NameScope.Get