Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
hta218 committed Aug 13, 2023
1 parent 0fdf284 commit 5b9df44
Show file tree
Hide file tree
Showing 27 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion components/BuiltWith.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DevIcon } from './DevIcon'
import { Link } from './Link'

export function BuiltWith() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<div className="flex items-center space-x-1">
Expand Down
2 changes: 1 addition & 1 deletion components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useTranslation } from 'next-i18next'
import { BuiltWith } from './BuiltWith'

export function Footer() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<footer>
Expand Down
2 changes: 1 addition & 1 deletion components/MobileNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import clsx from 'clsx'
import { useTranslation } from 'next-i18next'

export function MobileNav({ navShow, onToggleNav }) {
const { t } = useTranslation('common')
let { t } = useTranslation('common')
let className = clsx(
`sm:hidden fixed w-full h-screen inset-0 bg-gray-200 dark:bg-gray-800 opacity-95 z-50 transition-transform transform ease-in-out duration-300`,
navShow ? 'translate-x-0' : 'translate-x-full'
Expand Down
2 changes: 1 addition & 1 deletion components/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useTranslation } from 'next-i18next'
export function Pagination({ totalPages, currentPage }: PaginationType) {
let hasPrevPage = currentPage - 1 > 0
let hasNextPage = currentPage + 1 <= totalPages
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<div className="space-y-2 pb-8 pt-6 md:space-y-5">
Expand Down
2 changes: 1 addition & 1 deletion components/PostsSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from 'next-i18next'

export function PostsSearch({ onChange }: { onChange: (value: string) => void }) {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<div className="relative max-w-lg">
Expand Down
2 changes: 1 addition & 1 deletion components/ProfileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function ProfileCard() {
}
}, [onMouseLeave, onMouseMove])

const { t } = useTranslation('common')
let { t } = useTranslation('common')
return (
<div
className="z-10 mb-8 scale-100 transition-all duration-200 ease-out hover:z-50 xl:mb-0 xl:hover:scale-[1.15]"
Expand Down
2 changes: 1 addition & 1 deletion components/ProfileInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { siteMetadata } from '~/data/siteMetadata'
import { useTranslation } from 'next-i18next'

export function ProfileCardInfo() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<div className="hidden py-4 xl:block xl:px-6">
Expand Down
2 changes: 1 addition & 1 deletion components/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Link } from './Link'
import { useTranslation } from 'next-i18next'

export function ProjectCard({ project }: ProjectCardProps) {
const { t } = useTranslation('common')
let { t } = useTranslation('common')
let { title, description, imgSrc, url, repo, builtWith } = project
let { data } = useSWR(`/api/github?repo=${repo}`, fetcher)
let repository: GithubRepository = data?.repository
Expand Down
2 changes: 1 addition & 1 deletion components/ViewCounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function ViewCounter({ slug, className }: ViewCounterProps) {
registerView()
}, [slug])

const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<span className={className}>
Expand Down
2 changes: 1 addition & 1 deletion components/homepage/BlogLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Twemoji } from '../Twemoji'
import { useTranslation } from 'next-i18next'

export function BlogLinks() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<div className="flex flex-col space-y-1.5">
Expand Down
6 changes: 3 additions & 3 deletions components/homepage/FeaturedPosts.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useTranslation } from 'next-i18next'
import { Link } from '~/components/Link'
import { BlogTags } from '~/components/blog/BlogTags'
import { FEATURED_POSTS } from '~/constant'
import type { BlogFrontMatter } from '~/types'
import { formatDate } from '~/utils/date'
import { BlogTags } from '../blog/BlogTags'
import { Link } from '../Link'
import { useTranslation } from 'next-i18next'

export function FeaturedPosts({ posts }: { posts: BlogFrontMatter[] }) {
const { t, i18n } = useTranslation()
Expand Down
2 changes: 1 addition & 1 deletion components/homepage/Greeting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useTranslation } from 'next-i18next'
import clsx from 'clsx'

export function Greeting() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

let className = clsx(
'bg-gradient-to-r from-yellow-600 to-red-600 dark:bg-gradient-to-l dark:from-emerald-500 dark:to-lime-600',
Expand Down
2 changes: 1 addition & 1 deletion components/homepage/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useTranslation } from 'next-i18next'
import { Twemoji } from '~/components/Twemoji'

export function Heading() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<h1 className="text-neutral-900 dark:text-neutral-200">
Expand Down
2 changes: 1 addition & 1 deletion components/homepage/ShortDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from 'next-i18next'

