aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/PasteInfo.js
blob: ea4981c3fc765492efbc203401251d8b49aa855d (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
import React from 'react';
import styled from 'styled-components'
import { useHistory } from 'react-router-dom';
import { ThemeInput } from './Inputs'

const Bold = styled.span`
    font-weight: 700
`

const StyledDiv = styled.div`
    display: inline-block;
`

const Button = styled.button`
    margin-left: 0 !important;
`

const ButtonRow = styled.div`
    display: inline;
`

const SpacedText = styled.span`
    margin-right: 1em;
`

const Flex = styled.div`
    float: right;
    display: flex;
    flex-direction: row;
    transform: translateY(0.2em);
`

const PasteInfo = (props) => {
    const history = useHistory();
    const redir = () => {
        const redirUrl = `/raw/${props.hash}`
        history.push(redirUrl);
    }

    return (
        <div>
            <Flex>
                <ThemeInput
                    value={props.theme}
                    onChange={props.onChange}
                    id="themeInput" />
            </Flex>
            <StyledDiv>
                <ButtonRow>
                    <Button 
                        className="lt-shadow lt-hover" 
                        type="button"
                        onClick={redir}
                        >
                        view raw
                    </Button>
                    <SpacedText>
                        <Bold>language:&nbsp;</Bold>{props.lang}
                    </SpacedText>
                    <SpacedText>
                        <Bold>expires:&nbsp;</Bold>{props.expiry}
                    </SpacedText>
                    <SpacedText>
                        {props.err}
                    </SpacedText>
                </ButtonRow>
            </StyledDiv>
        </div>
    );
}

export default PasteInfo