Skip to content

Commit

Permalink
Add icon class to all buttons and styles. Closes #274
Browse files Browse the repository at this point in the history
  • Loading branch information
SKProCH committed May 17, 2024
1 parent 70f8eee commit fa92171
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 25 deletions.
8 changes: 0 additions & 8 deletions Material.Styles/Resources/Compatibility/ButtonClasses.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@
<Setter Property="Theme" Value="{StaticResource MaterialOutlineButton}" />
</Style>

<Style Selector="Button.icon">
<Setter Property="Theme" Value="{StaticResource MaterialIconButton}" />
</Style>

<Style Selector="Button.Flat">
<Setter Property="Theme" Value="{StaticResource MaterialFlatButton}" />
</Style>

<Style Selector="Button.Outline">
<Setter Property="Theme" Value="{StaticResource MaterialOutlineButton}" />
</Style>

<Style Selector="Button.Icon">
<Setter Property="Theme" Value="{StaticResource MaterialIconButton}" />
</Style>
</Styles>
7 changes: 7 additions & 0 deletions Material.Styles/Resources/Themes/Button.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@
<Style Selector="^:disabled /template/ Border#PART_RootBorder">
<Setter Property="Opacity" Value="{StaticResource ButtonDisabledOpacity}" />
</Style>

<Style Selector="^.icon">
<Setter Property="Padding" Value="12" />
<Setter Property="CornerRadius" Value="24" />
<Setter Property="Height" Value="48" />
<Setter Property="Width" Value="48" />
</Style>
</ControlTheme>

<ControlTheme x:Key="MaterialButton" TargetType="Button"
Expand Down
24 changes: 18 additions & 6 deletions Material.Styles/Resources/Themes/RepeatButton.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Material.Styles.Assists"
xmlns:ripple="clr-namespace:Material.Ripple;assembly=Material.Ripple"
xmlns:system="clr-namespace:System;assembly=netstandard">
xmlns:system="clr-namespace:System;assembly=netstandard"
xmlns:controls="clr-namespace:Material.Styles.Controls">
<Design.PreviewWith>
<StackPanel Spacing="10" Margin="8">
<RepeatButton Theme="{StaticResource MaterialEmptyRepeatButton}" Foreground="Black">Empty just displays content</RepeatButton>
Expand All @@ -21,11 +22,15 @@
<RepeatButton Theme="{StaticResource MaterialFlatRepeatButton}" Classes="no-ripple">No ripple</RepeatButton>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="10">
<RepeatButton Theme="{StaticResource MaterialIconRepeatButton}">Default</RepeatButton>
<RepeatButton Theme="{StaticResource MaterialIconRepeatButton}" Classes="accent">Accent</RepeatButton>
<RepeatButton Theme="{StaticResource MaterialIconRepeatButton}" Classes="light">Light</RepeatButton>
<RepeatButton Theme="{StaticResource MaterialIconRepeatButton}" Classes="dark">Dark</RepeatButton>
<RepeatButton Theme="{StaticResource MaterialIconRepeatButton}" Classes="no-ripple">No ripple</RepeatButton>
<RepeatButton Classes="icon">
<controls:MaterialInternalIcon Kind="Clock" />
</RepeatButton>
<RepeatButton Theme="{StaticResource MaterialFlatRepeatButton}" Classes="icon">
<controls:MaterialInternalIcon Kind="Clock" />
</RepeatButton>
<RepeatButton Theme="{StaticResource MaterialOutlineRepeatButton}" Classes="icon">
<controls:MaterialInternalIcon Kind="Clock" />
</RepeatButton>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="10">
<RepeatButton Theme="{StaticResource MaterialOutlineRepeatButton}">Default</RepeatButton>
Expand Down Expand Up @@ -67,6 +72,13 @@
<Setter Property="BorderBrush" Value="{DynamicResource MaterialPrimaryDarkBrush}" />
<Setter Property="Foreground" Value="{DynamicResource MaterialPrimaryForegroundBrush}" />
</Style>

<Style Selector="^.icon">
<Setter Property="Padding" Value="12" />
<Setter Property="CornerRadius" Value="24" />
<Setter Property="Height" Value="48" />
<Setter Property="Width" Value="48" />
</Style>
</ControlTheme>


Expand Down
23 changes: 12 additions & 11 deletions Material.Styles/Resources/Themes/ToggleButton.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,15 @@
<ToggleButton Theme="{StaticResource MaterialFlatToggleButton}" IsEnabled="False">Disabled</ToggleButton>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<ToggleButton Theme="{StaticResource MaterialIconToggleButton}">
<ToggleButton Classes="icon">
<controls:MaterialInternalIcon Kind="Clock" />
</ToggleButton>

<ToggleButton Theme="{StaticResource MaterialIconToggleButton}" Classes="accent">
<controls:MaterialInternalIcon Kind="Clock" />
</ToggleButton>
<ToggleButton Theme="{StaticResource MaterialIconToggleButton}" Classes="light">

<ToggleButton Theme="{StaticResource MaterialOutlineToggleButton}" Classes="icon">
<controls:MaterialInternalIcon Kind="Clock" />
</ToggleButton>
<ToggleButton Theme="{StaticResource MaterialIconToggleButton}" Classes="dark">
<controls:MaterialInternalIcon Kind="Clock" />
</ToggleButton>

<ToggleButton Theme="{StaticResource MaterialIconToggleButton}" IsEnabled="False">

<ToggleButton Theme="{StaticResource MaterialFlatToggleButton}" Classes="icon">
<controls:MaterialInternalIcon Kind="Clock" />
</ToggleButton>
</StackPanel>
Expand Down Expand Up @@ -147,6 +141,13 @@
<Style Selector="^.dark">
<Setter Property="Foreground" Value="{DynamicResource MaterialPrimaryDarkBrush}" />
</Style>

<Style Selector="^.icon">
<Setter Property="Padding" Value="12" />
<Setter Property="CornerRadius" Value="24" />
<Setter Property="Height" Value="48" />
<Setter Property="Width" Value="48" />
</Style>
</ControlTheme>

<ControlTheme x:Key="MaterialToggleButton" TargetType="ToggleButton"
Expand Down

0 comments on commit fa92171

Please sign in to comment.