Skip to content

Commit

Permalink
Initial commit as mate.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
chaltenio committed Jun 15, 2021
1 parent 7db0c67 commit 965442b
Show file tree
Hide file tree
Showing 14 changed files with 328 additions and 50 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ yarn-error.log*

# vercel
.vercel
.env
52 changes: 52 additions & 0 deletions components/newsletter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { useState } from "react";
import axios from "axios";
import styles from '../styles/Home.module.css'

export default () => {
const [email, setEmail] = useState("");
const [state, setState] = useState("IDLE");
const [errorMessage, setErrorMessage] = useState(null);

const subscribe = async () => {
setState("LOADING");
setErrorMessage(null);
try {
const response = await axios.post("/api/newsletter", { email });
setState("SUCCESS");
} catch (e) {
setErrorMessage(e.response.data.error);
setState("ERROR");
}
};

return (
<div>
<h3 className={styles.subtitle}>
Connect / Share / Learn
</h3>

<p className={styles.descriptiontitle}>
Please register your interest...
</p>

<div className={styles.registerMailchimp}>
<input className={styles.registerMailchimpInput}
type="text"
placeholder="Enter Email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
<button type="button" className={styles.registerMailchimpButton} disabled={state === "LOADING"} onClick={subscribe}>Subscribe</button>
</div>

{state === "ERROR" && (
<p className={styles.description}>{errorMessage}</p>
)}

{state === "SUCCESS" && (
<p className={styles.description}>Thanks! I'll be in touch shortly :) Chris.-</p>
)}

</div>
);
};
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "nextjs",
"name": "mate.dev",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -8,8 +8,9 @@
"start": "next start"
},
"dependencies": {
"next": "10.x",
"react": "17.x",
"react-dom": "17.x"
"axios": "^0.21.1",
"next": "10.2.3",
"react": "17.0.2",
"react-dom": "17.0.2"
}
}
3 changes: 1 addition & 2 deletions pages/api/hello.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction

export default (req, res) => {
res.statusCode = 200
res.json({ name: 'John Doe' })
res.status(200).json({ name: 'John Doe' })
}
56 changes: 56 additions & 0 deletions pages/api/newsletter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import axios from "axios";

function getRequestParams(email) {
// get env variables
const API_KEY = process.env.MAILCHIMP_API_KEY;
const LIST_ID = process.env.MAILCHIMP_LIST_ID;
// mailchimp datacenter - mailchimp api keys always look like this:
// fe4f064432e4684878063s83121e4971-us6
// We need the us6 part
const DATACENTER = process.env.MAILCHIMP_API_KEY.split("-")[1];

const url = `https://${DATACENTER}.api.mailchimp.com/3.0/lists/${LIST_ID}/members`;

// Add aditional params here. See full list of available params:
// https://mailchimp.com/developer/reference/lists/list-members/
const data = {
email_address: email,
status: "subscribed",
};

// Api key needs to be encoded in base 64 format
const base64ApiKey = Buffer.from(`anystring:${API_KEY}`).toString("base64");
const headers = {
"Content-Type": "application/json",
Authorization: `Basic ${base64ApiKey}`,
};

return {
url,
data,
headers,
};
}

export default async (req, res) => {
const { email } = req.body;

if (!email || !email.length) {
return res.status(400).json({
error: "Forgot to add your email?",
});
}

try {
const { url, data, headers } = getRequestParams(email);

const response = await axios.post(url, data, { headers });

// Success
return res.status(201).json({ error: null });
} catch (error) {
return res.status(400).json({
error: `Something went wrong... Please contact me by email at [email protected] and I'll add you to the list.`,
});
}
};
102 changes: 102 additions & 0 deletions pages/chris.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'

