Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add readme #39

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# Portfolio
## 🎉 Project Overview
My personal portfolio website built using Next.js, Tailwind CSS and Framer-motion.

## 📍 Live

Link to the live version: [https://michalskolak.vercel.app](https://michalskolak.vercel.app)

## 💾 Installation
Download the project to your computer and install needed packages with command:

```bash
$ npm install
```
Then create .env file:
```bash
SITE_URL='https://example.com' ## Required to generate sitemap by next-sitemap
RESEND_API_KEY='your_resend_api_key' ## Required to send email by resend
```

Then start the project on the local server with the command:

```bash
$ npm run dev
```

and open http://localhost:3000 to see this app.

## 🔧 Tech/framework used
- Next.js
- TypeScript
- Tailwind CSS
- Framer-motion
- React-hook-form
- Resend

If you encounter a problem, write to this e-mail address: [[email protected]](mailto:[email protected])
253 changes: 0 additions & 253 deletions d

This file was deleted.

2 changes: 1 addition & 1 deletion src/actions/send-email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { Resend } from 'resend';

import { TFormSchema } from '@/components/contact';
import { env } from '@/env.mjs';
import { TFormSchema } from '@/lib/form-schema';

const resend = new Resend(env.RESEND_API_KEY);

Expand Down
14 changes: 2 additions & 12 deletions src/components/contact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,15 @@ import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { motion } from 'framer-motion';
import { toast } from 'sonner';
import { z } from 'zod';

import { sendEmail } from '@/actions/send-email';
import { Button } from '@/components/button';
import { Icons } from '@/components/icons';
import { SectionHeading } from '@/components/section-heading';
import { useSectionInView } from '@/hooks/use-section-in-view';
import { formSchema, TFormSchema } from '@/lib/form-schema';
import { cn } from '@/lib/utils';

const formSchema = z.object({
email: z
.string()
.min(1, { message: 'Email is required' })
.email({ message: 'Must be a valid email' }),
message: z.string().min(1, { message: 'Message is required' }),
});

export type TFormSchema = z.infer<typeof formSchema>;

export const Contact = () => {
const { ref } = useSectionInView('Contact');
const {
Expand Down Expand Up @@ -94,7 +84,7 @@ export const Contact = () => {
{...register('message')}
className={cn(
'border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-60 w-full resize-none rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
errors.email?.message && 'border-destructive'
errors.message?.message && 'border-destructive'
)}
></textarea>
{errors.message?.message && (
Expand Down
11 changes: 11 additions & 0 deletions src/lib/form-schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { z } from 'zod';

export const formSchema = z.object({
email: z
.string()
.min(1, { message: 'Email is required' })
.email({ message: 'Must be a valid email' }),
message: z.string().min(1, { message: 'Message is required' }),
});

export type TFormSchema = z.infer<typeof formSchema>;
Loading