|
1 | 1 | import React from 'react'; |
2 | 2 | import Link from 'gatsby-link'; |
3 | | -import { Image, StyleSheet, View } from 'react-native'; |
| 3 | +import { Image, StyleSheet, TouchableOpacity, View } from 'react-native'; |
4 | 4 | import { ExLink, Section, Text } from '../components'; |
5 | 5 |
|
6 | | -import { profile, projects } from '../data'; |
| 6 | +import { profile, skills, projects } from '../data'; |
7 | 7 | import profilePic from '../images/dave_profile.jpg'; |
8 | 8 |
|
9 | | -const IndexPage = () => ( |
10 | | - <Section> |
11 | | - <View style={styles.topContainer}> |
12 | | - <Image |
13 | | - source={profilePic} |
14 | | - style={styles.profilePic} |
15 | | - className="profile-pic" |
16 | | - resizeMode |
17 | | - /> |
18 | | - <Text>{profile.blurb}</Text> |
19 | | - </View> |
20 | | - <View style={styles.socialLinksContainer}> |
21 | | - <Text> |
22 | | - <ExLink |
23 | | - to="https://www.linkedin.com/in/dpack/" |
24 | | - style={{ textDecoration: 'none', color: 'lightsteelblue' }} |
25 | | - > |
26 | | - LinkedIn |
27 | | - </ExLink> |
28 | | - {' | '} |
29 | | - <ExLink |
30 | | - to="https://github.com/davepack" |
31 | | - style={{ textDecoration: 'none', color: 'lightsteelblue' }} |
32 | | - > |
33 | | - GitHub |
34 | | - </ExLink> |
35 | | - </Text> |
36 | | - </View> |
37 | | - </Section> |
| 9 | +let colors = { |
| 10 | + steelblue: 'steelblue', |
| 11 | + lightSteelBlue: '#a3c2db', |
| 12 | +} |
| 13 | + |
| 14 | +let SectionHeading = ({children}) => ( |
| 15 | + <View |
| 16 | + style={[styles.headingContainer]} |
| 17 | + > |
| 18 | + <View style={styles.headingLine} /> |
| 19 | + <Text type='h2' style={{marginBottom: 0, marginHorizontal: 20}}>{children}</Text> |
| 20 | + <View style={styles.headingLine} /> |
| 21 | + </View> |
38 | 22 | ); |
39 | 23 |
|
| 24 | +class IndexPage extends React.Component { |
| 25 | + state = { |
| 26 | + selectedTag: false, |
| 27 | + }; |
| 28 | + |
| 29 | + pressSkillTag = selectedTag => { |
| 30 | + this.setState({ selectedTag }); |
| 31 | + }; |
| 32 | + |
| 33 | + render() { |
| 34 | + let { selectedTag } = this.state; |
| 35 | + return ( |
| 36 | + <Section> |
| 37 | + <View style={styles.topContainer}> |
| 38 | + <Image |
| 39 | + source={profilePic} |
| 40 | + style={styles.profilePic} |
| 41 | + className="profile-pic" |
| 42 | + /> |
| 43 | + <View style={{ flex: 1 }}> |
| 44 | + <Text style={styles.blurbText}>{profile.blurb}</Text> |
| 45 | + <Text style={styles.linksText}> |
| 46 | + {profile.links.map(([to, title], i) => ( |
| 47 | + <React.Fragment> |
| 48 | + <ExLink to={to}>{title}</ExLink> |
| 49 | + {i === profile.links.length - 1 ? '' : ' | '} |
| 50 | + </React.Fragment> |
| 51 | + ))} |
| 52 | + </Text> |
| 53 | + </View> |
| 54 | + </View> |
| 55 | + <View style={[styles.sectionContainer, styles.skillsSectionContainer]}> |
| 56 | + <SectionHeading> |
| 57 | + Skills |
| 58 | + </SectionHeading> |
| 59 | + <View style={{alignItems: 'center', marginBottom: '1rem'}}> |
| 60 | + <Text>Click/tap a skill to see relevant projects.</Text> |
| 61 | + </View> |
| 62 | + <View style={styles.skillsContainer}> |
| 63 | + {Object.entries(skills).map(([tag, label]) => { |
| 64 | + let backgroundColor = 'steelblue'; |
| 65 | + let color = 'white'; |
| 66 | + |
| 67 | + if (selectedTag === tag) { |
| 68 | + backgroundColor = 'whitesmoke'; |
| 69 | + color = 'steelblue'; |
| 70 | + } |
| 71 | + |
| 72 | + return ( |
| 73 | + <TouchableOpacity |
| 74 | + style={[styles.skillContainer, {backgroundColor}]} |
| 75 | + onPress={() => this.pressSkillTag(tag)} |
| 76 | + > |
| 77 | + <Text style={[styles.skillText, {color}]}>{label}</Text> |
| 78 | + </TouchableOpacity> |
| 79 | + ); |
| 80 | + })} |
| 81 | + </View> |
| 82 | + <TouchableOpacity onPress={() => this.pressSkillTag(false)} style={[styles.skillContainer, {alignSelf: 'center', backgroundColor: !selectedTag ? 'whitesmoke' : 'steelblue'}]}> |
| 83 | + <Text style={{color: !selectedTag ? 'steelblue' : 'white'}}>{'\u00d7 '}Clear</Text> |
| 84 | + </TouchableOpacity> |
| 85 | + </View> |
| 86 | + <View style={[styles.sectionContainer, styles.projectsContainer]}> |
| 87 | + <SectionHeading> |
| 88 | + Projects |
| 89 | + </SectionHeading> |
| 90 | + {projects.map(({ title, blurb, tags, roles, links }, i) => { |
| 91 | + if (selectedTag && !tags.includes(selectedTag)) { |
| 92 | + return null; |
| 93 | + } |
| 94 | + |
| 95 | + return ( |
| 96 | + <View style={styles.projectContainer}> |
| 97 | + <Text type="h3">{title}</Text> |
| 98 | + <Text>{blurb}</Text> |
| 99 | + </View> |
| 100 | + ); |
| 101 | + })} |
| 102 | + </View> |
| 103 | + </Section> |
| 104 | + ); |
| 105 | + } |
| 106 | +} |
| 107 | + |
40 | 108 | const styles = StyleSheet.create({ |
41 | | - topContainer: { |
| 109 | + headingContainer: { |
42 | 110 | flexDirection: 'row', |
43 | 111 | alignItems: 'center', |
| 112 | + marginBottom: '1rem', |
| 113 | + }, |
| 114 | + headingLine: { |
| 115 | + flex: 1, |
| 116 | + borderBottomWidth: 2, |
| 117 | + borderBottomColor: colors.lightSteelBlue, |
| 118 | + }, |
| 119 | + topContainer: { |
| 120 | + flexDirection: 'row', |
| 121 | + alignItems: 'flex-start', |
| 122 | + marginBottom: 20, |
44 | 123 | }, |
45 | 124 | profilePic: { |
46 | 125 | height: 80, |
47 | 126 | width: 80, |
48 | 127 | marginRight: 20, |
49 | 128 | borderRadius: 40, |
50 | | - shadowColor: 'black', |
51 | | - shadowOffset: { |
52 | | - height: 10, |
53 | | - }, |
54 | | - shadowOpacity: 0.8, |
55 | | - shadowRadius: 20, |
56 | | - // borderWidth: 1, |
57 | | - // borderColor: 'pink', |
| 129 | + 'box-shadow': '3px 3px 15px gray', |
| 130 | + }, |
| 131 | + blurbText: { |
| 132 | + // |
| 133 | + }, |
| 134 | + linksText: { |
| 135 | + marginTop: 15, |
| 136 | + fontWeight: '100', |
| 137 | + }, |
| 138 | + sectionContainer: { |
| 139 | + marginBottom: 40, |
| 140 | + }, |
| 141 | + skillsSectionContainer: { |
| 142 | + // |
58 | 143 | }, |
59 | | - socialLinksContainer: { |
| 144 | + skillsContainer: { |
60 | 145 | flexDirection: 'row', |
| 146 | + flexWrap: 'wrap', |
61 | 147 | justifyContent: 'center', |
62 | | - marginTop: 10, |
| 148 | + }, |
| 149 | + skillContainer: { |
| 150 | + borderRadius: 15, |
| 151 | + paddingHorizontal: 8, |
| 152 | + paddingVertical: 3, |
| 153 | + backgroundColor: 'steelblue', |
| 154 | + marginRight: 5, |
| 155 | + marginBottom: 5, |
| 156 | + }, |
| 157 | + skillText: { |
| 158 | + color: 'white', |
| 159 | + }, |
| 160 | + projectsContainer: { |
| 161 | + // |
| 162 | + }, |
| 163 | + projectContainer: { |
| 164 | + paddingHorizontal: 20, |
| 165 | + paddingVertical: 10, |
| 166 | + marginBottom: 20, |
| 167 | + borderLeftWidth: 4, |
| 168 | + borderLeftColor: colors.lightSteelBlue, |
| 169 | + // borderRightWidth: 4, |
| 170 | + // borderRightColor: 'steelblue', |
63 | 171 | }, |
64 | 172 | }); |
65 | 173 |
|
|
0 commit comments