searchbox.less 4.2 KB

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