Footer.js 5.19 KB
Newer Older
Spark's avatar
Spark committed
1
2
import React, { useEffect, useState } from 'react'
import { Row, Card,  Button, Col, Modal,  } from 'react-bootstrap';
3
4
import { CopyToClipboard } from 'react-copy-to-clipboard';
import '../App.css'
Spark's avatar
layout    
Spark committed
5
6

function Footer() {
7
    const cardstyled = {
Spark's avatar
layout    
Spark committed
8
9
10
11
12
        margin: 'auto',
        padding: '1em',
        display: 'flex',
        justifyContent: 'center',
        width: '100%',
13
        borderWidth: '3px',
14
        borderRadius: '20px',
15
16
        borderColor: 'rgb(110, 189, 142)',
        color: '#04AB70'
Spark's avatar
layout    
Spark committed
17
    }
18

19
    const btnstyled2 = {
20
        background: 'white',
Spark's avatar
layout    
Spark committed
21
        margin: '1px',
22
        maxWidth: 'fit-content',
Spark's avatar
layout    
Spark committed
23
        borderWidth: '2px',
24
        color: 'rgb(110, 189, 142)',
Spark's avatar
layout    
Spark committed
25
26
27
28
        borderColor: 'rgba(195, 195, 195, 0.753)',
        borderRadius: '20px',
    }

29
    const [donateShow, setDonateShow] = useState(false);
30
    const [isCopyshow, setCopyShow] = useState(false);
Spark's avatar
layout    
Spark committed
31

32
    const HandleClose = () => setDonateShow(false);
33

Spark's avatar
Spark committed
34
    function clickAndTwoSec() {
35
        return new Promise((resolve) => setTimeout(resolve, 2000))
Spark's avatar
layout    
Spark committed
36
    }
37
38
39

    useEffect(() => {
        if (isCopyshow) {
Spark's avatar
Spark committed
40
            clickAndTwoSec().then(() => {
41
42
43
44
                setCopyShow(false);
            });
        }
    }, [isCopyshow]);
45
    // isCopyshow 가 바뀔 때만 effect를 재실행한다.
46
47

    const handleClick = () => setCopyShow(true);
Spark's avatar
layout    
Spark committed
48
49

    return (
50
51
        <Row className='text-center w-100 my-2'>
            <Card style={cardstyled}>
52
                <Card.Title>
53
                    서버비용 후원하기
54
55
                </Card.Title>
                <Card.Subtitle style={{fontWeight: 'lighter'}}>
56
57
                    이용하시는데 불편함이 없도록 광고 없이 운영하고 있습니다. <br />
                    서버비용 충당  후원금이 남을시 UNICEF  기부하겠습니다.
58
59
60
                </Card.Subtitle>
                <Row className='my-2 d-flex justify-content-center'>
                    <Button variant='light' style={btnstyled2} onClick={() => setDonateShow(true)}>
61
62
63
                         후원하기
                    </Button>
                    <Modal
64
                        size='md'
65
                        show={donateShow}
66
                        onHide={HandleClose}
67
68
69
                        style={{ top: '80px', left: '1vw' }}
                    >
                        <Modal.Header className='d-flex justify-content-center'>
70
71
                            <Modal.Title>
                                 Thank you for Donation 
72
73
74
75
                            </Modal.Title>
                        </Modal.Header>
                        <Modal.Body>
                            <Col className='d-flex justify-content-center text-center' style={{ flexDirection: 'column' }}>
76
                                <Card style={{ color: 'rgb(109, 110, 109)', paddingTop: '10px' }}>
77
                                    카카오뱅크
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
                                    <CopyToClipboard text={'박상호 3333-16-7299769'}>
                                        <p className='m-auto' style={btnstyled2} >
                                            박상호 3333-16-7299769
                                            <Button variant='light'
                                                disabled={isCopyshow}
                                                onClick={!isCopyshow ? handleClick : null}
                                                style={{
                                                    background: 'lightgray',
                                                    margin: '5px',
                                                    maxWidth: 'fit-content',
                                                    borderWidth: '2px',
                                                    fontSize: '14px',
                                                    color: 'black',
                                                    border: 'none',
                                                    whiteSpace: 'nowrap'
                                                }}>
                                                {isCopyshow ? '복사 성공!' : '복사'}

                                            </Button>
                                        </p>
                                    </CopyToClipboard>
                                </Card>
100
101
                            </Col>
                        </Modal.Body>
102
103
104
105
106
                        <Modal.Footer>
                            <Button variant='light' style={btnstyled2} onClick={HandleClose}>
                                닫기
                            </Button>
                        </Modal.Footer>
107
108
109

                    </Modal>
                </Row>
110
                <Row className='d-flex justify-content-center flex-direction-column' style={{ color: 'rgb(109, 110, 109)', flexDirection: 'column', fontSize: '0.8em' }}>
111
112
113
114
115
116
117
                    <Col>
                        <a href='https://www.notion.so/EUE-047f1812c6c24096a528dfd3330c227d' style={{ color: 'rgb(110, 189, 142)' }}>TEAM EUE </a> : 안강민, 박상호, 박예
                    </Col>
                    <Col>
                        © 2021 TEAM EUE. All rights reserved
                    </Col>
                </Row>
Spark's avatar
layout    
Spark committed
118

119
120
            </Card>
        </Row>
Spark's avatar
layout    
Spark committed
121
122
123
124
    )
}

export default Footer;