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

Feat/contacts page #27

Merged
merged 2 commits into from
Sep 16, 2023
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.storybook
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const config: StorybookConfig = {
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-mdx-gfm',
],
framework: {
name: '@storybook/nextjs',
Expand Down
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"classnames": "^2.3.2",
"clsx": "^2.0.0",
"focus-trap-react": "^10.1.4",
"formik": "^2.4.4",
"framer-motion": "^10.16.1",
"graphql": "^16.8.0",
"i18next": "^23.4.5",
Expand All @@ -51,18 +52,20 @@
"strapi-flatten-graphql": "^0.1.0",
"styled-components": "^6.0.7",
"tailwind-merge": "^1.12.0",
"typed.js": "^2.0.16"
"typed.js": "^2.0.16",
"yup": "^1.2.0"
},
"devDependencies": {
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@storybook/addon-essentials": "^7.3.2",
"@storybook/addon-interactions": "^7.3.2",
"@storybook/addon-links": "^7.3.2",
"@storybook/blocks": "^7.3.2",
"@storybook/nextjs": "^7.3.2",
"@storybook/react": "^7.3.2",
"@storybook/testing-library": "^0.2.0",
"@storybook/addon-essentials": "^7.4.2",
"@storybook/addon-interactions": "^7.4.2",
"@storybook/addon-links": "^7.4.2",
"@storybook/addon-mdx-gfm": "^7.4.2",
"@storybook/blocks": "^7.4.2",
"@storybook/nextjs": "^7.4.2",
"@storybook/react": "^7.4.2",
"@storybook/testing-library": "^0.2.1",
"@svgr/webpack": "^8.1.0",
"@tailwindcss/forms": "^0.5.3",
"@testing-library/jest-dom": "^5.16.5",
Expand All @@ -89,7 +92,7 @@
"postcss": "^8.4.23",
"prettier": "^3.0.2",
"prettier-plugin-tailwindcss": "^0.5.3",
"storybook": "^7.3.2",
"storybook": "^7.4.2",
"tailwindcss": "^3.3.2",
"typescript": "^5.2.2"
},
Expand Down
3 changes: 2 additions & 1 deletion src/app/(public)/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';

import { shuffleArray } from '@/lib/helper';

