-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #257 from artehe/ui-is-hards
Update UI/UX for most pages
- Loading branch information
Showing
66 changed files
with
854 additions
and
576 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Media; | ||
|
||
namespace SIT.Manager.Theme.Assists; | ||
|
||
public static class BoxShadowAssist | ||
{ | ||
public static readonly AvaloniaProperty<bool> InsetProperty = AvaloniaProperty.RegisterAttached<AvaloniaObject, bool>("Inset", typeof(BoxShadowAssist), false); | ||
public static readonly AvaloniaProperty<double> BlurProperty = AvaloniaProperty.RegisterAttached<AvaloniaObject, double>("Blur", typeof(BoxShadowAssist), 8); | ||
public static readonly AvaloniaProperty<double> OffsetXProperty = AvaloniaProperty.RegisterAttached<AvaloniaObject, double>("OffsetX", typeof(BoxShadowAssist), 1.5); | ||
public static readonly AvaloniaProperty<double> OffsetYProperty = AvaloniaProperty.RegisterAttached<AvaloniaObject, double>("OffsetY", typeof(BoxShadowAssist), 1.5); | ||
public static readonly AvaloniaProperty<Color> ColorProperty = AvaloniaProperty.RegisterAttached<AvaloniaObject, Color>("Color", typeof(BoxShadowAssist), new Color(0xF0, 0x00, 0x00, 0x00)); | ||
public static readonly AvaloniaProperty<double> SpreadProperty = AvaloniaProperty.RegisterAttached<AvaloniaObject, double>("Spread", typeof(BoxShadowAssist), 4); | ||
|
||
static BoxShadowAssist() | ||
{ | ||
InsetProperty.Changed.Subscribe(InsetPropertyCallback); | ||
BlurProperty.Changed.Subscribe(BlurPropertyCallback); | ||
OffsetXProperty.Changed.Subscribe(OffsetXPropertyCallback); | ||
OffsetYProperty.Changed.Subscribe(OffsetYPropertyCallback); | ||
ColorProperty.Changed.Subscribe(ColorPropertyCallback); | ||
SpreadProperty.Changed.Subscribe(SpreadPropertyCallback); | ||
} | ||
|
||
|
||
private static BoxShadows UpdateBoxShadow(bool inset, double blur, double offsetX, double offsetY, Color color, double spread) | ||
{ | ||
return new BoxShadows(new() | ||
{ | ||
IsInset = inset, | ||
Blur = blur, | ||
OffsetX = offsetX, | ||
OffsetY = offsetY, | ||
Color = color, | ||
Spread = spread | ||
}); | ||
} | ||
|
||
private static void InsetPropertyCallback(AvaloniaPropertyChangedEventArgs<bool> args) | ||
{ | ||
if (args.Sender is Border border) | ||
{ | ||
border.BoxShadow = UpdateBoxShadow(args.NewValue.Value, GetBlur(args.Sender), GetOffsetX(args.Sender), GetOffsetY(args.Sender), GetColor(args.Sender), GetSpread(args.Sender)); | ||
} | ||
} | ||
|
||
private static void BlurPropertyCallback(AvaloniaPropertyChangedEventArgs<double> args) | ||
{ | ||
if (args.Sender is Border border) | ||
{ | ||
border.BoxShadow = UpdateBoxShadow(GetInset(args.Sender), args.NewValue.Value, GetOffsetX(args.Sender), GetOffsetY(args.Sender), GetColor(args.Sender), GetSpread(args.Sender)); | ||
} | ||
} | ||
|
||
private static void OffsetXPropertyCallback(AvaloniaPropertyChangedEventArgs<double> args) | ||
{ | ||
if (args.Sender is Border border) | ||
{ | ||
border.BoxShadow = UpdateBoxShadow(GetInset(args.Sender), GetBlur(args.Sender), args.NewValue.Value, GetOffsetY(args.Sender), GetColor(args.Sender), GetSpread(args.Sender)); | ||
} | ||
} | ||
|
||
private static void OffsetYPropertyCallback(AvaloniaPropertyChangedEventArgs<double> args) | ||
{ | ||
if (args.Sender is Border border) | ||
{ | ||
border.BoxShadow = UpdateBoxShadow(GetInset(args.Sender), GetBlur(args.Sender), GetOffsetX(args.Sender), args.NewValue.Value, GetColor(args.Sender), GetSpread(args.Sender)); | ||
} | ||
} | ||
|
||
private static void ColorPropertyCallback(AvaloniaPropertyChangedEventArgs<Color> args) | ||
{ | ||
if (args.Sender is Border border) | ||
{ | ||
border.BoxShadow = UpdateBoxShadow(GetInset(args.Sender), GetBlur(args.Sender), GetOffsetX(args.Sender), GetOffsetY(args.Sender), args.NewValue.Value, GetSpread(args.Sender)); | ||
} | ||
} | ||
|
||
private static void SpreadPropertyCallback(AvaloniaPropertyChangedEventArgs<double> args) | ||
{ | ||
if (args.Sender is Border border) | ||
{ | ||
border.BoxShadow = UpdateBoxShadow(GetInset(args.Sender), args.NewValue.Value, GetOffsetX(args.Sender), GetOffsetY(args.Sender), GetColor(args.Sender), args.NewValue.Value); | ||
} | ||
} | ||
|
||
public static void SetInset(AvaloniaObject element, bool value) => element.SetValue(InsetProperty, value); | ||
public static bool GetInset(AvaloniaObject element) => element.GetValue<bool>(InsetProperty); | ||
|
||
public static void SeBlur(AvaloniaObject element, double value) => element.SetValue(BlurProperty, value); | ||
public static double GetBlur(AvaloniaObject element) => element.GetValue<double>(BlurProperty); | ||
|
||
public static void SetOffsetX(AvaloniaObject element, double value) => element.SetValue(OffsetXProperty, value); | ||
public static double GetOffsetX(AvaloniaObject element) => element.GetValue<double>(OffsetXProperty); | ||
|
||
public static void SetOffsetY(AvaloniaObject element, double value) => element.SetValue(OffsetYProperty, value); | ||
public static double GetOffsetY(AvaloniaObject element) => element.GetValue<double>(OffsetYProperty); | ||
|
||
public static void SetColor(AvaloniaObject element, Color value) => element.SetValue(ColorProperty, value); | ||
public static Color GetColor(AvaloniaObject element) => element.GetValue<Color>(ColorProperty); | ||
|
||
public static void SetSpread(AvaloniaObject element, double value) => element.SetValue(SpreadProperty, value); | ||
public static double GetSpread(AvaloniaObject element) => element.GetValue<double>(SpreadProperty); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Avalonia.Reactive; | ||
using System; | ||
|
||
namespace SIT.Manager.Theme.Assists; | ||
|
||
public static class Observable | ||
{ | ||
public static IDisposable Subscribe<T>(this IObservable<T> source, Action<T> action) | ||
{ | ||
return source.Subscribe(new AnonymousObserver<T>(action)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<ResourceDictionary xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="clr-namespace:SIT.Manager.Theme.Controls" | ||
xmlns:assists="clr-namespace:SIT.Manager.Theme.Assists"> | ||
<Design.PreviewWith> | ||
<Border Padding="40" | ||
Background="{DynamicResource AppAccent}"> | ||
<controls:Card> | ||
<TextBlock Text="Hello World!" /> | ||
</controls:Card> | ||
</Border> | ||
</Design.PreviewWith> | ||
|
||
<ControlTheme x:Key="Card" TargetType="controls:Card"> | ||
<Setter Property="assists:BoxShadowAssist.Inset" Value="False" /> | ||
<Setter Property="assists:BoxShadowAssist.Blur" Value="8" /> | ||
<Setter Property="assists:BoxShadowAssist.OffsetX" Value="2" /> | ||
<Setter Property="assists:BoxShadowAssist.OffsetY" Value="2" /> | ||
<Setter Property="assists:BoxShadowAssist.Color" Value="{DynamicResource AppPrimary}" /> | ||
<Setter Property="assists:BoxShadowAssist.Spread" Value="4" /> | ||
|
||
<Setter Property="Background" Value="{DynamicResource AppPrimary}"/> | ||
<Setter Property="ClipToBounds" Value="False" /> | ||
<Setter Property="CornerRadius" Value="4" /> | ||
<Setter Property="Focusable" Value="False" /> | ||
<Setter Property="Foreground" Value="{DynamicResource AppSecondary}"/> | ||
<Setter Property="Padding" Value="8" /> | ||
|
||
<Setter Property="Template"> | ||
<ControlTemplate> | ||
<Panel Name="PART_RootPanel"> | ||
<Border Name="PART_BackgroundBorder" | ||
Background="{TemplateBinding Background}" | ||
BorderBrush="{TemplateBinding BorderBrush}" | ||
BorderThickness="{TemplateBinding BorderThickness}" | ||
CornerRadius="{TemplateBinding CornerRadius}" | ||
assists:BoxShadowAssist.Inset="{TemplateBinding assists:BoxShadowAssist.Inset}" | ||
assists:BoxShadowAssist.Blur="{TemplateBinding assists:BoxShadowAssist.Blur}" | ||
assists:BoxShadowAssist.OffsetX="{TemplateBinding assists:BoxShadowAssist.OffsetX}" | ||
assists:BoxShadowAssist.OffsetY="{TemplateBinding assists:BoxShadowAssist.OffsetY}" | ||
assists:BoxShadowAssist.Color="{TemplateBinding assists:BoxShadowAssist.Color}" | ||
assists:BoxShadowAssist.Spread="{TemplateBinding assists:BoxShadowAssist.Spread}"/> | ||
<Border Name="PART_InnerBorder" | ||
CornerRadius="{TemplateBinding CornerRadius}" | ||
ClipToBounds="{TemplateBinding InsideClipping}"> | ||
<ContentPresenter Name="ContentPresenter" | ||
Padding="{TemplateBinding Padding}" | ||
Content="{TemplateBinding Content}" | ||
Foreground="{TemplateBinding Foreground}" | ||
ContentTemplate="{TemplateBinding ContentTemplate}" /> | ||
</Border> | ||
</Panel> | ||
</ControlTemplate> | ||
</Setter> | ||
</ControlTheme> | ||
|
||
<ControlTheme x:Key="{x:Type controls:Card}" | ||
TargetType="controls:Card" | ||
BasedOn="{StaticResource Card}" /> | ||
</ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
|
||
namespace SIT.Manager.Theme.Controls; | ||
|
||
public class Card : ContentControl | ||
{ | ||
public static readonly StyledProperty<bool> InsideClippingProperty = | ||
AvaloniaProperty.Register<Card, bool>(nameof(InsideClipping), true); | ||
|
||
/// <summary> | ||
/// Get or set the inside border clipping. | ||
/// </summary> | ||
public bool InsideClipping | ||
{ | ||
get => GetValue(InsideClippingProperty); | ||
set => SetValue(InsideClippingProperty, value); | ||
} | ||
} |
Oops, something went wrong.