Skip to content

Commit 7eb1082

Browse files
committed
feat: enhance Tasks component with selection indicator and update Hero component to display count of ready components
1 parent 0589299 commit 7eb1082

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

src/components/animations/tasks.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ const Tasks = () => {
138138
key={date.date}
139139
layoutId={`day-${date.date}`}
140140
className={cn(
141-
"flex flex-col gap-1 items-center hover:bg-muted-foreground/10 rounded-xl p-2 cursor-pointer text-primary/70",
141+
"flex flex-col items-center hover:bg-muted-foreground/10 rounded-xl p-2 cursor-pointer text-primary/70 relative",
142142
selected?.date === date.date &&
143-
"bg-muted-foreground/10 text-primary"
143+
"bg-background text-primary border hover:bg-background/80"
144144
)}
145145
onClick={() => setSelected(date)}
146146
whileHover={{ scale: 1.03 }}
@@ -149,6 +149,12 @@ const Tasks = () => {
149149
<h2>{date.month}</h2>
150150
<p className="font-bold">{date.date}</p>
151151
<p>{date.day}</p>
152+
{selected?.date === date.date && (
153+
<m.div
154+
className="absolute size-2 bg-red-500 -top-1 rounded-xl bg-background"
155+
layoutId="day-selected-active"
156+
/>
157+
)}
152158
</m.div>
153159
))}
154160
</div>

src/components/shared/hero.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { buttonVariants } from "@/components/ui/button";
2-
import { COMPONENTS } from "@/constants/components";
32
import { siteConfig } from "@/lib/config";
43
import { motion } from "motion/react";
54
import { Icons } from "./icons";
65
import Logo from "./logo";
76

8-
const Hero = ({ hidden }: { hidden: boolean }) => {
7+
const Hero = ({ hidden, count }: { hidden: boolean; count: number }) => {
98
return (
109
<div className="w-full md:border-b bg-background">
1110
<div className="flex flex-col items-center justify-center pt-40 pb-20 gap-10 mx-auto w-full max-w-screen-lg bg-background md:border-x relative">
@@ -25,7 +24,7 @@ const Hero = ({ hidden }: { hidden: boolean }) => {
2524
className={buttonVariants({ size: "lg", className: "!rounded-md" })}
2625
>
2726
<motion.span layoutId="home-chat-button-text">
28-
Browse {COMPONENTS.filter((c) => !c.notReady).length} Components
27+
Browse {count} Components
2928
</motion.span>
3029
</motion.button>
3130
) : (

src/constants/components.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import * as Animated from "@/components/animations";
22

3-
export const COMPONENTS = [
3+
type Component = {
4+
name: string;
5+
component: React.ComponentType<any>;
6+
href: string;
7+
notReady?: boolean;
8+
height?: number;
9+
};
10+
11+
export const COMPONENTS: Component[] = [
412
{
513
name: "Task View",
14+
notReady: false,
615
component: Animated.Tasks,
716
href: "https://x.com/alisamadi__/status/1914333366394212708",
817
},

src/pages/home.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { COMPONENTS } from "@/constants/components";
1111
const Home = () => {
1212
const [isHidden, setIsHidden] = useState(false);
1313
const { scrollY } = useScroll();
14+
const readyComponents = COMPONENTS.filter((c) => !c.notReady);
1415

1516
useMotionValueEvent(scrollY, "change", (y) => {
1617
if (y > 100) {
@@ -23,7 +24,7 @@ const Home = () => {
2324
return (
2425
<div className="min-h-screen flex flex-col gap-20 items-center justify-center lg:px-0 px-10 overflow-x-clip">
2526
<div className="h-screen fixed top-0 max-w-screen-lg inset-x-0 w-full mx-auto border-x border -z-10 candy-bg hidden md:block" />
26-
<Hero hidden={isHidden} />
27+
<Hero hidden={isHidden} count={readyComponents.length} />
2728
<Feedback hidden={isHidden} />
2829
{COMPONENTS.map((component) => (
2930
<ComponentPreview

0 commit comments

Comments
 (0)