import Heading from '@/components/atoms/headings/Heading';
import { QuizData, QuizOption } from '@/components/molecules/RandomFacts/Quiz';
import Books from '@/components/organisms/about-free-time/Books';
import Music from '@/components/organisms/about-free-time/Music';
Expand Down Expand Up @@ -109,7 +110,7 @@ const AboutFreeTimePage = async () => {
<main className='min-h-main'>
<section className='dark:bg-dark bg-white'>
<div className='layout relative flex flex-col py-12'>
<h1 className='mb-5'>About me</h1>
<Heading title='about.title' />

<div className='mb-5'>
<p>
Expand Down
9 changes: 8 additions & 1 deletion src/app/(public)/contacts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import * as React from 'react';

import Heading from '@/components/atoms/headings/Heading';
import ContactForm from '@/components/molecules/ContactForm/ContactForm';

export const metadata = {
title: 'Contacts | MartaCodes.it',
description: 'Contacts page',
Expand All @@ -10,7 +13,11 @@ const ContactsPage = async () => {
<main className='min-h-main'>
<section>
<div className='layout relative flex flex-col py-12'>
<h1 className='mb-5'>Contacts</h1>
<Heading title='contacts.title' />

<div className='bg-slate-200 dark:bg-slate-800 rounded-md p-4 md:px-8 lg:px-10 w-full lg:w-4/5'>
<ContactForm />
</div>
</div>
</section>
</main>
Expand Down
2 changes: 1 addition & 1 deletion src/app/(public)/cv/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const AboutPage = async () => {
<main className='min-h-main'>
<section className='dark:bg-dark bg-white'>
<div className='layout relative flex flex-col py-12'>
<Heading title='aboutWork.title' />
<Heading title='cv.title' />

<Intro intro={intro} />

Expand Down
3 changes: 2 additions & 1 deletion src/app/(public)/projects/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';

import Heading from '@/components/atoms/headings/Heading';
import ProjectCard from '@/components/organisms/projects/ProjectCard';

import { queryProjects } from '@/queries/projects';
Expand All @@ -24,7 +25,7 @@ const ProjectsPage = async () => {
<main className='min-h-main'>
<section>
<div className='layout relative flex flex-col py-12'>
<h1 className='mb-5'>Projects</h1>
<Heading title='projects.title' />

<div className='grid gap-4 sm:grid-cols-2 xl:grid-cols-3'>
{projects.map((project) => (
Expand Down
4 changes: 3 additions & 1 deletion src/app/(public)/uses/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as React from 'react';

import Heading from '@/components/atoms/headings/Heading';

export const metadata = {
title: 'Uses | MartaCodes.it',
description: 'Uses page',
Expand All @@ -10,7 +12,7 @@ const UsesPage = async () => {
<main className='min-h-main'>
<section>
<div className='layout relative flex flex-col py-12'>
<h1 className='mb-5'>Uses</h1>
<Heading title='uses.title' />
</div>
</section>
</main>
Expand Down
43 changes: 43 additions & 0 deletions src/components/atoms/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { Field, useField } from 'formik';

import clsxm from '@/lib/clsxm';

export interface InputProps {
id: string;
type?: 'text' | 'number' | 'email';
label: string;
placeholder?: string;
}

export const Input = ({
id,
type = 'text',
label,
placeholder,
}: InputProps) => {
const fieldProps = { id, name: id, type, label, placeholder };
const [_, meta] = useField(fieldProps);

return (
<label htmlFor='firstName' className='mb-2 mt-6 flex flex-col font-bold'>
{label}
<Field
placeholder={placeholder}
name={id}
id={id}
type={type}
className={clsxm(
'my-2 rounded-md px-4 py-2 ring-1 dark:bg-transparent font-normal',
{
'ring-red-600': meta.touched && meta.error,
'ring-grey-400 dark:ring-slate-500': !meta.touched || !meta.error,
},
)}
/>

<div className='font-sm font-normal text-red-600'>
{meta.touched && meta.error}
</div>
</label>
);
};
37 changes: 37 additions & 0 deletions src/components/atoms/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Field, useField } from 'formik';

import clsxm from '@/lib/clsxm';

export interface TextAreaProps {
id: string;
label: string;
placeholder?: string;
}

export const TextArea = ({ id, label, placeholder }: TextAreaProps) => {
const fieldProps = { id, name: id, label, placeholder };
const [_, meta] = useField(fieldProps);

return (
<label htmlFor='firstName' className='mb-2 mt-6 flex flex-col font-bold'>
{label}
<Field
as='textarea'
placeholder={placeholder}
name={id}
id={id}
className={clsxm(
'my-2 rounded-md px-4 py-2 ring-1 dark:bg-transparent font-normal',
{
'ring-red-600': meta.touched && meta.error,
'ring-grey-400 dark:ring-slate-500': !meta.touched || !meta.error,
},
)}
rows={7}
/>
<div className='font-sm font-normal text-red-600'>
{meta.touched && meta.error}
</div>
</label>
);
};
48 changes: 48 additions & 0 deletions src/components/atoms/select/Select.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Field, useField } from 'formik';

import clsxm from '@/lib/clsxm';

export interface SelectProps {
id: string;
label: string;
options: Option[];
}

export interface Option {
key: string;
value: string;
}

export const Select = ({ id, label, options }: SelectProps) => {
const fieldProps = { label, id, name: id, options };
const [_, meta] = useField(fieldProps);

return (
<label htmlFor={id} className='mb-2 mt-6 flex flex-col font-bold'>
{label}
<Field
as='select'
name={id}
id={id}
className={clsxm(
'my-2 rounded-md px-4 py-2 ring-1 dark:bg-transparent font-normal',
{
'ring-red-600': meta.touched && meta.error,
'ring-grey-400 dark:ring-slate-500': !meta.touched || !meta.error,
},
)}
defaultValue='none'
>
<option value='none'>Please select</option>
{options.map((option) => (
<option value={option.value} key={option.key}>
{option.value}
</option>
))}
</Field>
<div className='font-sm font-normal text-red-600'>
{meta.touched && meta.error}
</div>
</label>
);
};
Loading
Loading