hjg
2023-11-18 bb48edb3d9faaaeab0088151c86fc24137acdb08
提交 | 用户 | 时间
58d006 1 //some searchbox variables
A 2 @search-border: #6FB3E0;
3 @search-color: #666;
4 @search-color-focus: #656A72;
5
6 @search-width: 152px;
7 @sb-search-width: 162px;
8 @search-border-radius: 4px;
9
10 @nav-search-height: 24px;
11
12
13 .enable_search_box() when(@enable-search-box = true) {
14
15 // searchbox
16 .nav-search {
17   position: absolute;
18   right: 22px;
19   line-height: @nav-search-height;
20
21   .breadcrumbs & {
22       top: floor((@breadcrumb-height - @nav-search-height) / 2) - 2;
23   }
24
25   .form-search {
26     margin-bottom: 0;
27   }
28
29  .nav-search-input {
30     border: 1px solid @search-border;
31
32     width: @search-width;
33     height: 28px !important;
34     padding-top: 2px;
35     padding-bottom: 2px;
36     
37     border-radius: @search-border-radius !important;
38
39     font-size: @font-size-searchbox;
40     line-height: 1.3;
41     
42     color: @search-color !important;
43     z-index: 11;
44
45     .transition(~"width ease .15s");
46
47     //the typeahead dropdown menu
48     & + .dropdown-menu {
49         min-width: 0;
50         left: 0;
51         right: 0;
52     }
53
54     &:focus , &:hover{
55         border-color: @search-border;
56     }
57
58  }
59
60
61  .nav-search-icon {
62     color: @search-border !important;
63     font-size: @font-size-searchbox-icon !important;
64     line-height: 24px !important;
65     background-color: transparent;
66  }
67
68  &.minimized {
69     .nav_search_minimized()
70  }
71 }
72
73
74
75 .nav_search_minimized() {
76     .nav-search-input {
77         width: 0;
78         .opacity(0);
79         max-width: 0; // for safari only
80     }
81      
82     &:hover .nav-search-input ,
83     .nav-search-btn:active + .nav-search-input ,
84     .nav-search-input:focus, .nav-search-input:hover, .nav-search-input:active
85     {
86         .opacity(1);
87         width: @search-width;
88         max-width: @search-width; // for safari only
89     }
90
91     .nav-search-icon {
92         border: 1px solid;
93         border-radius: 100%;
94
95         background-color: #FFF;
96
97         padding: 0 5px !important;
98     }
99     
100     &:hover .nav-search-icon ,
101     .nav-search-input:focus ~ .nav-search-icon,
102     .nav-search-input:hover ~ .nav-search-icon,
103     .nav-search-input:active ~ .nav-search-icon
104     {
105         border:none;
106         border-radius:0;
107         padding:0 3px !important;
108     }
109 }
110
111
112 .nav_search_icon_active() {
113     border:none;
114     border-radius:0;
115     padding:0 3px !important;
116 }
117
118 .nav-search-icon {
119     .nav_search_icon_active();
120 }
121
122 //nav-search inside sidebar
123 .sidebar > .nav-search  {
124    position:static;
125
126    background-color:#FAFAFA;
127    border-bottom:1px solid #DDD;
128    text-align:center;
129
130    height:35px;
131    padding-top:6px;
132
133
134    .nav-search-input {
135      width:@sb-search-width !important;
136      border-radius:0 !important;
137      max-width:@sb-search-width !important;
138      .opacity(1) !important;
139      
140      & + .dropdown-menu { 
141         text-align:left; 
142      }
143    }
144
145 }//nav-search inside sidebar
146
147   
148 //sidebar when minimized
149 .searchbox_inside_min_menu() {
150   .nav-search {
151     .form-search {
152         position:absolute; left:5px;
153         z-index:14;
154     }
155     
156     .nav_search_input_active() {
157         width:@sb-search-width !important;
158         max-width:@sb-search-width !important;
159         .opacity(1) !important;
160     }
161     .nav-search-input {
162         width:0 !important;
163         max-width:0 !important;
164         .opacity(0) !important;
165         
166         &:hover, &:focus, &:active {
167             .nav_search_input_active();
168              ~ #nav-search-icon {
169                 .nav_search_icon_active();
170              }
171         }
172     }
173     
174     &:hover .nav-search-input {
175         .nav_search_input_active();
176         ~ .nav-search-icon {
177             .nav_search_icon_active();
178         }
179     }
180     
181     .nav-search-icon {/* inside minimized sidebar */
182         border:1px solid;
183         border-radius:32px;
184
185         background-color:#FFF;
186         padding:0 5px !important;
187     }
188   }
189 }
190
191     
192     
193     .enable_searchbox_menumin() when(@enable-sidebar-collapse = true) {
194      .sidebar.menu-min {
195         .searchbox_inside_min_menu();
196      }
197     }
198     .enable_searchbox_menumin();
199     
200     .enable_searchbox_minimized_responsive_menu() when(@enable-minimized-responsive-menu = true) {
201       @media (max-width: @grid-float-breakpoint-max) {
202          .sidebar.responsive-min {
203             .searchbox_inside_min_menu();
204          }
205       }
206     }
207     .enable_searchbox_minimized_responsive_menu();
208     
209
210     //responsive searchbox
211     @media only screen and (max-width: @screen-sm-max) {
212         .nav-search {
213             right: 10px;
214         }
215         .nav-search .nav-search-input {
216             width: 105px;
217         }
218         .nav-search:hover .nav-search-input ,
219         .nav-search  .nav-search-btn:active + .nav-search-input ,
220         .nav-search  .nav-search-input:focus, .nav-search  .nav-search-input:hover, .nav-search  .nav-search-input:active
221         {
222             width: 145px;
223         }
224     }
225     @media only screen and (max-width: @screen-xs-max) {//@screen-xs
226         .nav-search {
227             .nav_search_minimized()
228         }
229     }
230
231 }
232 .enable_search_box();