File tree Expand file tree Collapse file tree 2 files changed +35
-4
lines changed
src/BootstrapBlazor/Components/FileIcon Expand file tree Collapse file tree 2 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ namespace BootstrapBlazor.Components;
1111public partial class FileIcon
1212{
1313 private string ? ClassString => CssBuilder . Default ( "file-icon" )
14+ . AddClass ( $ "file-icon-{ Size . ToDescriptionString ( ) } ", Size != Size . None )
1415 . AddClassFromAttributes ( AdditionalAttributes )
1516 . Build ( ) ;
1617
@@ -22,9 +23,7 @@ public partial class FileIcon
2223 /// 获得/设置 文件类型扩展名
2324 /// </summary>
2425 [ Parameter ]
25- #if NET6_0_OR_GREATER
2626 [ EditorRequired ]
27- #endif
2827 public string ? Extension { get ; set ; }
2928
3029 /// <summary>
@@ -38,4 +37,10 @@ public partial class FileIcon
3837 /// </summary>
3938 [ Parameter ]
4039 public Color IconColor { get ; set ; } = Color . Primary ;
40+
41+ /// <summary>
42+ /// 获得/设置 图标大小 默认 Color.None
43+ /// </summary>
44+ [ Parameter ]
45+ public Size Size { get ; set ; }
4146}
Original file line number Diff line number Diff line change 44 --bb-file-icon-padding-left : #{$bb-file-icon-padding-left } ;
55 --bb-file-icon-badge-bottom : #{$bb-file-icon-badge-bottom } ;
66 --bb-file-icon-path-fill-color : #{$bb-file-icon-path-fill-color } ;
7+ --bb-file-icon-size : 1 ;
78 padding-left : var (--bb-file-icon-padding-left );
89 display : inline-block ;
910 position : relative ;
1011
1112 .icon-svg {
12- width : var (--bb-file-icon-width );
13- height : var (--bb-file-icon-height );
13+ width : calc ( var (--bb-file-icon-width ) * var ( --bb-file-icon-size ) );
14+ height : calc ( var (--bb-file-icon-height ) * var ( --bb-file-icon-size ) );
1415
1516 path {
1617 fill : var (--bb-file-icon-path-fill-color );
2122 position : absolute ;
2223 bottom : var (--bb-file-icon-badge-bottom );
2324 left : 0 ;
25+ font-size : calc (var (--bs-badge-font-size ) * var (--bb-file-icon-size ));
26+ }
27+
28+ & .file-icon-xs {
29+ --bb-file-icon-size : 0.5 ;
30+ }
31+
32+ & .file-icon-sm {
33+ --bb-file-icon-size : 0.75 ;
34+ }
35+
36+ & .file-icon-md {
37+ --bb-file-icon-size : 1.25 ;
38+ }
39+
40+ & .file-icon-lg {
41+ --bb-file-icon-size : 1.5 ;
42+ }
43+
44+ & .file-icon-xl {
45+ --bb-file-icon-size : 1.75 ;
46+ }
47+
48+ & .file-icon-xxl {
49+ --bb-file-icon-size : 2 ;
2450 }
2551}
You can’t perform that action at this time.
0 commit comments