Skip to content

Commit

Permalink
chore: cleaned up files and config
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbrusegard committed Feb 3, 2024
1 parent 1e4a814 commit f5efde3
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 49 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const config = {
'plugin:prettier/recommended',
],
rules: {
// These opinionated rules are enabled in stylistic-type-checked above.
// Feel free to reconfigure them to your own preference.
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',

Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules

Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
],
"i18n-ally.localesPaths": ["messages"],
"i18n-ally.keystyle": "nested",
"codeQL.githubDatabase.download": "never"
"i18n-ally.keystyle": "nested"
}
Binary file modified bun.lockb
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
"reading-time": "^1.5.0",
"sharp": "^0.33.2",
"tailwind-merge": "^2.2.0",
"tailwind-scrollbar": "^3.0.5",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4"
},
"devDependencies": {
Expand All @@ -60,7 +58,9 @@
"postcss": "^8.4.31",
"prettier": "^3.1.0",
"prettier-plugin-tailwindcss": "^0.5.7",
"tailwind-scrollbar": "^3.0.5",
"tailwindcss": "^3.3.5",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5.1.6"
},
"packageManager": "[email protected]"
Expand Down
3 changes: 1 addition & 2 deletions src/app/[locale]/(dashboard)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { unstable_setRequestLocale } from 'next-intl/server';
import { type ReactNode } from 'react';

import { Footer } from '@/components/layout/Footer';
import { Header } from '@/components/layout/Header';
import { Main } from '@/components/layout/Main';

type DashboardProps = {
children: ReactNode;
children: React.ReactNode;
params: { locale: string };
};

Expand Down
3 changes: 1 addition & 2 deletions src/app/[locale]/(dashboard)/news/(header)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { SquarePen } from 'lucide-react';
import { useTranslations } from 'next-intl';
import { unstable_setRequestLocale } from 'next-intl/server';
import { type ReactNode } from 'react';

import { Link } from '@/lib/navigation';

import { Button } from '@/components/ui/Button';

type NewsHeaderProps = {
children: ReactNode;
children: React.ReactNode;
params: { locale: string };
};

Expand Down
12 changes: 11 additions & 1 deletion src/app/[locale]/(dashboard)/news/[article]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from '@/mock-data/article';
import { useTranslations } from 'next-intl';
import { unstable_setRequestLocale } from 'next-intl/server';
import Image from 'next/image';
import { notFound } from 'next/navigation';
import readingTime from 'reading-time';

