Skip to content

Commit

Permalink
✨ feat(profile): add tags transitions animation
Browse files Browse the repository at this point in the history
  • Loading branch information
lwinmoepaing committed Oct 21, 2023
1 parent 9f375a6 commit 644ec26
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Profile/ProfileCardItem/ProfileCardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ProfileCardItem = ({
const bgColor = generateColor();

return (
<div key={_id} className="self-stretch">
<div key={_id} className="self-stretch animate-fadein">
<Link href={`/profile/${slugAsParams}`}>
<SquareBox
className={cn(
Expand Down
24 changes: 16 additions & 8 deletions src/components/Profile/ProfileCardList/ProfileCardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Profile } from "contentlayer/generated";
import { useSearchParams } from "next/navigation";
import { useMemo, useState } from "react";
import { IoPeople } from "react-icons/io5";
import { motion } from "framer-motion";
import { opacityAnimation } from "@/data/animationVariants";

type TPropsProfileCardList = {
profiles: Profile[];
Expand Down Expand Up @@ -40,16 +42,22 @@ const ProfileCardList = ({ profiles }: TPropsProfileCardList) => {

return (
<>
<div>
<motion.div
initial="hidden"
animate="visible"
transition={{ staggerChildren: 0.005 }}
className="relative"
>
{uniqueTags.map((tag, i) => (
<Tag
<motion.span
key={tag}
tag={tag}
searchTag={searchTag}
bgColor={uniqueTagColors[i]}
/>
variants={opacityAnimation}
className="inline-block"
>
<Tag tag={tag} searchTag={searchTag} bgColor={uniqueTagColors[i]} />
</motion.span>
))}
</div>
</motion.div>

<div className="flex flex-col gap-3 md:flex-row mt-2 md:items-center">
<input
Expand Down Expand Up @@ -78,7 +86,7 @@ const ProfileCardList = ({ profiles }: TPropsProfileCardList) => {

<SpacingDivider size="lg" />

<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-5">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-5 relative">
{filteredProfiles.map((profile) => (
<ProfileCardItem
key={profile._id}
Expand Down
12 changes: 12 additions & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const config: Config = {
],
theme: {
extend: {
// that is animation class
animation: {
fadein: "fadeIn 0.5s ease-out forwards",
},
colors: {
primary: "#923293",
secondary: "",
Expand All @@ -30,6 +34,14 @@ const config: Config = {
"0%, 100%": { transform: "rotate(-3deg)" },
"50%": { transform: "rotate(3deg)" },
},
fadeIn: {
"0%": {
opacity: "0",
},
"100%": {
opacity: "1",
},
},
},
},
},
Expand Down

0 comments on commit 644ec26

Please sign in to comment.