Commit c1dfde7a authored by Nikolay Gromov's avatar Nikolay Gromov

add fields-group

parent 6b524de1
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.btn { .btn {
.btn(); .btn();
.btn-color(@text-color; @gray-lighter; @gray-lighter); .btn-color(@text-color; @gray-lighter; @gray-light);
.btn-size(); .btn-size();
&--main { &--main {
......
...@@ -22,15 +22,13 @@ ...@@ -22,15 +22,13 @@
font-weight: 400; font-weight: 400;
display: inline-block; display: inline-block;
margin-right: .6em; margin-right: .6em;
margin-bottom: .2em;
line-height: @line-height; line-height: @line-height;
} }
&__input { &__input {
position: absolute; position: absolute;
top: 50%; top: .25em;
left: 0; left: 0;
transform: translate(0, -50%);
} }
&__help-text { &__help-text {
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
height: 2.125em; // 16 × 2.125 = 34 height: 2.125em; // 16 × 2.125 = 34
line-height: @line-height; line-height: @line-height;
padding-right: @field-padding-horizontal; padding-right: @field-padding-horizontal;
margin-bottom: round(@line-height / 3, 2);
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -60,9 +59,12 @@ ...@@ -60,9 +59,12 @@
border-bottom-left-radius: @border-radius; border-bottom-left-radius: @border-radius;
} }
// .field-file__input:focus ~ & { &:hover, &:focus {
// .focus(); &:before {
// } background-color: darken(@gray-lighter, 10%); // как у обычных кнопок
}
}
} }
&__help-text { &__help-text {
......
...@@ -22,14 +22,12 @@ ...@@ -22,14 +22,12 @@
font-weight: 400; font-weight: 400;
display: inline-block; display: inline-block;
margin-right: .6em; margin-right: .6em;
margin-bottom: .2em;
} }
&__input { &__input {
position: absolute; position: absolute;
top: 50%; top: .25em;
left: 0; left: 0;
transform: translate(0, -50%);
} }
&__help-text { &__help-text {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
} }
&__input { &__input {
margin-bottom: round(@line-height / 3, 2);
align-self: center; align-self: center;
padding: 0; padding: 0;
width: 100%; width: 100%;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
&__input-wrap {} &__input-wrap {}
&__select { &__select {
margin-bottom: round(@line-height / 3, 2);
appearance: none; appearance: none;
background-image: data-uri('image/svg+xml;charset=UTF-8', './src/blocks/field-select/img_to_bg/select-down.svg'); background-image: data-uri('image/svg+xml;charset=UTF-8', './src/blocks/field-select/img_to_bg/select-down.svg');
background-repeat: no-repeat; background-repeat: no-repeat;
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
&__input-wrap {} &__input-wrap {}
&__input { &__input {
margin-bottom: round(@line-height / 3, 2);
textarea& { textarea& {
min-height: (@line-height * 2) + @field-padding-top + @field-padding-bottom + .2; // .2 — поправка на бордюр min-height: (@line-height * 2) + @field-padding-top + @field-padding-bottom + .2; // .2 — поправка на бордюр
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
font-weight: 400; font-weight: 400;
display: inline-block; display: inline-block;
margin-right: .6em; margin-right: .6em;
margin-bottom: .2em;
line-height: @line-height; line-height: @line-height;
} }
......
<!--DEV
<div class="fields-group">
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
</div>
<div class="fields-group">
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
<small class="field-select__help-text">Пояснение отдельного поля, если длинное, распирает блок? Нет.</small>
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
<small class="field-select__help-text">Пояснение.</small>
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
<small class="field-select__help-text">Пояснение еще.</small>
</label>
</div>
<div class="fields-group">
<span class="fields-group__item fields-group__item--addon fields-group__item--text">
$
</span>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<span class="fields-group__item fields-group__item--addon fields-group__item--text">
какой-то текст
</span>
</div>
<div class="fields-group">
<span class="fields-group__item fields-group__item--addon fields-group__item--text">
$
</span>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<button class="btn fields-group__item fields-group__item--addon">Отправить</button>
<button class="btn fields-group__item fields-group__item--addon">Отменить</button>
</div>
-->
@import "../../less/variables.less"; // только для удобства обращения к переменным
@import "../../less/mixins/mixins.less"; // только для удобства обращения к примесям
.fields-group {
display: flex;
margin-bottom: (@line-height / 2);
&__item {
margin-bottom: 0;
// flex: 0 0 auto;
flex-basis: 100%;
// flex: 1;
&--text {
white-space: nowrap;
background-color: @gray-lighter;
color: @gray;
border: @border-width solid @border-color;
border-radius: @border-radius;
display: inline-block;
vertical-align: middle;
line-height: @line-height;
min-height: 2.125em;
padding: @field-padding-top @field-padding-horizontal @field-padding-bottom;
}
&--addon {
// flex-grow: 0;
flex-basis: 1%;
&:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
&:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
&:not(:last-child) {
input {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
&:not(:first-child) {
margin-left: (@border-width * -1);
input {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
input {
position: relative;
&:focus {
z-index: 1;
}
}
}
}
...@@ -497,6 +497,7 @@ ...@@ -497,6 +497,7 @@
</form> </form>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<form action="" class="form form--horizontal"> <form action="" class="form form--horizontal">
<fieldset> <fieldset>
<legend>Горизонтальная форма</legend> <legend>Горизонтальная форма</legend>
...@@ -586,6 +587,62 @@ ...@@ -586,6 +587,62 @@
</div> </div>
</fieldset> </fieldset>
</form> </form>
<form action="" class="form">
<fieldset>
<legend>Группы полей</legend>
<div class="fields-group">
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
</div>
<div class="fields-group">
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
<small class="field-select__help-text">Пояснение отдельного поля, если длинное, распирает блок? Нет.</small>
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
<small class="field-select__help-text">Пояснение.</small>
</label>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
<small class="field-select__help-text">Пояснение еще.</small>
</label>
</div>
<div class="fields-group">
<span class="fields-group__item fields-group__item--addon fields-group__item--text">
$
</span>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<span class="fields-group__item fields-group__item--addon fields-group__item--text">
какой-то текст
</span>
</div>
<div class="fields-group">
<span class="fields-group__item fields-group__item--addon fields-group__item--text">
$
</span>
<label class="field-text fields-group__item">
<input class="field-text__input" type="text" placeholder="input[type=text]">
</label>
<button class="btn fields-group__item fields-group__item--addon">Отправить</button>
<button class="btn fields-group__item fields-group__item--addon">Отменить</button>
</div>
<div class="field-actions">
<button class="btn">Отправить</button>
</div>
</fieldset>
</form>
</div> </div>
</div> </div>
</section> </section>
......
...@@ -411,7 +411,7 @@ input[type="search"], ...@@ -411,7 +411,7 @@ input[type="search"],
input[type="color"], input[type="color"],
input[type="tel"] { input[type="tel"] {
background-color: #fff; background-color: #fff;
border: 1px solid @border-color; border: @border-width solid @border-color;
border-radius: @border-radius; border-radius: @border-radius;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
font-size: @font-size--small-percent; font-size: @font-size--small-percent;
line-height: 1.2em; line-height: 1.2em;
color: @text-color--muted; color: @text-color--muted;
padding-top: 0.417em;
&:empty { &:empty {
display: none; display: none;
......
...@@ -22,3 +22,4 @@ ...@@ -22,3 +22,4 @@
@import "./src/blocks/sprite-svg--localstorage/sprite-svg--localstorage.less"; @import "./src/blocks/sprite-svg--localstorage/sprite-svg--localstorage.less";
@import "./src/blocks/field-toggler/field-toggler.less"; @import "./src/blocks/field-toggler/field-toggler.less";
@import "./src/blocks/dropdown/dropdown.less"; @import "./src/blocks/dropdown/dropdown.less";
@import "./src/blocks/fields-group/fields-group.less";
...@@ -89,5 +89,6 @@ ...@@ -89,5 +89,6 @@
// Разное // Разное
@border-radius: .3rem; // универсальное сглаживание углов бордюра @border-radius: .3rem; // универсальное сглаживание углов бордюра
@border-width: 1px; // универсальная толщина бордюра
@opacity: .7; // универсальная прозрачность @opacity: .7; // универсальная прозрачность
@transition-time: .3s; // время плавных переходов @transition-time: .3s; // время плавных переходов
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment