File tree 8 files changed +59
-19
lines changed
site/src/routes/demo/icon-button
8 files changed +59
-19
lines changed Original file line number Diff line number Diff line change 23
23
' mdc-icon-button--on' : ! isUninitializedValue (pressed ) && pressed ,
24
24
' mdc-icon-button--touch' : touch ,
25
25
' mdc-icon-button--display-flex' : displayFlex ,
26
+ ' smui-icon-button--size-button' : size === ' button' ,
27
+ ' mdc-icon-button--reduced-size' : size === ' mini' || size === ' button' ,
26
28
' mdc-card__action' : context === ' card:action' ,
27
29
' mdc-card__action--icon' : context === ' card:action' ,
28
30
' mdc-top-app-bar__navigation-icon' : context === ' top-app-bar:navigation' ,
97
99
export let ariaLabelOff: string | undefined = undefined ;
98
100
export let touch = false ;
99
101
export let displayFlex = true ;
102
+ export let size: ' normal' | ' mini' | ' button' = ' normal' ;
100
103
export let href: string | undefined = undefined ;
101
104
export let action:
102
105
| ' close'
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export declare class IconButtonComponentDev<
24
24
| 'ariaLabelOff'
25
25
| 'touch'
26
26
| 'displayFlex'
27
+ | 'size'
27
28
| 'href'
28
29
| 'action'
29
30
| 'component'
Original file line number Diff line number Diff line change
1
+ @use ' @material/feature-targeting/index' as feature-targeting ;
2
+ @use ' @material/icon-button/icon-button-theme' ;
3
+
4
+ $button-icon-height : 18px !default ;
5
+ $button-height : 36px !default ;
6
+
7
+ @mixin core-styles ($query : feature-targeting .all ()) {
8
+ .mdc-icon-button.smui-icon-button--size-button {
9
+ @include icon-button-theme .icon-size ($button-icon-height );
10
+ @include icon-button-theme .size ($button-height );
11
+ }
12
+ }
Original file line number Diff line number Diff line change 1
1
@use ' @material/icon-button/mdc-icon-button' ;
2
2
@use ' @smui/ripple/style' as ripple-style ;
3
+ @use ' ./mixins' as mixins ;
4
+
5
+ @include mixins .core-styles ;
3
6
4
7
// Prevent pointer giving focus inside.
5
8
.mdc-icon-button svg {
Original file line number Diff line number Diff line change
1
+ <div style =" display: flex; align-items: center;" >
2
+ <IconButton class ="material-icons" on:click ={() => clicked ++ } size =" normal" >
3
+ <Icon component ={Svg } viewBox =" 0 0 24 24" >
4
+ <path fill ="currentColor" d ={mdiWrench } />
5
+ </Icon >
6
+ </IconButton > (normal = standard icon button size)
7
+ </div >
8
+ <div style =" display: flex; align-items: center;" >
9
+ <IconButton class ="material-icons" on:click ={() => clicked ++ } size =" mini" >
10
+ <Icon component ={Svg } viewBox =" 0 0 24 24" >
11
+ <path fill ="currentColor" d ={mdiWrench } />
12
+ </Icon >
13
+ </IconButton > (mini = same size as mini FAB)
14
+ </div >
15
+ <div style =" display: flex; align-items: center;" >
16
+ <IconButton class ="material-icons" on:click ={() => clicked ++ } size =" button" >
17
+ <Icon component ={Svg } viewBox =" 0 0 24 24" >
18
+ <path fill ="currentColor" d ={mdiWrench } />
19
+ </Icon >
20
+ </IconButton > (button = same height as button)
21
+ </div >
22
+
23
+ <pre class ="status" >Clicked: {clicked }</pre >
24
+
25
+ <script lang =" ts" >
26
+ import { mdiWrench } from ' @mdi/js' ;
27
+ import IconButton , { Icon } from ' @smui/icon-button' ;
28
+ import { Svg } from ' @smui/common/elements' ;
29
+
30
+ let clicked = 0 ;
31
+ </script >
Original file line number Diff line number Diff line change 18
18
<Demo component ={Touch } file =" icon-button/_Touch.svelte" >
19
19
Increased touch target
20
20
</Demo >
21
+
22
+ <Demo component ={Sizes } file =" icon-button/_Sizes.svelte" >
23
+ Different sizes
24
+ </Demo >
21
25
</section >
22
26
23
27
<script lang =" ts" >
27
31
import Toggle from ' ./_Toggle.svelte' ;
28
32
import Svgs from ' ./_Svgs.svelte' ;
29
33
import Touch from ' ./_Touch.svelte' ;
34
+ import Sizes from ' ./_Sizes.svelte' ;
30
35
</script >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- // TODO: check if this is still required
2
- // @use '@material/theme/theme-color';
3
- // @use '@material/snackbar/index' as snackbar with (
4
- // $action-ink-color: theme-color.prop-value(primary)
5
- // );
6
- @use ' @material/snackbar/mdc-snackbar' ;
7
- @use ' ./mixins' ;
1
+ @use ' @material/theme/theme-color' ;
2
+ @use ' @material/snackbar/index' as snackbar with
3
+ ($action-ink-color : theme-color .prop-value (primary ));
8
4
9
- // @include snackbar.core-styles;
10
- @include mixins .core-styles ;
5
+ @include snackbar .core-styles ;
You can’t perform that action at this time.
0 commit comments