Skip to content

Commit

Permalink
Merge branch 'main' into Skeleton-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkmift authored May 10, 2024
2 parents 3e62665 + 9501ffc commit 2c7aded
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function RootLayout({
className={`min-h-screen flex flex-col items-stretch m-0 darkmode-main ${birzia.className} ${inter.variable}`}
>
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<Header />
<Header/>
<main className="flex flex-col flex-1 h-full pt-24 md:pt-32">
<NextIntlClientProvider locale={locale} messages={messages}>
{children}
Expand Down
5 changes: 5 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import useLocalStorage from "@/hooks/useLocalStorage";

export default function RootLayout({
children,
params: { locale },
}: {
children: React.ReactNode;
params: { locale: string };
}) {



return (
<html lang={locale} dir="rtl">
<body>{children}</body>
Expand Down
1 change: 1 addition & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"baseColor": "slate",
"cssVariables": false
},

"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
Expand Down
15 changes: 13 additions & 2 deletions components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import dynamic from 'next/dynamic';
import { LINKS } from '@/config/consts';
import HeaderItems from './HeaderItems';
import { useTranslations } from 'next-intl';
import useTextDirection from '@/hooks/useTextDirection';


const NavRightSide = dynamic(() => import('./NavRightSide'), {
ssr: false,
Expand All @@ -17,8 +19,14 @@ const NavRightSide = dynamic(() => import('./NavRightSide'), {
),
});

const Header: React.FC = () => {



const Header: React.FC= () => {
const t = useTranslations('Header');
const direction = useTextDirection()


const headerText = {
projects: t('projects'),
aboutUs: t('aboutUs'),
Expand All @@ -29,7 +37,10 @@ const Header: React.FC = () => {
};
return (
<>
<nav className="fixed inset-0 z-50 flex items-center justify-between px-10 bg-lightBg dark:bg-darkBg max-h-24">
<nav
dir={direction}
className="fixed inset-0 z-50 flex items-center justify-between px-10 bg-lightBg dark:bg-darkBg max-h-24 "
>
<NavRightSide />
<HeaderItems headerText={headerText} />
<Link href={LINKS.HOME}>
Expand Down
20 changes: 8 additions & 12 deletions components/Projects/FiltersBar/FiltersBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ const FiltersBar: React.FC<FiltersBarProps> = ({
t('sortOptions.recentlyUpdated'),
];

const sortOptionsMapper: Record<string, ProjectPaginationFilter> = {
אקראי: ProjectPaginationFilter.ALL,
'עודכן לאחרונה': ProjectPaginationFilter.RECENTLY_UPDATED,
'מספר תורמים': ProjectPaginationFilter.MOST_CONTROBUTORS,
'נוצר לאחרונה': ProjectPaginationFilter.RECENTLY_CREATED,
const sortOptionsMapper: Record<number, ProjectPaginationFilter> = {
0: ProjectPaginationFilter.ALL,
3: ProjectPaginationFilter.RECENTLY_UPDATED,
1: ProjectPaginationFilter.MOST_CONTROBUTORS,
2: ProjectPaginationFilter.RECENTLY_CREATED,
};

const [toggleFiltersWindow, setToggleFiltersWindow] = useState(false);
Expand All @@ -54,16 +54,12 @@ const FiltersBar: React.FC<FiltersBarProps> = ({
const handleCategoryOptionSelection = (
event: ChangeEvent<HTMLInputElement>
) => {
for (const option of sortOptions) {
sortOptions.forEach((option, index) => {
if (option === event.target.value) {
setFetchByCategory(sortOptionsMapper[option]);
setFetchByCategory(sortOptionsMapper[index]);
setSelectedSortOption(option);
return;
}
}

setFetchByCategory(ProjectPaginationFilter.ALL);
setSelectedSortOption(sortOptions[0]);
});
};

const handleFilterOptionChange = (filter: ProjectFilter) => {
Expand Down

0 comments on commit 2c7aded

Please sign in to comment.