Skip to content

Commit

Permalink
feat: change responsive screen sizes and add member display
Browse files Browse the repository at this point in the history
  • Loading branch information
0-vortex committed Nov 28, 2023
1 parent 9aa7fbd commit fdcd418
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 13 deletions.
5 changes: 3 additions & 2 deletions components/global/Navbar/NavbarLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ export default function Navbar(props: NavbarProps) {

return (
<div className={clsx([
'sticky top-0 z-10 border-y grid grid-cols-12',
// 'sticky top-0 z-10 border-y grid grid-cols-12',
'sticky top-0 z-10 border-y grid grid-cols-xs sm:grid-cols-sm lg:grid-cols-lg xl:grid-cols-xl',
'bg-neutral-300/90 border-slate-500',
'dark:bg-neutral-800/90 dark:border-black',
])}>
<div className={clsx([
'col-start-2 col-end-12 text-2xl',
'col-start-2 col-end-3 text-2xl',
'flex justify-between items-center backdrop-blur border-x',
'border-slate-500',
'dark:border-black',
Expand Down
6 changes: 3 additions & 3 deletions components/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function HomePage({ data, encodeDataAttribute }: HomePageProps) {

{showcasePosts && showcasePosts.length > 0 && (
<div className={clsx([
'w-full'
])}>
'w-full grid grid-cols-1'
])} data-section="posts">
<div>
<Header centered title='Blog'/>
</div>
Expand All @@ -48,7 +48,7 @@ export function HomePage({ data, encodeDataAttribute }: HomePageProps) {
)}

{showcaseProjects && showcaseProjects.length > 0 && (
<div className="w-full grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 flex-wrap gap-6 p-6">
<div className="w-full grid grid-cols-1 lg:grid-cols-2 xl:grid-cols-3 flex-wrap gap-6 p-6" data-section="projects">
{showcaseProjects.map((project, key) => {
const href = resolveHref(project._type, project.slug)
if (!href) {
Expand Down
36 changes: 29 additions & 7 deletions components/pages/home/PostListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ export function PostListItem(props: PostProps) {
return (
<div
className={clsx([
'border-b p-12 flex flex-row gap-4',
'border -m-[0.5px] p-12 flex flex-row gap-4',
'border-slate-500 hover:bg-white',
'dark:border-black dark:hover:bg-black',
odd && ''
])}
>
<div className='basis-1/4'>
<ImageBox
width={363}
height={204}
image={post.coverImage}
alt={`Cover image from ${post.title}`}
classesWrapper='relative aspect-[16/9]'
Expand All @@ -42,13 +44,33 @@ export function PostListItem(props: PostProps) {
])}>{post.title}</h2>

<div className={clsx([
'flex flex-row gap-x-2 font-mono',
'flex gap-3 flex-row items-center',
])}>
{post.categories?.map((tag, key) => (
<div className='text-md font-medium lowercase md:text-lg' key={key}>
#{tag}
</div>
))}
<div className={clsx([
'w-16',
])}>
<ImageBox
width={64}
height={64}
image={post.author?.coverImage}
alt={`Cover image from ${post.author?.title?.replace(/[\u200B-\u200D\uFEFF]/g, '')}`}
classesWrapper='px-0.5px flex shrink-0 grow-0 w-10 relative rounded-full aspect-[1/1]'
/>
</div>

<div className='font-mono text-sm leading-mono font-normal uppercase text-gray-dark'>
by {post.author?.title}
</div>

<div className={clsx([
'flex flex-row gap-x-2 font-mono',
])}>
{post.categories?.map((tag, key) => (
<div className='text-md font-medium lowercase md:text-lg' key={key}>
#{tag}
</div>
))}
</div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion components/shared/ImageBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function ImageBox({

return (
<div
className={`w-full overflow-hidden rounded-[3px] bg-gray-50 ${classesWrapper}`}
className={`w-full overflow-hidden rounded-[3px] ${classesWrapper}`}
data-sanity={props['data-sanity']}
>
{imageUrl && (
Expand Down
5 changes: 5 additions & 0 deletions sanity/lib/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export const homePageQuery = groq`
"slug": slug.current,
publishedAt,
categories,
author->{
slug,
title,
coverImage,
},
title,
},
title,
Expand Down
2 changes: 2 additions & 0 deletions sanity/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export function resolveHref(
return slug ? `/projects/${slug}` : undefined
case 'post':
return slug ? `/blog/${slug}` : undefined
case 'member':
return slug ? `/author/${slug}` : undefined
default:
console.warn('Invalid document type:', documentType)
return undefined
Expand Down
12 changes: 12 additions & 0 deletions sanity/schemas/documents/member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ export default {
},
validation: (rule) => rule.required(),
}),
defineField({
name: 'socialLinks',
title: 'Social Links',
description: 'Links displayed on team member display.',
type: 'array',
of: [
{
type: 'socialLink',
},
],
validation: (rule) => rule.unique(),
}),
],
preview: {
select: {
Expand Down
13 changes: 13 additions & 0 deletions sanity/schemas/documents/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ export default defineType({
},
validation: (rule) => rule.required(),
}),
defineField({
type: 'reference',
name: 'author',
title: 'Author',
to: [{ type: 'member' }],
validation: (rule) => rule.required(),
}),
defineField({
type: 'array',
name: 'coAuthors',
title: 'Co-authors',
of: [{ type: 'reference', to: [{ type: 'member' }] }],
}),
defineField({
type: 'datetime',
name: 'publishedAt',
Expand Down
14 changes: 14 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ module.exports = {
sans: 'var(--font-sans)',
serif: 'var(--font-serif)',
},
gridTemplateColumns: {
'xl': '1fr min(84rem, 100% - 7rem) 1fr', // .xl\:grid-cols-xl
'lg': '3.5rem minmax(0,1fr) 3.5rem', // .lg\:grid-cols-lg
// 'md': '2.65rem minmax(0,1fr) 2.65rem',
'sm': '1.75rem minmax(0, 1fr) 1.75rem', // .sm\:grid-cols-sm
'xs': '0.875rem minmax(0, 1fr) 0.875rem', // .grid-cols-xs
},
screens: {
'xl': '1456px',
'lg': '1176px',
'md': '784px',
'sm': '504px',
'xs': '0px',
}
},
},
plugins: [require('@tailwindcss/typography')],
Expand Down
5 changes: 5 additions & 0 deletions types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export interface ShowcasePost {
slug?: string
publishedAt?: string
categories?: string[]
author?: {
slug?: string
title?: string
coverImage?: Image
}
title?: string
}

Expand Down

0 comments on commit fdcd418

Please sign in to comment.