Skip to content

Commit

Permalink
Merge pull request #16 from gonstoll/minor-fixes
Browse files Browse the repository at this point in the history
fix: Minor fixes
  • Loading branch information
gonstoll committed Jan 3, 2023
2 parents b72c51a + eacce2e commit b194971
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 30 deletions.
5 changes: 2 additions & 3 deletions src/components/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ export default function Carousel() {
const {data: carouselImages} = useQuery({
queryKey: ['carouselImages'],
queryFn: getAllCarouselImages,
initialData: [],
});

const images = carouselImages.map(img => (
const images = carouselImages?.map(img => (
<div
key={img._key}
className="w-80 md:w-98 h-80 md:h-98 bg-gray-400 rounded shrink-0 snap-center relative"
Expand All @@ -27,7 +26,7 @@ export default function Carousel() {
</div>
));

if (!images.length) return null;
if (!images || !images.length) return null;

return (
<div className="mt-40">
Expand Down
1 change: 1 addition & 0 deletions src/components/ImageBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function ImageBlock({type, images}: Props) {
<div key={img._key} className="col-span-1">
<NextImage
{...img}
loading="lazy"
placeholder="blur"
className={`rounded ${imageClass}`}
/>
Expand Down
35 changes: 9 additions & 26 deletions src/components/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,28 @@ interface Props {

export default function Tile({title, link, size, icon}: Props) {
const sizeClasses = {
small: {
content: 'text-base',
tile: 'h-10 gap-4',
},
medium: {
content: 'text-3-1/2xl',
tile: 'py-5 gap-6',
},
large: {
content: 'text-3-1/2xl',
tile: 'py-9 gap-8',
},
small: 'text-base h-10 gap-4',
medium: 'text-3-1/2xl py-5 gap-6',
large: 'text-3-1/2xl py-9 gap-8',
};

return link ? (
<Link
href={link}
className={`${sizeClasses[size].tile} flex items-center justify-between border-b-1 border-black dark:border-white group`}
className={`${sizeClasses[size]} flex items-center justify-between border-b-1 border-black dark:border-white text-black dark:text-white group`}
aria-label={title}
>
<p className={`${sizeClasses[size].content} text-black dark:text-white`}>
{title}
</p>
<p
className={`${sizeClasses[size].content} text-black dark:text-white group-hover:-rotate-45 duration-200 transition-transform ease-linear`}
>
<p>{title}</p>
<p className="group-hover:-rotate-45 duration-200 transition-transform ease-linear">
{icon ?? '→'}
</p>
</Link>
) : (
<div
className={`${sizeClasses[size].tile} flex items-center justify-between border-b-1 border-black dark:border-white`}
className={`${sizeClasses[size]} flex items-center justify-between border-b-1 border-black dark:border-white text-black dark:text-white`}
>
<p className={`${sizeClasses[size].content} text-black dark:text-white`}>
{title}
</p>
<p className={`${sizeClasses[size].content} text-black dark:text-white`}>
{icon ?? 'wip'}
</p>
<p>{title}</p>
<p>{icon ?? 'wip'}</p>
</div>
);
}
2 changes: 1 addition & 1 deletion src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function Document() {
__html: `
if (
localStorage.theme === 'dark' ||
(!('theme' in localStorage) &&
(!localStorage.get('theme') &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.documentElement.classList.add('dark');
Expand Down

1 comment on commit b194971

@vercel
Copy link

@vercel vercel bot commented on b194971 Jan 3, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.