Skip to content

Commit

Permalink
Add flaot animation to input fields and fix bug with styled-dropdown.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van der Waerden committed Aug 15, 2017
1 parent 7c2752e commit eb6062e
Show file tree
Hide file tree
Showing 6 changed files with 14,967 additions and 12 deletions.
6 changes: 4 additions & 2 deletions arctic/static/arctic/dist/assets/css/arctic.css

Large diffs are not rendered by default.

14,919 changes: 14,918 additions & 1 deletion arctic/static/arctic/dist/assets/js/app.js

Large diffs are not rendered by default.

34 changes: 33 additions & 1 deletion arctic/static/arctic/src/assets/js/components/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ $(document).ready(function() {
delimiter: ',',
persist: false,
plugins: ['remove_button'],
onDropdownOpen: function($dropdown) {
if ( $('form').hasClass('float-label') ) {
$dropdown.parent().next('label').css({
top: '.3rem',
fontSize: '75%'
});
}
},
onDropdownClose: function($dropdown) {
if ( $('form').hasClass('float-label') ) {
if ( $('.float-label .selectize-input').find('.item').length == 0 ) {
$dropdown.parent().next('label').css({
top: '.75rem',
fontSize: '100%'
});
}
}
},
create: function(input) {
return {
value: input,
Expand Down Expand Up @@ -73,7 +91,21 @@ $(document).ready(function() {
callback(res.options);
}
});
}
},
onDropdownOpen: function($dropdown) {
$dropdown.parent().next('label').css({
top: '.3rem',
fontSize: '75%'
});
},
onDropdownClose: function($dropdown) {
if ( $('.float-label .selectize-input').find('.item').length == 0 ) {
$dropdown.parent().next('label').css({
top: '.75rem',
fontSize: '100%'
});
}
},
});
});

Expand Down
11 changes: 5 additions & 6 deletions arctic/static/arctic/src/assets/scss/partials/_float-label.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.form-control {
padding: $input-btn-padding-y $input-btn-padding-x;
}

.float-label {

input[type='text'],
Expand Down Expand Up @@ -66,6 +62,11 @@
}
}

.styled-select label {
top: .3rem;
font-size: 75%;
}

.selectize-control {

.selectize-input {
Expand All @@ -90,8 +91,6 @@
.selectize-control ~ label {
pointer-events: none;
user-select: none;
top: .3rem;
font-size: 75%;
}

.selectize-control.single {
Expand Down
5 changes: 5 additions & 0 deletions arctic/static/arctic/src/assets/scss/partials/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ label {
padding-left: 2px;
}

.form-control {
padding: $input-btn-padding-y $input-btn-padding-x;
}

.form-check-label {
position: relative;
top: 27px;
Expand Down Expand Up @@ -100,6 +104,7 @@ label {
border-style: solid;
border-width: 5px 5px 0 5px;
content: ' ';
pointer-events: none;
}
}

Expand Down
4 changes: 2 additions & 2 deletions arctic/templates/arctic/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ <h4 id="form" data-magellan-target="form">Form with validation</h4>
</div>
<div class="col-sm-6 col-md-3 col">
<div class="form-group styled-select">
<label for="select-gear">Option groups</label>
<select id="select-gear" placeholder="Select gear...">
<label for="styled-select">Option groups</label>
<select id="styled-select">
<option value="">Select gear...</option>
<optgroup label="Climbing">
<option value="pitons">Pitons</option>
Expand Down

0 comments on commit eb6062e

Please sign in to comment.