aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/pages/about/profile.tsx
blob: 71dbd09b5aded987d5511bf688abb2a4b3e8ba6e (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import * as _ from 'lodash';
import {colors} from 'material-ui/styles';
import * as React from 'react';
import {Element as ScrollElement} from 'react-scroll';
import {ProfileInfo, Styles} from 'ts/types';
import {utils} from 'ts/utils/utils';

const IMAGE_DIMENSION = 149;
const styles: Styles = {
    subheader: {
        textTransform: 'uppercase',
        fontSize: 32,
        margin: 0,
    },
    imageContainer: {
        width: IMAGE_DIMENSION,
        height: IMAGE_DIMENSION,
        boxShadow: 'rgba(0, 0, 0, 0.19) 2px 5px 10px',
    },
};

interface ProfileProps {
    colSize: number;
    profileInfo: ProfileInfo;
}

export function Profile(props: ProfileProps) {
    return (
        <div
            className={`lg-col md-col lg-col-${props.colSize} md-col-6`}
        >
            <div
                style={{maxWidth: 300}}
                className="mx-auto lg-px3 md-px3 sm-px4 sm-pb3"
            >
                <div
                    className="circle overflow-hidden mx-auto"
                    style={styles.imageContainer}
                >
                    <img
                        width={IMAGE_DIMENSION}
                        src={props.profileInfo.image}
                    />
                </div>
                <div
                    className="center"
                    style={{fontSize: 18, fontWeight: 'bold', paddingTop: 20}}
                >
                    {props.profileInfo.name}
                </div>
                {!_.isUndefined(props.profileInfo.title) &&
                    <div
                        className="pt1 center"
                        style={{fontSize: 14, fontFamily: 'Roboto Mono', color: '#818181'}}
                    >
                        {props.profileInfo.title.toUpperCase()}
                    </div>
                }
                <div
                    style={{minHeight: 60, lineHeight: 1.4}}
                    className="pt1 pb2 mx-auto lg-h6 md-h6 sm-h5 sm-center"
                >
                    {props.profileInfo.description}
                </div>
                <div className="flex pb3 mx-auto sm-hide xs-hide" style={{width: 180, opacity: 0.5}}>
                    {renderSocialMediaIcons(props.profileInfo)}
                </div>
            </div>
        </div>
    );
}

function renderSocialMediaIcons(profileInfo: ProfileInfo) {
    const icons = [
        renderSocialMediaIcon('zmdi-github-box', profileInfo.github),
        renderSocialMediaIcon('zmdi-linkedin-box', profileInfo.linkedIn),
        renderSocialMediaIcon('zmdi-twitter-box', profileInfo.twitter),
    ];
    return icons;
}

function renderSocialMediaIcon(iconName: string, url: string) {
    if (_.isEmpty(url)) {
        return null;
    }

    return (
        <div key={url} className="pr1">
            <a
                href={url}
                style={{color: 'inherit'}}
                target="_blank"
                className="text-decoration-none"
            >
                <i className={`zmdi ${iconName}`} style={{...styles.socalIcon}} />
            </a>
        </div>
    );
}