Skip to content

Commit

Permalink
🐛 fix name in article card
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinmagrez committed Nov 9, 2020
1 parent 8ff9633 commit 558c39b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Smartway.UiComponent.Sample/DummyArticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ICommand NavigationCommand

public object NavigationParameter { get; set; }
public string Status { get; set; }
public DateTime? ShortageAt
public DateTime? OnShortageSince
{
get => DateTime.Today;
set => throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Smartway.UiComponent.Sample.SectionSheet.ViewModels
{
class SectionSheetSampleViewModel: ViewModel
{
public List<object> Articles => new List<object>
public ObservableCollection<object> Articles => new ObservableCollection<object>
{
new DummyArticle
{
Expand Down
2 changes: 1 addition & 1 deletion Smartway.UiComponent/CardLists/ArticleCardList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Gencode="{Binding Gencode}"
NavigationCommand="{Binding NavigationCommand}"
NavigationParameter="{Binding NavigationParameter}"
ShortageAt="{Binding ShortageAt}"
OnShortageSince="{Binding OnShortageSince}"
/>
</StackLayout>
</DataTemplate>
Expand Down
2 changes: 1 addition & 1 deletion Smartway.UiComponent/CardLists/ExpanderCardList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private void SaveAction(NotifyCollectionChangedEventArgs e)

private async Task OnExpanderClick()
{
ExpandCommand.Execute(null);
ExpandCommand?.Execute(null);
if (ExpanderState != ExpanderState.Expanding)
return;

Expand Down
4 changes: 2 additions & 2 deletions Smartway.UiComponent/Cards/ArticleCard.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<Label
Style="{StaticResource RegularGencodeText}"
TextColor="Black"
Text="{Binding Source={Reference Self}, Path=ShortageAt, StringFormat='Rupture depuis le {0:dd/MM/yyyy}'}"
IsVisible="{Binding Source={Reference Self}, Path=DisplayShortageAt}"
Text="{Binding Source={Reference Self}, Path=OnShortageSince, StringFormat='Rupture depuis le {0:dd/MM/yyyy}'}"
IsVisible="{Binding Source={Reference Self}, Path=DisplayOnShortageSince}"
/>
<indicators:Status IsVisible="False" HorizontalOptions="StartAndExpand">
<indicators:Status.Triggers>
Expand Down
10 changes: 5 additions & 5 deletions Smartway.UiComponent/Cards/ArticleCard.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public partial class ArticleCard
public static readonly BindableProperty PriceProperty = BindableProperty.Create(nameof(Price), typeof(string), typeof(ArticleCard));
public static readonly BindableProperty NavigationCommandProperty = BindableProperty.Create(nameof(NavigationCommand), typeof(ICommand), typeof(ArticleCard));
public static readonly BindableProperty NavigationParameterProperty = BindableProperty.Create(nameof(NavigationParameter), typeof(object), typeof(ArticleCard));
public static readonly BindableProperty ShortageAtProperty = BindableProperty.Create(nameof(ShortageAt), typeof(DateTime?), typeof(ArticleCard), DateTime.Today);
public static readonly BindableProperty OnShortageSinceProperty = BindableProperty.Create(nameof(OnShortageSince), typeof(DateTime?), typeof(ArticleCard), DateTime.Today);
public static readonly BindableProperty StatusProperty = BindableProperty.Create(nameof(Status), typeof(string), typeof(ArticleCard), "Unknown");

public bool IsMultilocation
Expand All @@ -42,10 +42,10 @@ public bool IsOnShortage
set => SetValue(IsOnShortageProperty, value);
}

public DateTime? ShortageAt
public DateTime? OnShortageSince
{
get => (DateTime?) GetValue(ShortageAtProperty);
set => SetValue(ShortageAtProperty, value);
get => (DateTime?) GetValue(OnShortageSinceProperty);
set => SetValue(OnShortageSinceProperty, value);
}

public string Price
Expand All @@ -72,7 +72,7 @@ public string Status
set => SetValue(StatusProperty, value);
}

public bool DisplayShortageAt => IsOnShortage && ShortageAt != null;
public bool DisplayOnShortageSince => IsOnShortage && OnShortageSince != null;

public ArticleCard()
{
Expand Down

0 comments on commit 558c39b

Please sign in to comment.