Expand Down Expand Up @@ -49,7 +50,16 @@ export default function Article({
return (
<>
<h2 className='first:my-4'>{article.title}</h2>
<section className='flex items-center gap-4'>
<section className='mb-6 md:mb-10'>
<Image
className='h-full w-full rounded-lg'
src={`/${article.photoUrl}`}
alt={article.title}
width={100}
height={100}
/>
</section>
<section className='mb-12 flex items-center gap-4'>
<AvatarIcon
photoUrl={`/${author.photoUrl}`}
name={author.name}
Expand Down
5 changes: 2 additions & 3 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { getTranslations, unstable_setRequestLocale } from 'next-intl/server';
import { Inter, Montserrat } from 'next/font/google';
import { notFound } from 'next/navigation';
import { type ReactNode } from 'react';

import { locales } from '@/lib/config';
import { cx } from '@/lib/utils';

import { RootProviders } from '@/components/providers/RootProviders';

type LocalelayoutProps = {
children: ReactNode;
children: React.ReactNode;
params: { locale: string };
};

Expand Down Expand Up @@ -86,7 +85,7 @@ export default function Localelayout({
suppressHydrationWarning
>
<body className='h-full w-full bg-background font-inter text-foreground antialiased'>
<RootProviders params={{ locale: locale }}>
<RootProviders locale={locale}>
<div className='fixed bottom-0 top-0 flex h-full w-full flex-col overflow-y-scroll scroll-smooth scrollbar-thin scrollbar-track-background scrollbar-thumb-primary/40 scrollbar-corner-background scrollbar-thumb-rounded-lg hover:scrollbar-thumb-primary/80'>
{children}
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { type ReactNode } from 'react';

import '@/styles/globals.css';

type RootlayoutProps = {
children: ReactNode;
children: React.ReactNode;
};

export default function Rootlayout({ children }: RootlayoutProps) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function Footer() {
const year = new Date().getFullYear();
return (
<footer className='flex w-full justify-center border-t border-border/40 bg-background/95 px-11 py-10 md:px-16 lg:px-24'>
<div className='w-full max-w-screen-2xl text-sm'>
<div className='h-full w-full max-w-screen-2xl text-sm'>
<div className='grid grid-cols-1 gap-x-4 gap-y-12 xs:grid-cols-2 sm:grid-cols-3 lg:grid-cols-4'>
<div>
<div className='flex'>
Expand Down
7 changes: 1 addition & 6 deletions src/components/layout/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
'use client';

import { type ReactNode } from 'react';

import { cx } from '@/lib/utils';

type MainProps = {
children?: ReactNode;
children?: React.ReactNode;
mainClassName?: string;
className?: string;
};
Expand All @@ -18,7 +14,6 @@ function Main({ children, mainClassName, className }: MainProps) {
'h-full w-full max-w-screen-2xl px-4 duration-1000 animate-in fade-in max-md:slide-in-from-left-8 sm:px-11 md:px-16 md:slide-in-from-top-8 lg:px-24',
className,
)}
id='main'
>
{children}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/profile/AvatarIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ function AvatarIcon({ className, photoUrl, name, initials }: AvatarIconProps) {
<Avatar className={className}>
{photoUrl && (
<Image
className='aspect-square h-full w-full'
className='object-cover object-center'
src={photoUrl}
alt={name}
sizes='(max-width: 768px) 100%, 100%'
fill
width={40}
height={40}
/>
)}
{!photoUrl && <AvatarFallback>{initials}</AvatarFallback>}
Expand Down
7 changes: 3 additions & 4 deletions src/components/providers/IntlErrorProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { NextIntlClientProvider, useMessages } from 'next-intl';
import { type ReactNode } from 'react';

type Props = {
children: ReactNode;
params: { locale: string };
children: React.ReactNode;
locale: string;
};

function IntlErrorProvider({ children, params: { locale } }: Props) {
function IntlErrorProvider({ children, locale }: Props) {
const messages = useMessages();
return (
<NextIntlClientProvider
Expand Down
14 changes: 5 additions & 9 deletions src/components/providers/RootProviders.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { type ReactNode } from 'react';

import { IntlErrorProvider } from '@/components/providers/IntlErrorProvider';
import { ThemeProvider } from '@/components/providers/ThemeProvider';

type Props = {
children: ReactNode;
params: { locale: string };
type RootProvidersProps = {
children: React.ReactNode;
locale: string;
};

function RootProviders({ children, params: { locale } }: Props) {
function RootProviders({ children, locale }: RootProvidersProps) {
return (
<ThemeProvider>
<IntlErrorProvider params={{ locale: locale }}>
{children}
</IntlErrorProvider>
<IntlErrorProvider locale={locale}>{children}</IntlErrorProvider>
</ThemeProvider>
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/providers/ThemeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'use client';

import { ThemeProvider } from 'next-themes';
import { type ReactNode } from 'react';

function NextThemeProvider({ children }: { children: ReactNode }) {
function NextThemeProvider({ children }: { children: React.ReactNode }) {
return (
<ThemeProvider
attribute='class'
Expand Down
8 changes: 3 additions & 5 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import tailwindScrollbar from 'tailwind-scrollbar';
import { type Config } from 'tailwindcss';
import tailwindAnimate from 'tailwindcss-animate';
import { fontFamily } from 'tailwindcss/defaultTheme';

const config = {
Expand Down Expand Up @@ -69,11 +71,7 @@ const config = {
},
},
},
plugins: [
require('tailwindcss-animate'),
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-var-requires
require('tailwind-scrollbar')({ nocompatible: true }),
],
plugins: [tailwindAnimate, tailwindScrollbar({ nocompatible: true })],
} satisfies Config;

export default config;

0 comments on commit f5efde3

Please sign in to comment.