2019-01-24 20:15:10 +00:00
|
|
|
// Copyright (C) 2019 Storj Labs, Inc.
|
2018-11-27 10:51:33 +00:00
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
2018-11-05 15:26:18 +00:00
|
|
|
<template>
|
2018-11-19 15:32:50 +00:00
|
|
|
<div class="input-container">
|
2019-07-09 16:04:51 +01:00
|
|
|
<div v-if="!isOptional" class="label-container">
|
|
|
|
<img v-if="error" src="../../../static/images/register/ErrorInfo.svg"/>
|
2019-09-26 14:36:12 +01:00
|
|
|
<h3 v-if="!error" class="label-container__label">{{label}}</h3>
|
|
|
|
<h3 v-if="!error" class="label-container__label add-label">{{additionalLabel}}</h3>
|
2019-07-09 16:04:51 +01:00
|
|
|
<h3 class="label-container__error" v-if="error">{{error}}</h3>
|
|
|
|
</div>
|
|
|
|
<div v-if="isOptional" class="optional-label-container">
|
2019-09-26 14:36:12 +01:00
|
|
|
<h3 class="label-container__label">{{label}}</h3>
|
|
|
|
<h4 class="optional-label-container__optional">Optional</h4>
|
2019-07-09 16:04:51 +01:00
|
|
|
</div>
|
|
|
|
<textarea
|
2019-09-26 14:36:12 +01:00
|
|
|
class="headered-textarea"
|
2018-11-30 15:49:14 +00:00
|
|
|
v-if="isMultiline"
|
2019-09-26 14:36:12 +01:00
|
|
|
:id="this.label"
|
|
|
|
:placeholder="this.placeholder"
|
2019-07-19 14:32:01 +01:00
|
|
|
:style="style.inputStyle"
|
2018-11-30 15:49:14 +00:00
|
|
|
:rows="5"
|
|
|
|
:cols="40"
|
|
|
|
wrap="hard"
|
2019-07-19 14:32:01 +01:00
|
|
|
@input="onInput"
|
2019-07-09 16:04:51 +01:00
|
|
|
@change="onInput"
|
2019-07-19 14:32:01 +01:00
|
|
|
v-model="value">
|
2019-07-09 16:04:51 +01:00
|
|
|
</textarea>
|
|
|
|
<input
|
2019-09-26 14:36:12 +01:00
|
|
|
class="headered-input"
|
2018-11-30 15:49:14 +00:00
|
|
|
v-if="!isMultiline"
|
2019-09-26 14:36:12 +01:00
|
|
|
:id="this.label"
|
2018-11-30 15:49:14 +00:00
|
|
|
:placeholder="this.$props.placeholder"
|
2019-09-23 12:31:42 +01:00
|
|
|
:type="[isPassword ? 'password': 'text']"
|
2018-11-30 15:49:14 +00:00
|
|
|
@input="onInput"
|
2019-07-19 14:32:01 +01:00
|
|
|
@change="onInput"
|
|
|
|
v-model="value"
|
2019-10-02 10:42:12 +01:00
|
|
|
:style="style.inputStyle"
|
|
|
|
/>
|
2019-07-09 16:04:51 +01:00
|
|
|
</div>
|
2018-11-05 15:26:18 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-09-26 14:36:12 +01:00
|
|
|
import { Component, Prop } from 'vue-property-decorator';
|
2018-11-05 15:26:18 +00:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
import HeaderlessInput from './HeaderlessInput.vue';
|
|
|
|
|
|
|
|
// Custom input component with labeled header
|
|
|
|
@Component
|
|
|
|
export default class HeaderedInput extends HeaderlessInput {
|
|
|
|
@Prop({default: ''})
|
|
|
|
private readonly initValue: string;
|
|
|
|
@Prop({default: ''})
|
|
|
|
private readonly additionalLabel: string;
|
|
|
|
@Prop({default: false})
|
|
|
|
private readonly isOptional: boolean;
|
|
|
|
@Prop({default: false})
|
|
|
|
private readonly isMultiline: boolean;
|
2019-09-13 10:48:27 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
public constructor() {
|
|
|
|
super();
|
2019-09-13 10:48:27 +01:00
|
|
|
|
2019-09-09 11:33:39 +01:00
|
|
|
this.value = this.initValue;
|
2019-07-18 14:39:39 +01:00
|
|
|
}
|
2019-09-09 11:33:39 +01:00
|
|
|
}
|
2018-11-05 15:26:18 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
2019-07-10 10:55:40 +01:00
|
|
|
.input-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: flex-start;
|
|
|
|
margin-top: 10px;
|
|
|
|
width: 48%;
|
2019-09-26 14:36:12 +01:00
|
|
|
font-family: 'font_regular';
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.label-container {
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-start;
|
2019-09-26 14:36:12 +01:00
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
&__label {
|
2019-07-10 10:55:40 +01:00
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
2019-09-26 14:36:12 +01:00
|
|
|
color: #354049;
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
&__error {
|
2019-09-26 14:36:12 +01:00
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
2019-07-10 10:55:40 +01:00
|
|
|
color: #FF5560;
|
|
|
|
margin-left: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.optional-label-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
width: 100%;
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
&__optional {
|
2019-07-10 10:55:40 +01:00
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
|
|
|
color: #AFB7C1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-26 14:36:12 +01:00
|
|
|
.headered-input,
|
|
|
|
.headered-textarea {
|
2019-07-10 10:55:40 +01:00
|
|
|
font-size: 16px;
|
|
|
|
line-height: 21px;
|
|
|
|
resize: none;
|
|
|
|
height: 48px;
|
|
|
|
width: 100%;
|
|
|
|
text-indent: 20px;
|
|
|
|
border-color: rgba(56, 75, 101, 0.4);
|
|
|
|
border-radius: 6px;
|
|
|
|
outline: none;
|
|
|
|
box-shadow: none;
|
|
|
|
}
|
2019-09-26 14:36:12 +01:00
|
|
|
|
|
|
|
.headered-textarea {
|
2019-07-10 10:55:40 +01:00
|
|
|
padding-top: 20px;
|
|
|
|
}
|
2019-09-26 14:36:12 +01:00
|
|
|
|
|
|
|
.add-label {
|
|
|
|
margin-left: 5px;
|
|
|
|
color: rgba(56, 75, 101, 0.4);
|
2019-07-10 10:55:40 +01:00
|
|
|
}
|
2018-11-05 15:26:18 +00:00
|
|
|
</style>
|