function Chris() {
return (
<div className={styles.container}>
<Head>
<title>Chris Mazur - mate.dev</title>
<meta name="description" content="mate.dev community" />
<link rel="icon" href="/favicon.ico" />
</Head>

<main className={styles.main}>
<h1 className={styles.title}>
Chris[tian] Mazur{" "}
<span role="img" aria-label="mate">

</span>
</h1>

<p className={styles.description}>
IT Consultant - Software Developer - Passionate about Tech Communities and collaborative learning.{" "}🇦🇷 🇳🇿 🧉♟
</p>

<div className={styles.grid}>
<a href="https://twitter.com/chmazur" className={styles.cardSocial}>
<h2>Twitter &rarr;</h2>
<p>@chmazur</p>
</a>

<a href="https://www.linkedin.com/in/cloud-native" className={styles.cardSocial}>
<h2>LinkedIn &rarr;</h2>
<p>cloud-native</p>
</a>

<a href="https://github.com/chaltenio" className={styles.cardSocial}>
<h2>Github &rarr;</h2>
<p>chaltenio</p>
</a>
</div>

<div className={styles.grid}>

<a href="#" className={styles.cardSocial}>
<h2>Blog?</h2>
<p>Coming soon!</p>
</a>

<a href="https://discord.gg/xT9cMSy" className={styles.cardSocial}>
<h2>Discord &rarr;</h2>
<p>Join me!</p>
</a>

<a href="https://www.chess.com/member/chmazur" className={styles.cardSocial}>
<h2>Chess.com &rarr;</h2>
<p>Let's play?!</p>
</a>
</div>

<div className={styles.grid}>
<div>
<h2>My journey with communities:{' '} </h2>

<div>
<p>
- Argentina PHP User Group Co-Founder <br />
- Co-Founder & Co-Organizer PHP Conference Argentina (Buenos Aires - @phpconferencear)<br />
- Founder & Organizer PHP Conference New Zealand (Wellington - php.org.nz)<br />
- Founder & Organizer ScaleConf New Zealand (Wellington - @sconfnz)<br />
- Founder & Organizer Cloud Native Summit (Wellington - {" "}<a href="https://cloudnativesummit.co/nz" target="_blank">
cloudnativesummit.co)</a><br />
- Founder & Organizer Service Mesh Day (San Francisco & Online - {" "}<a href="https://servicemeshday.com" target="_blank">servicemeshday.com</a>)<br />
- Founder & Organizer FullStack Day (Auckland & Online - {" "}<a href="https://fullstackday.com" target="_blank">fullstackday.com</a>)<br />
- Web Dev Meetup Wellington & Auckland<br />
- Devops Meetup Wellington<br />
- Cloud Native Meetup Auckland, <br />
- Connectar.DEV (online meetup)<br />
- Organizer Elastic NZ community<br />
- Layer5 contributor (Service Meshes community)<br />
</p>
</div>

</div>
</div>

</main>

<footer className={styles.footer}>
<a
href="https://mate.dev/chris"
target="_blank"
rel="noopener noreferrer"
>
2021 - Contact
</a>
</footer>
</div>
)
}

export default Chris
44 changes: 10 additions & 34 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,39 @@
import Head from 'next/head'
import Image from 'next/image'
import Newsletter from "../components/newsletter";
import styles from '../styles/Home.module.css'

export default function Home() {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<title>mate.dev</title>
<meta name="description" content="mate.dev community" />
<link rel="icon" href="/favicon.ico" />
</Head>

<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
Welcome to mate.dev!
</h1>

<p className={styles.description}>
Get started by editing{' '}
<code className={styles.code}>pages/index.js</code>
<code className={styles.code}>Connecting the DEV Community in the Southern Hemisphere</code>
</p>

<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h3>Documentation &rarr;</h3>
<p>Find in-depth information about Next.js features and API.</p>
</a>

<a href="https://nextjs.org/learn" className={styles.card}>
<h3>Learn &rarr;</h3>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>

<a
href="https://github.com/vercel/next.js/tree/master/examples"
className={styles.card}
>
<h3>Examples &rarr;</h3>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>

<a
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h3>Deploy &rarr;</h3>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
<Newsletter />
</div>

</main>

<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
href="https://mate.dev/chris"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<img src="/vercel.svg" alt="Vercel Logo" className={styles.logo} />
2021 - Contact
</a>
</footer>
</div>
Expand Down
Binary file added public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
Loading

1 comment on commit 965442b

@vercel
Copy link

@vercel vercel bot commented on 965442b Jun 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.