Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lillijo committed Jun 20, 2024
1 parent 6cb8e9b commit 192d8fe
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 41 deletions.
Binary file added public/assets/placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/components/filters/filterGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import FilterTag from '@/components/filterTag';
import { useAppStore } from '@/lib/useAppContext';
import { Filter } from '@/types/types';
import { useTranslations } from 'next-intl';
import { useSearchParams } from 'next/navigation';

export type FilterGroupProps = {
title: 'faculties' | 'formats' | 'languages';
Expand All @@ -11,7 +12,8 @@ export type FilterGroupProps = {

export default function FilterGroup({ title, list }: FilterGroupProps) {
const t = useTranslations('Filtering');
const selectedId = useAppStore((state) => state[list[0]?.searchParam ?? '']);
const searchParams = useSearchParams();
const selectedId = searchParams.get(list[0]?.searchParam ?? '');
return (
<div className="w-full">
<div className="px-1 pt-1 text-grey">{t(title)}:</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/navigation/mobile/menu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useAppStore } from '@/lib/useAppContext';
import cx from 'classnames';
import { Link } from '@/navigation';
import { ColorSchemeSwitcher } from '../colorSchemeSwitcher';
import ColorSchemeSwitcher from '../colorSchemeSwitcher';
import SmoothButton from '@/components/smoothbutton';

export type MenuMobileProps = {};
Expand Down
20 changes: 3 additions & 17 deletions src/components/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ export type ImageWrapperProps = {
src: string;
alt?: string;
};
const keyStr =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

const triplet = (e1: number, e2: number, e3: number) =>
keyStr.charAt(e1 >> 2) +
keyStr.charAt(((e1 & 3) << 4) | (e2 >> 4)) +
keyStr.charAt(((e2 & 15) << 2) | (e3 >> 6)) +
keyStr.charAt(e3 & 63);

const rgbDataURL = (r: number, g: number, b: number) =>
`data:image/gif;base64,R0lGODlhAQABAPAA${
triplet(0, r, g) + triplet(b, 255, 255)
}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`;

export default function ImageWrapper({
className,
Expand All @@ -28,15 +15,14 @@ export default function ImageWrapper({
return (
<Image
src={src}
height={500}
height={100}
width={500}
alt={alt ?? 'thumbnail of student project'}
placeholder="blur"
className={cx(
'w-full max-w-[400px] object-contain text-highlight md:max-w-[800px]',
'w-full max-w-[400px] object-contain md:max-w-[800px]',
className,
)}
blurDataURL={rgbDataURL(0, 255, 161)}
placeholder="empty"
/>
);
}
17 changes: 1 addition & 16 deletions src/components/project/authors.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,9 @@ export default function ProjectCardAuthors({ item }: ProjectCardProps) {
return <></>;
}

return (
<Link
href={{
pathname: `/project/[id]`,
params: { id: item.id },
}}
>
<ProjectCardAuthorsContainer>
{item.authors.join(' ')}
</ProjectCardAuthorsContainer>
</Link>
);
}

function ProjectCardAuthorsContainer({ children }: ReactNodeProps) {
return (
<div className="px-gutter-md pb-gutter-md text-right text-xs">
{children}
{item.authors.join(' ')}
</div>
);
}
4 changes: 2 additions & 2 deletions src/components/project/image.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default function ProjectCardImage({ item }: ProjectCardProps) {
return (
<div className="relative w-full overflow-hidden">
<ImageWrapper
className="rounded-md bg-highlight"
src={item.thumbnail ?? ''}
className="rounded-md bg-primary text-primary hover:text-primary"
src={item.thumbnail != '' ? item.thumbnail : '/assets/placeholder.png'}
/>
<SaveButton itemId={item.id} />
</div>
Expand Down
4 changes: 1 addition & 3 deletions src/components/smoothbutton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export default function SmoothButton({
className={cx(
'group absolute h-10 w-10 hover:bg-primary hover:text-highlight',
`bg-${color}`,
bottom
? 'bottom-gutter-xs right-gutter-xs rounded-br-md rounded-tl-md'
: '',
bottom ? 'bottom-0 right-0 rounded-br-md rounded-tl-md' : '',
top ? 'right-0 top-0 rounded-bl-md ' : '',
)}
title={title}
Expand Down
2 changes: 1 addition & 1 deletion src/types/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type ItemContent = {
export type Item = {
id: string;
name: string;
thumbnail?: string;
thumbnail: string;
thumbnail_full_size?: string;
descriptions?: ItemDescription;
languages?: string[];
Expand Down

0 comments on commit 192d8fe

Please sign in to comment.