Skip to content

Commit e2e8560

Browse files
committed
feat: remove more components
2 parents d739439 + 6050738 commit e2e8560

61 files changed

Lines changed: 4214 additions & 20 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/new-component-ticket.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ name: New Component Ticket [HACKTOBERFEST]
33
about: Create a new animated component task for Hacktoberfest
44
title: Component Name
55
labels: hacktoberfest
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
### Description
10+
1111
Create the component as shown in the video attached below.
1212

1313
### Animation Preview
14+
1415
- Screenshot/Video:
1516

1617
[Upload file here]
1718

18-
1919
> [!NOTE]
2020
> Please refer to the **Animata contributing guidelines** available [here](https://www.animata.design/docs/contributing) for rules on how to contribute to the project. Let us know in the comments if you’re working on this issue, and feel free to ask any questions!
2121
2222
### Requirements
23+
2324
1. Create a new animated component that matches the provided design.
2425
2. Add example usage of the component in the documentation or storybook.
2526
3. **Add credits** for any resources, references, or assets used, as specified in the **Additional Resources** section.
2627

27-
2828
<details>
2929
<summary>
3030
<h3> Guidelines & Best Practices</h3>
@@ -38,12 +38,14 @@ Create the component as shown in the video attached below.
3838

3939
> [!IMPORTANT]
4040
> To ensure more contributors have the opportunity to participate, we kindly request that:
41+
>
4142
> - Each contributor submits only **one pull request** related to this issue.
4243
> - If you're interested in working on this issue, please comment below. We will assign the issue on a **first-come, first-served basis**.
4344
4445
---
4546

4647
### Additional Resources
48+
4749
<!-- Add references and credits here -->
4850

4951
---

.github/workflows/deploy.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,21 @@ jobs:
4343
NEXT_PUBLIC_POSTHOG_HOST: ${{ vars.NEXT_PUBLIC_POSTHOG_HOST }}
4444
run: yarn build
4545
- name: Deploy to Cloudflare Pages
46-
uses: cloudflare/pages-action@v1
46+
id: deploy
47+
uses: cloudflare/wrangler-action@v3
4748
with:
4849
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
4950
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
50-
projectName: animata
51-
directory: out
51+
command: pages deploy out --project-name=animata --branch=dev-${{ github.event.pull_request.head.ref }}
5252
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
53-
branch: ${{ github.event.pull_request.head.ref }}
54-
wranglerVersion: "3"
53+
- name: Comment Deployment URL
54+
uses: actions/github-script@v6
55+
with:
56+
github-token: ${{secrets.GITHUB_TOKEN}}
57+
script: |
58+
await github.rest.issues.createComment({
59+
issue_number: context.issue.number,
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
body: `🚀 Preview deployed to: ${{ steps.deploy.outputs.deployment-url }}`
63+
})

animata/accordion/faq.stories.tsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import Faq from "@/animata/accordion/faq";
2+
import { Meta, StoryObj } from "@storybook/react";
3+
4+
const faqData = [
5+
{
6+
id: 1,
7+
question: "How late does the internet close?",
8+
answer: "The internet doesn't close. It's available 24/7.",
9+
icon: "❤️",
10+
iconPosition: "right",
11+
},
12+
{
13+
id: 2,
14+
question: "Do I need a license to browse this website?",
15+
answer: "No, you don't need a license to browse this website.",
16+
},
17+
{
18+
id: 3,
19+
question: "What flavour are the cookies?",
20+
answer: "Our cookies are digital, not edible. They're used for website functionality.",
21+
},
22+
{
23+
id: 4,
24+
question: "Can I get lost here?",
25+
answer: "Yes, but we do have a return policy",
26+
icon: "⭐",
27+
iconPostion: "left",
28+
},
29+
{
30+
id: 5,
31+
question: "What if I click the wrong button?",
32+
answer: "Don't worry, you can always go back or refresh the page.",
33+
},
34+
];
35+
36+
const meta = {
37+
title: "Accordion/Faq",
38+
component: Faq,
39+
parameters: {
40+
layout: "centered",
41+
},
42+
tags: ["autodocs"],
43+
argTypes: {},
44+
} satisfies Meta<typeof Faq>;
45+
46+
export default meta;
47+
type Story = StoryObj<typeof meta>;
48+
49+
export const Primary: Story = {
50+
args: {
51+
data: faqData,
52+
},
53+
};

animata/accordion/faq.tsx

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
"use client";
2+
3+
import React, { useState } from "react";
4+
import { motion } from "framer-motion";
5+
6+
import * as Accordion from "@radix-ui/react-accordion";
7+
8+
interface FAQItem {
9+
id: number;
10+
question: string;
11+
answer: string;
12+
icon?: string;
13+
iconPosition?: string;
14+
}
15+
16+
interface FaqSectionProps {
17+
data: FAQItem[];
18+
}
19+
20+
export default function FaqSection({ data }: FaqSectionProps) {
21+
const [openItem, setOpenItem] = useState<string | null>(null);
22+
23+
return (
24+
<div
25+
className="mx-auto max-w-md rounded-lg bg-white p-4"
26+
style={{ maxWidth: "700px", minWidth: "700px" }}
27+
>
28+
<div className="mb-4 text-sm text-gray-500">Every day, 9:01 AM</div>
29+
30+
<Accordion.Root
31+
type="single"
32+
collapsible
33+
value={openItem || ""}
34+
onValueChange={(value) => setOpenItem(value)}
35+
>
36+
{data.map((item) => (
37+
<Accordion.Item value={item.id.toString()} key={item.id} className="mb-2">
38+
<Accordion.Header>
39+
<Accordion.Trigger
40+
className="flex w-full items-center justify-start gap-x-4"
41+
style={{ width: "100%" }}
42+
>
43+
<div
44+
className="relative flex items-center space-x-2 rounded-xl bg-gray-100 p-2 hover:bg-[#E0F7FA]"
45+
style={{
46+
backgroundColor: openItem === item.id.toString() ? "#E0F7FA" : "",
47+
}}
48+
>
49+
{item.icon && (
50+
<span
51+
className={`absolute bottom-6 ${
52+
item.iconPosition === "right" ? "right-0" : "left-0"
53+
}`}
54+
style={{
55+
transform: item.iconPosition === "right" ? "rotate(7deg)" : "rotate(-4deg)",
56+
}}
57+
>
58+
{item.icon}
59+
</span>
60+
)}
61+
<span className="font-medium text-gray-700">{item.question}</span>
62+
</div>
63+
64+
<span className="cursor-pointer text-lg font-bold text-gray-400">
65+
{openItem === item.id.toString() ? (
66+
<svg
67+
xmlns="http://www.w3.org/2000/svg"
68+
viewBox="0 0 24 24"
69+
fill="#7CB9E8"
70+
className="size-6"
71+
>
72+
<path
73+
fillRule="evenodd"
74+
d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm3 10.5a.75.75 0 0 0 0-1.5H9a.75.75 0 0 0 0 1.5h6Z"
75+
clipRule="evenodd"
76+
/>
77+
</svg>
78+
) : (
79+
<svg
80+
xmlns="http://www.w3.org/2000/svg"
81+
viewBox="0 0 24 24"
82+
fill="currentColor"
83+
className="size-6"
84+
>
85+
<path
86+
fillRule="evenodd"
87+
d="M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 9a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25V15a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V9Z"
88+
clipRule="evenodd"
89+
/>
90+
</svg>
91+
)}
92+
</span>
93+
</Accordion.Trigger>
94+
</Accordion.Header>
95+
<Accordion.Content asChild forceMount style={{ display: "block" }}>
96+
<motion.div
97+
initial="collapsed"
98+
animate={openItem === item.id.toString() ? "open" : "collapsed"}
99+
variants={{
100+
open: { opacity: 1, height: "auto" },
101+
collapsed: { opacity: 0, height: 0 },
102+
}}
103+
transition={{ duration: 0.4 }}
104+
style={{ width: "100%", overflow: "hidden" }}
105+
>
106+
<div
107+
className="ml-7 mt-1 rounded-lg p-3 text-white md:ml-16"
108+
style={{
109+
borderRadius: "12px",
110+
textAlign: "left",
111+
width: "100%",
112+
}}
113+
>
114+
<div className="relative max-w-xs rounded-2xl bg-blue-500 px-4 py-2 text-white">
115+
{item.answer}
116+
<div className="absolute bottom-0 right-0 h-0 w-0 border-l-[10px] border-t-[10px] border-l-transparent border-t-blue-500"></div>
117+
</div>
118+
</div>
119+
</motion.div>
120+
</Accordion.Content>
121+
</Accordion.Item>
122+
))}
123+
</Accordion.Root>
124+
</div>
125+
);
126+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import AnimatedFollowButton from "@/animata/button/animated-follow-button";
2+
import { Meta, StoryObj } from "@storybook/react";
3+
4+
const meta: Meta<typeof AnimatedFollowButton> = {
5+
title: "Button/Animated Follow Button",
6+
component: AnimatedFollowButton,
7+
parameters: { layout: "centered" },
8+
argTypes: {
9+
initialText: { control: "text" },
10+
changeText: { control: "text" },
11+
className: { control: "text" },
12+
changeTextClassName: { control: "text" },
13+
},
14+
};
15+
16+
export default meta;
17+
type Story = StoryObj<typeof meta>;
18+
19+
export const Primary: Story = {
20+
args: {
21+
initialText: "Follow",
22+
changeText: "Following!",
23+
className: "h-16 bg-green-100 text-green-700 flex rounded-full items-center justify-center",
24+
changeTextClassName:
25+
"h-16 bg-green-700 text-green-100 rounded-full text-white flex items-center justify-center",
26+
},
27+
render: (args) => (
28+
<div className="flex h-40 items-center justify-center">
29+
<AnimatedFollowButton {...args} />
30+
</div>
31+
),
32+
};
33+
34+
export const DifferentAnimations: Story = {
35+
args: {},
36+
render: () => {
37+
const buttons = [
38+
{
39+
initialText: "Default",
40+
changeText: "Up To Down",
41+
animationType: "up-to-down" as const,
42+
color: "blue",
43+
},
44+
{
45+
initialText: "Click Me",
46+
changeText: "Down To Up",
47+
animationType: "down-to-up" as const,
48+
color: "zinc",
49+
},
50+
{
51+
initialText: "Click Me",
52+
changeText: "Zoom In",
53+
animationType: "zoom-in" as const,
54+
color: "red",
55+
},
56+
];
57+
58+
return (
59+
<div className="grid h-60 w-full grid-cols-3 items-center justify-center gap-6">
60+
{buttons.map(({ initialText, changeText, animationType, color }, idx) => (
61+
<AnimatedFollowButton
62+
key={idx}
63+
className={`flex h-16 items-center justify-center rounded-xl bg-${color}-100 text-${color}-600`}
64+
changeTextClassName={`h-16 bg-${color}-600 text-${color}-100 rounded-xl text-white flex items-center justify-center`}
65+
initialText={<span className="inline-flex items-center">{initialText}</span>}
66+
changeText={<span className="inline-flex items-center">{changeText}</span>}
67+
animationType={animationType}
68+
/>
69+
))}
70+
</div>
71+
);
72+
},
73+
};

0 commit comments

Comments
 (0)