export function ShortDescription() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<div className="mb-8 mt-4">
Expand Down
2 changes: 1 addition & 1 deletion components/homepage/TypedBios.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from 'next-i18next' // Import the hook
export function TypedBios() {
let el = React.useRef(null)
let typed = React.useRef(null)
const { t } = useTranslation('common') // Use the hook to get the translation function
let { t } = useTranslation('common') // Use the hook to get the translation function

React.useEffect(() => {
typed.current = new Typed(el.current, {
Expand Down
2 changes: 1 addition & 1 deletion layouts/AuthorLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { AuthorLayoutProps } from '~/types'
import { useTranslation } from 'next-i18next'

export function AuthorLayout({ children }: AuthorLayoutProps) {
const { t } = useTranslation('common') // utilitza 'common' si els teus strings estan a common.ts o canvia-ho pel nom adequat
let { t } = useTranslation('common') // utilitza 'common' si els teus strings estan a common.ts o canvia-ho pel nom adequat

let title = t('menu_sobremi')
let description = t('about_description')
Expand Down
2 changes: 1 addition & 1 deletion layouts/ListLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function ListLayout(props: ListLayoutProps) {
let displayPosts =
initialDisplayPosts.length > 0 && !searchValue ? initialDisplayPosts : filteredBlogPosts

const { t } = useTranslation('common') // utilitza 'common' si els teus strings estan a common.ts o canvia-ho pel nom adequat
let { t } = useTranslation('common') // utilitza 'common' si els teus strings estan a common.ts o canvia-ho pel nom adequat
return (
<>
<div className="divide-y divide-gray-200 dark:divide-gray-700">
Expand Down
6 changes: 3 additions & 3 deletions layouts/ResumeLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import stylesResume from './ResumeLayout.module.css'
import { useTranslation } from 'next-i18next'

export function ResumeLayout({ children, toc }) {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

let description = t('resume_description')

Expand All @@ -26,8 +26,8 @@ export function ResumeLayout({ children, toc }) {
<ToC toc={toc} />
<div
className={`font-arial text-gray-900 leading-6 space-y-5 prose prose-slate
md:p-5 md:border-l md:border-gray-300
table-auto border-collapse
md:p-5 md:border-l md:border-gray-300
table-auto border-collapse
bg-gray-100 ${stylesResume.customTable}`}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion pages/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function getStaticProps({ locale }) {
}

export default function FourZeroFour() {
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<div className="flex flex-col items-center justify-center pt-4 md:pt-10 xl:pt-20">
Expand Down
2 changes: 1 addition & 1 deletion pages/blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function getStaticProps({ locale }) {
}

export default function Blog({ posts, initialDisplayPosts, pagination }: BlogListProps) {
const { t } = useTranslation('common') // utilitza 'common' si els teus strings estan a common.ts o canvia-ho pel nom adequat
let { t } = useTranslation('common') // utilitza 'common' si els teus strings estan a common.ts o canvia-ho pel nom adequat
return (
<>
<PageSeo
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function getStaticProps({
export default function Blog(props: BlogProps) {
let { post, ...rest } = props
let { mdxSource, frontMatter } = post
const { t } = useTranslation('common')
let { t } = useTranslation('common')

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/page/[page].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function getStaticProps({

export default function PostPage(props: BlogListProps) {
let { posts, initialDisplayPosts, pagination } = props
const { t } = useTranslation('common')
let { t } = useTranslation('common')
return (
<>
<PageSeo title={t('siteMetadata.title')} description={t('siteMetadata.description')} />
Expand Down
6 changes: 2 additions & 4 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'

export async function getStaticProps({ locale }) {
let posts = getAllFilesFrontMatter(`${locale}/blog`)

// Afegeix la traducció
return {
props: {
posts,
...(await serverSideTranslations(locale, ['common'])), // Aquí estem assumint que el nom del teu fitxer de traducció és 'common'
...(await serverSideTranslations(locale, ['common'])),
},
}
}

export default function Home({ posts }) {
const { t } = useTranslation('common') // utilitza 'common' si els teus strings estan a common.ts o canvia-ho pel nom adequat
let { t } = useTranslation('common')

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion pages/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function getStaticProps({ locale }) {
export default function Projects({ projectsData }) {
let workProjects = projectsData.filter(({ type }) => type === 'work')
let sideProjects = projectsData.filter(({ type }) => type === 'self')
const { t } = useTranslation('common')
let { t } = useTranslation('common')

let description = t('projects.projects_description')

Expand Down
2 changes: 1 addition & 1 deletion pages/snippets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function getStaticProps({ locale }: { locale: string }) {
}

export default function Snippet({ snippets }: { snippets: SnippetFrontMatter[] }) {
const { t } = useTranslation('common')
let { t } = useTranslation('common')
let description = t('menu_receptes_2')
return (
<>
Expand Down
2 changes: 1 addition & 1 deletion pages/tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function getStaticProps({ locale }) {

export default function Tags({ tags }: { tags: TagsCount }) {
let sortedTags = Object.keys(tags).sort((a, b) => tags[b] - tags[a])
const { t } = useTranslation('common')
let { t } = useTranslation('common')
return (
<>
<PageSeo title={`Tags - ${t('siteMetadata.author')}`} description={t('blog.intro')} />
Expand Down
2 changes: 1 addition & 1 deletion pages/tags/[tag].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function getStaticProps({
}

export default function Tag({ posts, tag }: { posts: BlogFrontMatter[]; tag: string }) {
const { t } = useTranslation('common') // Mueve esto al principio de tu componente
let { t } = useTranslation('common') // Mueve esto al principio de tu componente

// Capitalize first letter and convert space to dash
if (!tag) {
Expand Down

1 comment on commit 5b9df44

@vercel
Copy link

@vercel vercel bot commented on 5b9df44 Aug 13, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

leo-huynh-dot-dev – ./

www.leohuynh.dev
leo-huynh-dot-dev-hta218.vercel.app
leo-huynh-dot-dev-git-main-hta218.vercel.app
leohuynh.dev

Please sign in to comment.