Commit 6ea7c44c authored by Nikolay Gromov's avatar Nikolay Gromov

Поле выбора файла, правки для других полей

parent de18a80f
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
"field-text": [], "field-text": [],
"field-checkbox": [], "field-checkbox": [],
"field-radio": [], "field-radio": [],
"field-file": [],
"field-actions": [], "field-actions": [],
"dropdown": [], "dropdown": [],
"menu": [] "menu": []
......
...@@ -963,6 +963,33 @@ ...@@ -963,6 +963,33 @@
</section> </section>
<section class="blocks-library__item" id="field-file" data-name=".field-file">
<h2 class="blocks-library__item-title">Файл</h2>
<div class="field-file">
<div class="field-file__name">Выбор файлов</div>
<label class="field-file__input-wrap">
<input class="field-file__input" type="file" data-multiple-caption="файлов выбрано: {count}" multiple>
<div class="field-file__name-text" data-button-text="Выбрать файл(ы)">Ничего не выбрано</div>
<div class="field-file__help-text">Отображение выбранного файла(ов) требует Javascript-а. Стилизация — не требует.</div>
</label>
</div>
<div class="blocks-library__code-wrapper">
<span class="blocks-library__code-show-trigger" title="Показать код"><i class="blocks-library__code-icon"></i></span>
<div class="blocks-library__code">
<pre class="code">
<code>&lt;div class="field-actions"></code>
<code> &lt;div class="field-actions__text">* — обязательные поля&lt;/div></code>
<code> &lt;button class="btn">Отправить&lt;/button></code>
<code>&lt;/div></code>
</pre>
</div>
</div>
</section>
<section class="blocks-library__item" id="field-actions" data-name=".field-actions"> <section class="blocks-library__item" id="field-actions" data-name=".field-actions">
<h2 class="blocks-library__item-title">Блок отправки формы</h2> <h2 class="blocks-library__item-title">Блок отправки формы</h2>
......
...@@ -12,7 +12,7 @@ $line-height: 1.375em !default; ...@@ -12,7 +12,7 @@ $line-height: 1.375em !default;
display: block; display: block;
font-weight: 700; font-weight: 700;
line-height: $line-height; line-height: $line-height;
margin-bottom: round($line-height / 2); margin-bottom: 0.4em;
} }
&__input-wrap { &__input-wrap {
......
// Для импорта в диспетчер подключений: @import './src/blocks/field-file/field-file.less'; // В этом файле должны быть стили только для БЭМ-блока field-file, его элементов,
// модификаторов, псевдоселекторов, псевдоэлементов, $media-условий...
// Не пишите здесь другие селекторы.
@import '../../less/variables.less'; // только для удобства обращения к переменным $gray-lightest: hsl(0, 0%, 90%);
$border-color: hsl(0, 0%, 60%) !default;
$line-height: 1.375em !default;
$field-padding-vertical: 0.3em !default;
$field-padding-horizontal: 0.7em !default;
$border-radius: 3px !default;
.field-file { .field-file {
display: block; display: block;
margin-bottom: (@line-height / 2); margin-bottom: ($line-height / 2);
&__name { &__name {
font-weight: 700; font-weight: 700;
display: block; display: block;
margin-bottom: round(@line-height / 4, 2); margin-bottom: 0.4em;
} }
&__input-wrap { &__input-wrap {
...@@ -24,22 +33,20 @@ ...@@ -24,22 +33,20 @@
height: 1px; height: 1px;
opacity: 0; opacity: 0;
&:active ~ .field-file__name-text,
&:focus ~ .field-file__name-text { &:focus ~ .field-file__name-text {
.focus(); @include field-focus;
} }
} }
&__name-text { &__name-text {
position: relative; position: relative;
background-color: #fff; display: flex;
border: 1px solid @border-color; align-items: baseline;
border-radius: @border-radius;
display: inline-block;
vertical-align: middle;
width: 100%; width: 100%;
height: 2.125em; // 16 × 2.125 = 34 background-color: #fff;
line-height: @line-height; border: 1px solid $border-color;
padding-right: @field-padding-horizontal; border-radius: $border-radius;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -47,29 +54,26 @@ ...@@ -47,29 +54,26 @@
&:before { &:before {
content: attr(data-button-text); content: attr(data-button-text);
display: inline-block; display: block;
vertical-align: middle; background-color: $gray-lightest;
background-color: @gray-lighter; border-right: 1px solid $border-color;
border: 1px solid @border-color; margin-right: $field-padding-horizontal;
margin-right: @field-padding-horizontal; line-height: $line-height;
height: 2.125em; padding: $field-padding-vertical $field-padding-horizontal;
line-height: @line-height; border-top-left-radius: $border-radius;
padding: @field-padding-top @field-padding-horizontal @field-padding-bottom; border-bottom-left-radius: $border-radius;
transform: translateX(-1px) translateY(-1px);
border-top-left-radius: @border-radius;
border-bottom-left-radius: @border-radius;
} }
&:hover, &:hover,
&:focus { &:focus {
&:before { &:before {
background-color: darken(@gray-lighter, 10%); // как у обычных кнопок background-color: darken($gray-lightest, 10%); // как у обычных кнопок
} }
} }
} }
&__help-text { &__help-text {
.help-text(); @include field-help-text;
} }
} }
...@@ -12,7 +12,7 @@ $line-height: 1.375em !default; ...@@ -12,7 +12,7 @@ $line-height: 1.375em !default;
display: block; display: block;
font-weight: 700; font-weight: 700;
line-height: $line-height; line-height: $line-height;
margin-bottom: round($line-height / 2); margin-bottom: 0.4em;
} }
&__input-wrap { &__input-wrap {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// модификаторов, псевдоселекторов, псевдоэлементов, $media-условий... // модификаторов, псевдоселекторов, псевдоэлементов, $media-условий...
// Не пишите здесь другие селекторы. // Не пишите здесь другие селекторы.
$border-color: hsl(0, 0%, 60%) !default;
$gray-lighter: hsl(0, 0%, 80%) !default; $gray-lighter: hsl(0, 0%, 80%) !default;
$border-color: hsl(0, 0%, 60%) !default;
$text-color--muted: hsl(0, 0%, 50%) !default; $text-color--muted: hsl(0, 0%, 50%) !default;
......
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