-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ts
150 lines (139 loc) · 3.76 KB
/
config.ts
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
const siteMetadata = {
title: `Zain Dewsi`,
siteUrl: `http://localhost`,
capitalizeTitleOnHome: false,
logo: `/images/zain bitmoji.png`,
icon: `/images/zain bitmoji.png`,
titleImage: ``,
ogImage: `/images/googleimage.png`,
twoColumnWall: false,
cookiePolicy: true,
introTag: `Full-Stack Software Developer`,
about:
"I am a full-stack software developer based in Toronto with a background in digital and strategic marketing. I have always been a logical thinker that loves to solve problems in the most creative way possible. I strive to leverage technology to help businesses grow and make a positive impact on the world. I started this blog to track of my development journey and sharing some of my favourite projects along the way so make sure to check out the projects and stay connected on social media!",
author: `Zain Dewsi`,
projectsItemsPerPage: 10,
portfolioItemsPerPage: 10,
darkmode: true,
switchTheme: true,
navLinks: [
{
name: "Home",
url: "/",
},
{
name: "About",
url: "/about",
},
{
name: "Projects",
url: "/projects",
},
{
name: "Contact",
url: "/contact",
},
],
footerLinks: [
{
name: "GitHub",
url: "https://github.com/zaindewsi",
},
],
social: [
{
name: "LinkedIn",
icon: "/images/linked.png",
url: "https://linkedin.com/in/zaindewsi",
},
{
name: "GitHub",
icon: "/images/git.png",
url: "https://github.com/zaindewsi",
},
{
name: "Instagram",
icon: "/images/insta.png",
url: "https://instagram.com/zaindewsi",
},
{
name: "Youtube",
icon: "/images/yt.png",
url: "https://youtube.com/user/zaindewsi",
},
],
contact: {
// leave empty ('') or false to hide form
api_url: "https://getform.io/f/350fb589-5835-422c-9e74-fed2938f89dc",
description: true,
mail: true,
phone: true,
address: true,
},
}
const beforeContactFormSubmit = data => {
// Code 0 - success
// Code 1 - Name
// Code 2 - Email
// Code 3 - Message
// Code 4 - Other
const errors = []
if (data.name.trim().length < 2) {
errors.push({
code: 1,
message: "Enter a name",
})
}
if (!data.email.match(/[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+/)) {
errors.push({
code: 2,
message: "Enter a valid email address",
})
}
if (errors.length > 0)
return {
result: false,
errors: errors,
}
return {
data: {
name: data.name,
email: data.email,
message: data.message,
},
result: true,
}
}
const contactFormSubmit = async (api, data) => {
let res: any = await fetch(api, {
method: "POST",
body: JSON.stringify(data),
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
})
res = await res.json()
if (res.success) {
return {
result: true,
}
}
return {
result: false,
...res,
}
}
const defaults = {
twoColumnWall: true,
darkmode: false,
switchTheme: true,
capitalizeTitleOnHome: true,
cookiePolicy: false,
}
Object.keys(defaults).forEach(item => {
if (siteMetadata[item] === undefined) {
siteMetadata[item] = defaults[item]
}
})
export { siteMetadata, beforeContactFormSubmit, contactFormSubmit }