66// default styles
77
88
9-
109// in this example CSS, we defer to the browser's
1110// rendering of the dropdown menu itself on small
1211// devices. at 768+, we have enough space to
@@ -27,91 +26,104 @@ $transition-speed: .3s;
2726
2827
2928
30- // the main blobselect container
29+ // The main blobselect container.
3130.blobselect {
3231 position : relative ;
32+
3333 display : flex ;
3434 align-items : center ;
3535 justify-content : flex-start ;
3636 flex-wrap : wrap ;
37- cursor : pointer ;
38- outline : none ;
39- color : $color-black ;
40- background-color : $color-white ;
41- transition : background $transition-speed , color $transition-speed , border $transition-speed ;
4237
38+ padding : 10px ;
4339 width : 100% ;
4440 max-width : 300px ;
41+
4542 border : 1px solid $color-grey ;
46- padding : 10px ;
47- box-sizing : border-box ;
43+ background-color : $color-white ;
44+ cursor : pointer ;
45+ outline : none ;
46+
47+ color : $color-black ;
4848
49- // force everything in here to use border-box
50- * { box-sizing : border-box ; }
49+ transition :
50+ background $transition-speed ,
51+ color $transition-speed ,
52+ border $transition-speed ;
5153
52- // a neat trick, for small screens we can preserve
53- // the browser's dropdown functionality, which is
54- // probably better than what we could do with CSS
54+ // A neat trick, for small screens we can preserve
55+ // the browser's dropdown functionality, which is
56+ // probably better than what we could do with CSS.
5557 select {
5658 position : absolute ;
5759 top : 0 ;
5860 left : -5px ;
5961 right : -5px ;
6062 bottom : -5px ;
63+ z-index : 1000 ;
64+
6165 width : calc (100% + 10px );
6266 height : calc (100% + 5px );
63- z-index : 1000 ;
67+
6468 opacity : 0 ;
6569
66- // for big screens, we don't really need this
67- // any more
68- @media (min-width : $screen-tablet ){ display : none ; }
70+ // For big screens, we don't really need this
71+ // any more.
72+ @media (min-width : $screen-tablet ) { display : none ; }
6973 }
7074
75+ // Focus, hover, active.
7176 & :focus ,
7277 & :active ,
7378 & :hover { border-color : $color-black ; }
7479
80+ // Select is open.
7581 & .is-open {
7682 z-index : 1 ;
7783 border-color : $color-blue-dark ;
7884 }
7985
80- // disabled styles
86+ // Disabled styles.
8187 & .is-disabled {
82- color : $color-grey !important ;
8388 border-color : $color-grey !important ;
89+ color : $color-grey !important ;
8490 cursor : auto ;
8591 }
8692}// .blobselect
8793
8894
8995
90- // our selections
96+ // Our selections.
9197.blobselect-selections {
92- width : calc (100% - 35px );
9398 display : flex ;
9499 align-items : flex-start ;
95100 justify-content : center ;
96101 flex-direction : column ;
102+
103+ width : calc (100% - 35px );
97104 overflow : hidden ;
105+
98106 word-wrap : break-word ;
99107}
100108
109+ // An individual selection.
101110.blobselect-selection {
102111 padding : 5px 0 ;
103112
113+ // The selection is a placeholder.
104114 & .is-placeholder {
105115 color : $color-grey ;
106116 font-style : italic ;
107117 }
108118
119+ // The selection is part of a multiple,
120+ // It needs an X.
109121 .is-multiple & {
110122 & :after {
111- content : ' \00D7 ' ;
112- color : $color-red ;
113123 margin-left : .25em ;
114124 opacity : 0 ;
125+ color : $color-red ;
126+ content : ' \00D7 ' ;
115127 transition : opacity $transition-speed ;
116128 }
117129 & :hover {
@@ -122,7 +134,7 @@ $transition-speed: .3s;
122134
123135
124136
125- // our submit button
137+ // Our toggle button.
126138.blobselect-button {
127139 width : 35px ;
128140 height : 30px ;
@@ -131,17 +143,21 @@ $transition-speed: .3s;
131143 position : relative ;
132144
133145 & :after {
134- content : ' ' ;
135- width : 0 ;
136- height : 0 ;
137- border-style : solid ;
138- border-width : 10px 7.5px 0 7.5px ;
139- border-color : $color-grey transparent transparent transparent ;
140146 position : absolute ;
141147 top : 50% ;
142148 left : 50% ;
149+
143150 margin-top : -5px ;
144151 margin-left : -7.5px ;
152+ width : 0 ;
153+ height : 0 ;
154+
155+ border-style : solid ;
156+ border-width : 10px 7.5px 0 7.5px ;
157+ border-color : $color-grey transparent transparent transparent ;
158+
159+ content : ' ' ;
160+
145161 transition : border $transition-speed ;
146162 }
147163
@@ -161,24 +177,29 @@ $transition-speed: .3s;
161177
162178
163179
164- // our dropdown
180+ // Our dropdown.
165181.blobselect-items {
166182 position : absolute ;
167183 top : 100% ;
168184 left : -1px ;
169185 right : -1px ;
186+
187+ display : none ;
188+
189+ padding-bottom : 10px ;
170190 width : calc (100% + 2px );
171- color : $color-black ;
172- background-color : $color-white ;
173- transition : background $transition-speed , color $transition-speed , transform $transition-speed ;
191+
174192 border : 1px solid $color-grey ;
175193 border-top : 0 ;
176- padding-bottom : 10px ;
194+ background-color : $color-white ;
195+
196+ color : $color-black ;
197+
177198 transform : scale (1 , 0 );
178199 transform-origin : top center ;
179- display : none ;
200+ transition : background $transition-speed , color $transition-speed , transform $transition-speed ;
180201
181- // we are only using our pseudo-dropdown on big screens
202+ // We are only using our pseudo-dropdown on big screens.
182203 @media (min-width : $screen-tablet ){
183204 .is-opening & { display : block ; }
184205 .is-open & {
@@ -190,20 +211,22 @@ $transition-speed: .3s;
190211 }
191212}
192213
193- // the search field
214+ // The search field.
194215.blobselect-item-search {
195- border-top : 1px dashed $color-blue-dark ;
196- border-bottom : 1px dashed $color-blue-dark ;
216+ margin-bottom : 5px ;
197217 padding : 0 10px 0 35px ;
198218 height : 35px ;
199- line-height : 35px ;
200- font-size : .8rem ;
219+
201220 outline : none ;
202- opacity : .75 ;
203- transition : opacity $transition-speed ;
204- margin-bottom : 5px ;
221+ border-top : 1px dashed $color-blue-dark ;
222+ border-bottom : 1px dashed $color-blue-dark ;
205223 background : transparent url (../img/search.svg ) scroll 10px 10px no-repeat ;
206224 background-size : 15px 15px ;
225+ opacity : .75 ;
226+
227+ font-size : .8rem ;
228+
229+ transition : opacity $transition-speed ;
207230
208231 & :active ,
209232 & :focus ,
@@ -212,31 +235,31 @@ $transition-speed: .3s;
212235 }
213236}
214237
215- // an optgroup label
238+ // An optgroup label.
216239.blobselect-item-group {
217240 & :first-child {
218241 border-top : 1px dashed $color-blue-dark ;
219242 }
220243
221- font-size : .8rem ;
222- text-transform : uppercase ;
223- font-weight : 700 ;
224244 padding : 10px ;
225245 outline : none ;
246+ font-size : .8rem ;
247+ font-weight : 700 ;
248+ text-transform : uppercase ;
226249
227250 & .is-disabled { opacity : .5 ; }
228251}
229252
230- // dropdown items
253+ // Dropdown items.
231254.blobselect-item {
232255 & :first-child {
233256 border-top : 1px dashed $color-blue-dark ;
234257 }
235258
236- font-size : .8rem ;
237- text-transform : uppercase ;
238259 padding : 10px ;
239260 outline : none ;
261+ font-size : .8rem ;
262+ text-transform : uppercase ;
240263 transition : background $transition-speed , color $transition-speed ;
241264
242265 & .has-group { padding-left : 30px ; }
0 commit comments