Skip to content

Commit

Permalink
Scroll snap feature (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
oktay authored Jul 3, 2022
1 parent add13ef commit ca3f9b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/repo-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function RepoCard({
return (
<div
key={id}
className="relative group h-full w-3/4 sm:w-full flex-shrink-0"
className="relative group h-full w-3/4 sm:w-full flex-shrink-0 snap-start"
>
<div className="aspect-3/2">
<div className="card flex flex-col h-full w-full p-4 md:p-6">
Expand Down
2 changes: 1 addition & 1 deletion components/shot-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function ShotCard({ id, title, images, html_url, tags }) {
return (
<div
key={id}
className="relative group h-full w-3/4 md:w-full flex-shrink-0"
className="relative group h-full w-3/4 md:w-full flex-shrink-0 snap-start"
>
<div className="relative aspect-[4/3]">
<Image
Expand Down
4 changes: 2 additions & 2 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default function Home({ repos, shots, homepage, seo }) {
</p>
</div>
<div className="col-span-12 col-start-4 mt-8 md:mt-0">
<div className="flex overflow-scroll gap-6 sm:overflow-auto sm:grid sm:grid-cols-2 xl:grid-cols-3">
<div className="flex overflow-scroll gap-6 snap-mandatory snap-x sm:overflow-auto sm:grid sm:grid-cols-2 xl:grid-cols-3">
{repos.slice(0, 6).map(RepoCard)}
</div>
</div>
Expand All @@ -151,7 +151,7 @@ export default function Home({ repos, shots, homepage, seo }) {
</p>
</div>
<div className="col-span-12 col-start-4 mt-8 md:mt-0">
<div className="flex overflow-scroll gap-6 md:overflow-auto md:grid md:grid-cols-2 xl:grid-cols-3">
<div className="flex overflow-scroll gap-6 snap-mandatory snap-x md:overflow-auto md:grid md:grid-cols-2 xl:grid-cols-3">
{shots.slice(0, 6).map(ShotCard)}
</div>
</div>
Expand Down

1 comment on commit ca3f9b7

@vercel
Copy link

@vercel vercel bot commented on ca3f9b7 Jul 3, 2022

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.