aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/Inputs.js
blob: a45e6de1900e1b7a3bf91502921fcb8ed24b002b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React from 'react';
import CharLimit from './CharLimit'
import styled from 'styled-components'
import FloatingLabel from './FloatingLabel'

const CharLimitContainer = styled.div`
    position: relative; 
`

class TitleInput extends React.Component {
    render() {
        return (
            <CharLimitContainer>
                <FloatingLabel
                    label="title"
                    id={this.props.id}
                    value={this.props.value} />
                <input
                    name="title"
                    className="lt-shadow"
                    placeholder="Title"
                    id={this.props.id}
                    type="text"
                    autoFocus
                    autoComplete="off"
                    onChange={this.props.onChange}
                    value={this.props.value} />
                <CharLimit
                    content={this.props.value}
                    maxLength={this.props.maxLength} />
            </CharLimitContainer>
        );
    }
}

class PasteInput extends React.Component {
    render() {
        return (
            <CharLimitContainer>
                <FloatingLabel
                    label="content"
                    id={this.props.id}
                    value={this.props.content} />
                <textarea
                    name="content"
                    placeholder="Paste your text here"
                    value={this.props.content}
                    id={this.props.id}
                    onChange={this.props.onChange}
                    className="lt-shadow" />
                <CharLimit
                    content={this.props.content}
                    maxLength={this.props.maxLength} />
            </CharLimitContainer>
        );
    }
}

class PassInput extends React.Component {
    render() {
        return (
            <CharLimitContainer>
                <FloatingLabel
                    label="password"
                    id={this.props.id}
                    value={this.props.value} />
                <input
                    name="pass"
                    className="lt-shadow"
                    placeholder="password (optional)"
                    type="password"
                    autoComplete="off"
                    onChange={this.props.onChange}
                    value={this.props.value}
                    id={this.props.id} />
            </CharLimitContainer>
        );
    }
}

export { TitleInput, PasteInput, PassInput }