[Common] Change ColorButton component

This commit is contained in:
Julia Radzhabova 2020-04-28 18:10:49 +03:00
parent c0e8ff2438
commit 103c2693fe
2 changed files with 27 additions and 18 deletions

View file

@ -49,25 +49,17 @@ define([
'<div class="btn-group" id="<%= id %>">', '<div class="btn-group" id="<%= id %>">',
'<button type="button" class="btn btn-color dropdown-toggle <%= cls %>" data-toggle="dropdown" style="<%= style %>">', '<button type="button" class="btn btn-color dropdown-toggle <%= cls %>" data-toggle="dropdown" style="<%= style %>">',
'<span>&nbsp;</span>', '<span>&nbsp;</span>',
'<span class="inner-box-caret"><i class="caret img-commonctrl"></i></span>',
'</button>', '</button>',
'</div>' '</div>'
].join('')), ].join('')),
setColor: function(color) { setColor: function(color) {
var border_color, clr, var span = $(this.cmpEl).find('button span:nth-child(1)');
span = $(this.cmpEl).find('button span');
this.color = color; this.color = color;
if ( color== 'transparent' ) { span.toggleClass('color-transparent', color=='transparent');
border_color = '#BEBEBE'; span.css({'background-color': (color=='transparent') ? color : ((typeof(color) == 'object') ? '#'+color.color : '#'+color)});
clr = color;
span.addClass('color-transparent');
} else {
border_color = 'transparent';
clr = (typeof(color) == 'object') ? '#'+color.color : '#'+color;
span.removeClass('color-transparent');
}
span.css({'background-color': clr, 'border-color': border_color});
} }
}); });
}); });

View file

@ -544,16 +544,25 @@
} }
.btn-color { .btn-color {
padding: 2px; height: 22px;
padding: 1px 11px 1px 1px;
border:1px solid @input-border; border:1px solid @input-border;
.border-radius(@border-radius-small); .border-radius(@border-radius-small);
span { span:nth-child(1) {
display:block; float: left;
border:1px solid @input-border; width: 100%;
height: 100%;
border: 1px solid rgba(0, 0, 0, 0.2);
background-color: transparent; background-color: transparent;
} }
.inner-box-caret {
position: absolute;
right: 0;
top: 2px;
}
&, &,
&:hover, &:hover,
.over, .over,
@ -570,11 +579,19 @@
.color-transparent { .color-transparent {
&:before { &:before {
height: 40px; border-right: 1px solid red;
transform: translate(20px, -12px) rotate(69deg); height: 34px;
transform: translate(16px, -9px) rotate(62deg);
left: 0; left: 0;
} }
} }
&:active:not(.disabled),
&.active:not(.disabled) {
.caret {
background-position: @arrow-small-offset-x @arrow-small-offset-y;
}
}
} }
.btn-options { .btn-options {