Skip to content
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
28 changes: 18 additions & 10 deletions client/src/components/Home/PinnedProjects/PinnedProjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface PinnedProjectsInterface {}
const PinnedProjects: React.FC<PinnedProjectsInterface> = () => {
const { openModal, closeAllModals } = useModals();
const isTailwindLg = useMediaQuery({ minWidth: 1024 });
const isXL = useMediaQuery({ minWidth: 1280 });
const { data, isLoading } = usePinnedProjects();

const onShowPinnedModal = () => {
Expand All @@ -40,7 +41,7 @@ const PinnedProjects: React.FC<PinnedProjectsInterface> = () => {
const panes = useMemo(() => {
if (!data) return [];

const classList = "xl:!ml-24 2xl:!ml-4 3xl:!ml-0 !max-h-[500px] overflow-y-auto xl:!mr-1"
const classList = "xl:!ml-24 2xl:!ml-4 3xl:!ml-0 !max-h-[500px] xl:!mr-1 !pt-1"
const allItemsLength = data
?.map((i) => i.projects?.length)
.reduce((acc, curr) => acc + (curr || 0), 0);
Expand All @@ -64,7 +65,7 @@ const PinnedProjects: React.FC<PinnedProjectsInterface> = () => {
return <NoPinnedMessage />;
}
return (
<Card.Group itemsPerRow={2} className={classList}>
<Card.Group itemsPerRow={isXL ? 1 : 2} className={classList}>
{i.projects?.map((item) =>
typeof item === "string" ? null : (
<ProjectCard project={item} key={item.projectID} />
Expand All @@ -86,7 +87,7 @@ const PinnedProjects: React.FC<PinnedProjectsInterface> = () => {
return <NoPinnedMessage />;
}
return (
<Card.Group itemsPerRow={2} className={classList}>
<Card.Group itemsPerRow={isXL ? 1 : 2} className={classList}>
{data?.map((i) => {
if (typeof i.projects === "string") return null;
return i.projects?.map((item) =>
Expand All @@ -99,12 +100,11 @@ const PinnedProjects: React.FC<PinnedProjectsInterface> = () => {
);
},
});

return items;
}, [data]);
}, [data, isXL]);

return (
<Segment padded={Object.entries(data || {}).length > 0} loading={isLoading} className="!pb-10">
<Segment padded={Object.entries(data || {}).length > 0} loading={isLoading} className="!pb-10 mt-4 flex-1 flex flex-col min-h-0">
<div className="header-custom mb-5">
<h3>
<Icon name="pin" />
Expand All @@ -128,10 +128,18 @@ const PinnedProjects: React.FC<PinnedProjectsInterface> = () => {
/>
</div>
</div>
<Tab
panes={panes}
menu={{ vertical: isTailwindLg, tabular: !isTailwindLg }}
></Tab>
<div className="overflow-x-auto overflow-y-auto flex-1 min-h-0 -mx-4 px-4">
<div className="min-w-min h-full">
<Tab
panes={panes}
menu={{
vertical: isTailwindLg,
tabular: !isTailwindLg,
className: !isTailwindLg ? 'flex-nowrap whitespace-nowrap' : ''
}}
/>
</div>
</div>
</Segment>
);
};
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/projects/ProjectCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const ProjectCard = ({

return (
<Card raised {...props} className="!max-h-[130px]">
<div className="flex flex-col flex-grow p-4">
<div className="flex flex-col flex-grow p-4 overflow-y-auto overflow-x-auto">
<div className="flex">
<div className="flex flex-col flex-1">
<Link
Expand Down
Loading
Loading