mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 03:39:45 +00:00
Пересборка контактной формы, вынос полей в отдельный компонент
This commit is contained in:
1 parent
87596e4411
commit
9e1c2c385a
8 files changed
+173
-96
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import "./Field.styles.scss";
|
||||
|
||||
function Field({ type, name, placeholder, icon }) {
|
||||
const className = type === "submit" ? "submit btn" : "field";
|
||||
|
||||
return (
|
||||
<>
|
||||
{type === "textarea" ? (
|
||||
<textarea
|
||||
className="field big"
|
||||
name={name}
|
||||
placeholder={placeholder}
|
||||
/>
|
||||
) : type === "file" ? (
|
||||
<label className="file-input">
|
||||
<input type="file" name="file" />
|
||||
<div className="upload-file-btn">
|
||||
<img src={icon} alt="" className="icon" />
|
||||
<span>Прикрепить файл</span>
|
||||
</div>
|
||||
</label>
|
||||
) : (
|
||||
<input
|
||||
className={className}
|
||||
type={type}
|
||||
name={name}
|
||||
placeholder={placeholder}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Field;
|
||||
@@ -0,0 +1,56 @@
|
||||
.field {
|
||||
padding: 12px 16px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.field.big {
|
||||
height: 200px;
|
||||
line-height: 30px;
|
||||
resize: none;
|
||||
}
|
||||
|
||||
.file-input {
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
|
||||
input {
|
||||
position: absolute;
|
||||
z-index: -1;
|
||||
opacity: 0;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.upload-file-btn {
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
|
||||
.icon {
|
||||
margin-right: 6px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.file-input input:focus + .upload-file-btn {
|
||||
outline: -webkit-focus-ring-color auto 1px;
|
||||
}
|
||||
|
||||
.submit {
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
|
||||
padding: 12px;
|
||||
font-size: 18px;
|
||||
line-height: normal;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './Field';
|
||||
Reference in new issue
Block a user