Skip to content

Commit

Permalink
Prettier conf (#36)
Browse files Browse the repository at this point in the history
* Prettier config
* Update .gitignore
* Add husky and lint-staged to package.json
  • Loading branch information
oktay authored Jul 22, 2022
1 parent 53c9afc commit 0a4f7e9
Show file tree
Hide file tree
Showing 32 changed files with 878 additions and 338 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ yarn-error.log*

# vercel
.vercel

# eslint
.eslintcache
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"singleQuote": true,
"trailingComma": "all",
"semi": false,
"endOfLine": "lf"
}
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ npm run dev
Contributors names and contact info

- [@oktay](https://github.com/oktay)

## License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details

## Sources

* [NextJS](https://nextjs.org/)
* [Tailwind CSS](https://tailwindcss.com/)
* [Dato CMS](https://www.datocms.com/docs/next-js)
* [Github API](https://docs.github.com/en/rest)
* [Dribbble API](https://developer.dribbble.com/v2/)
* [Next-Intl](https://www.thisdot.co/blog/next-js-adding-localization-with-next-intl)
- [NextJS](https://nextjs.org/)
- [Tailwind CSS](https://tailwindcss.com/)
- [Dato CMS](https://www.datocms.com/docs/next-js)
- [Github API](https://docs.github.com/en/rest)
- [Dribbble API](https://developer.dribbble.com/v2/)
- [Next-Intl](https://www.thisdot.co/blog/next-js-adding-localization-with-next-intl)
4 changes: 2 additions & 2 deletions components/avatar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from 'next/image'

export default function Avatar({ img, alt }) {
return (
Expand All @@ -7,5 +7,5 @@ export default function Avatar({ img, alt }) {
<Image src={img} alt={alt} layout="fill" />
</div>
</figure>
);
)
}
4 changes: 2 additions & 2 deletions components/button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cx from 'classnames';
import cx from 'classnames'

export default function Button({
className,
Expand Down Expand Up @@ -35,5 +35,5 @@ export default function Button({
</span>
</span>
</a>
);
)
}
4 changes: 2 additions & 2 deletions components/credits-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function CreditsLink({ href, label, icon }) {
action: 'Credits Click',
target: 'Footer Credits',
label: label,
};
}

return (
<a
Expand All @@ -18,5 +18,5 @@ export default function CreditsLink({ href, label, icon }) {
<span className="text-sm rounded-full">{icon}</span>
<span>{label}</span>
</a>
);
)
}
6 changes: 3 additions & 3 deletions components/email.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from 'next/link';
import { FiArrowUpRight, FiMail } from 'react-icons/fi';
import Link from 'next/link'
import { FiArrowUpRight, FiMail } from 'react-icons/fi'

export default function Email({ href, children }) {
return (
Expand All @@ -16,5 +16,5 @@ export default function Email({ href, children }) {
<span className="text-lg font-semibold">{children}</span>
</a>
</Link>
);
)
}
22 changes: 10 additions & 12 deletions components/footer.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { meta } from 'site.config';
import { BsDribbble, BsGithub, BsLinkedin } from 'react-icons/bs';
import { meta } from 'site.config'
import { BsDribbble, BsGithub, BsLinkedin } from 'react-icons/bs'
import {
SiDatocms,
SiDribbble,
SiGithub,
SiNextdotjs,
SiTailwindcss,
SiVercel,
} from 'react-icons/si';
import SocialLink from '@components/social-link';
import Email from '@components/email';
import CreditsLink from './credits-link';
} from 'react-icons/si'
import SocialLink from '@components/social-link'
import Email from '@components/email'
import CreditsLink from './credits-link'

export default function Footer() {
const links = [
Expand All @@ -26,7 +26,7 @@ export default function Footer() {
...meta.socials.dribbble,
icon: <BsDribbble />,
},
];
]

const credits = [
{
Expand Down Expand Up @@ -59,7 +59,7 @@ export default function Footer() {
label: 'Dribbble API',
icon: <SiDribbble />,
},
];
]

return (
<footer className="border-t pt-8 dark:border-t-dark-gray">
Expand All @@ -73,9 +73,7 @@ export default function Footer() {
))}
</ul>
<div className="hidden md:block">
<Email href={`mailto:${meta.email}`}>
{meta.email}
</Email>
<Email href={`mailto:${meta.email}`}>{meta.email}</Email>
</div>
</div>
</div>
Expand All @@ -96,5 +94,5 @@ export default function Footer() {
</div>
</div>
</footer>
);
)
}
8 changes: 4 additions & 4 deletions components/header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Navigation from '@components/navigation';
import Email from '@components/email';
import { meta } from 'site.config';
import Navigation from '@components/navigation'
import Email from '@components/email'
import { meta } from 'site.config'

export default function Header() {
return (
Expand All @@ -14,5 +14,5 @@ export default function Header() {
</div>
</header>
</div>
);
)
}
16 changes: 8 additions & 8 deletions components/locale-switch.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Link from 'next/link';
import cx from 'classnames';
import { useRouter } from 'next/router';
import { HiTranslate } from 'react-icons/hi';
import { useTranslations } from 'next-intl';
import Link from 'next/link'
import cx from 'classnames'
import { useRouter } from 'next/router'
import { HiTranslate } from 'react-icons/hi'
import { useTranslations } from 'next-intl'

export default function LocaleSwitch() {
const { route, locale } = useRouter();
const t = useTranslations('Global');
const { route, locale } = useRouter()
const t = useTranslations('Global')

return (
<Link href={route} locale={locale === 'tr' ? 'en' : 'tr'}>
Expand Down Expand Up @@ -43,5 +43,5 @@ export default function LocaleSwitch() {
</span>
</a>
</Link>
);
)
}
32 changes: 17 additions & 15 deletions components/navigation.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useState } from 'react';
import { FiMenu } from 'react-icons/fi';
import { useTranslations } from 'next-intl';
import Button from '@components/button';
import cx from 'classnames';
import LocaleSwitch from './locale-switch';
import { useState } from 'react'
import { FiMenu } from 'react-icons/fi'
import { useTranslations } from 'next-intl'
import Button from '@components/button'
import cx from 'classnames'
import LocaleSwitch from './locale-switch'

export default function Navigation() {
const [show, setShow] = useState(false);
const t = useTranslations('Global');
const [show, setShow] = useState(false)
const t = useTranslations('Global')

const links = [
{
Expand All @@ -26,17 +26,17 @@ export default function Navigation() {
href: '#projects',
label: t('nav-projects'),
},
];
]

function onClick(label) {
const analyticsData = {
event: 'Click',
action: 'Navigation Click',
target: 'Main Navigation',
label: label,
};
}

window.dataLayer.push(analyticsData);
window.dataLayer.push(analyticsData)
}

function onMobileClick(label) {
Expand All @@ -45,9 +45,9 @@ export default function Navigation() {
action: 'MobileNavigation Click',
target: 'Mobile Navigation',
label: label,
};
}

window.dataLayer.push(analyticsData);
window.dataLayer.push(analyticsData)
}

return (
Expand Down Expand Up @@ -75,7 +75,9 @@ export default function Navigation() {
</ul>
<ul
className={cx(
show ? 'translate-y-0' : 'opacity-0 -translate-y-full pointer-events-none',
show
? 'translate-y-0'
: 'opacity-0 -translate-y-full pointer-events-none',
'bg-zinc-900 flex flex-col absolute top-32 left-0 -z-10 w-full transform origin-top transition lg:hidden',
)}
>
Expand All @@ -95,5 +97,5 @@ export default function Navigation() {
</li>
</ul>
</nav>
);
)
}
21 changes: 15 additions & 6 deletions components/project-card.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Image from 'next/image';
import Image from 'next/image'

export default function ProjectCard({
id,
Expand All @@ -14,9 +14,9 @@ export default function ProjectCard({
action: 'Project Click',
target: 'Project Card',
label: title,
};
}

window.dataLayer.push(analyticsData);
window.dataLayer.push(analyticsData)
}
return (
<div key={id} className="relative rounded-lg overflow-hidden">
Expand All @@ -26,7 +26,10 @@ export default function ProjectCard({
<div className="absolute inset-0 flex flex-col p-8">
<ul className="flex justify-end space-x-4">
{tags.split(',').map((tag, index) => (
<li key={index} className="bg-white border dark:border-0 dark:bg-black dark:text-white px-2 rounded-full">
<li
key={index}
className="bg-white border dark:border-0 dark:bg-black dark:text-white px-2 rounded-full"
>
<span className="text-zinc-400">#</span>
{tag}
</li>
Expand All @@ -37,7 +40,13 @@ export default function ProjectCard({
<p className="text-zinc-600 dark:text-zinc-200">{description}</p>
</div>
</div>
<a href={url} onClick={onClick} target="_blank" rel="noreferrer" className="absolute inset-0"></a>
<a
href={url}
onClick={onClick}
target="_blank"
rel="noreferrer"
className="absolute inset-0"
></a>
</div>
);
)
}
8 changes: 4 additions & 4 deletions components/repo-card.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BsStar, BsEye, BsFileEarmarkCode } from 'react-icons/bs';
import { BsStar, BsEye, BsFileEarmarkCode } from 'react-icons/bs'

export default function RepoCard({
id,
Expand All @@ -18,9 +18,9 @@ export default function RepoCard({
action: 'Repository Click',
target: 'Github Section Repository Card',
label: name,
};
}

window.dataLayer.push(analyticsData);
window.dataLayer.push(analyticsData)
}

// function onHomepageClick() {
Expand Down Expand Up @@ -71,5 +71,5 @@ export default function RepoCard({
</div>
</div>
</div>
);
)
}
16 changes: 8 additions & 8 deletions components/scroll-top.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import cx from 'classnames';
import useScrollPosition from '@react-hook/window-scroll';
import { FiArrowUp } from 'react-icons/fi';
import { useTranslations } from 'next-intl';
import Button from './button';
import cx from 'classnames'
import useScrollPosition from '@react-hook/window-scroll'
import { FiArrowUp } from 'react-icons/fi'
import { useTranslations } from 'next-intl'
import Button from './button'

export default function ScrollTop() {
const scrollPosition = useScrollPosition();
const t = useTranslations('Global');
const scrollPosition = useScrollPosition()
const t = useTranslations('Global')

return (
<div
Expand All @@ -24,5 +24,5 @@ export default function ScrollTop() {
<span className="sr-only">{t('scroll')}</span>
</Button>
</div>
);
)
}
Loading

1 comment on commit 0a4f7e9

@vercel
Copy link

@vercel vercel bot commented on 0a4f7e9 Jul 22, 2022

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.