Skip to content

Commit 15235b9

Browse files
committed
Initial alpha release
0 parents  commit 15235b9

File tree

132 files changed

+25532
-0
lines changed

Some content is hidden

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

132 files changed

+25532
-0
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_STORYBOOK_URL=http://localhost:6006

.eslintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": [
3+
"next/core-web-vitals",
4+
"plugin:storybook/recommended"
5+
]
6+
}

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
.contentlayer
38+
39+
*storybook.log
40+
content/docs/contributing.mdx
41+
public/preview
42+

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"plugins": [
3+
"prettier-plugin-tailwindcss"
4+
],
5+
"tailwindConfig": "./tailwind.config.ts",
6+
"tailwindFunctions": [
7+
"clsx",
8+
"cn"
9+
]
10+
}

.storybook/main.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import type { StorybookConfig } from "@storybook/nextjs";
2+
3+
const config: StorybookConfig = {
4+
stories: [
5+
"../animata/**/*.mdx",
6+
"../animata/**/*.stories.@(js|jsx|mjs|ts|tsx)",
7+
],
8+
addons: [
9+
"@storybook/addon-onboarding",
10+
"@storybook/addon-links",
11+
"@storybook/addon-essentials",
12+
"@chromatic-com/storybook",
13+
"@storybook/addon-interactions",
14+
"@storybook/addon-styling-webpack",
15+
"@storybook/addon-themes",
16+
],
17+
framework: {
18+
name: "@storybook/nextjs",
19+
options: {},
20+
},
21+
staticDirs: [],
22+
};
23+
export default config;

.storybook/preview.tsx

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import { themes } from "@storybook/theming";
2+
3+
import { Canvas, Controls, Stories, Title } from "@storybook/blocks";
4+
import { Preview } from "@storybook/react";
5+
import React, { useEffect } from "react";
6+
7+
import { MDXProvider } from "@mdx-js/react";
8+
import { DocsContainer } from "@storybook/blocks";
9+
import { baseComponents } from "../components/mdx-base-components";
10+
11+
import { ReloadButton } from "../components/reload-button";
12+
import { useMutationObserver } from "../hooks/use-mutation-observer";
13+
import "../styles/globals.css";
14+
15+
import { withThemeByClassName } from "@storybook/addon-themes";
16+
import { addons } from "@storybook/manager-api";
17+
18+
addons.setConfig({
19+
theme: themes.dark,
20+
});
21+
22+
const MdxContainer = (props) => {
23+
return (
24+
<MDXProvider components={baseComponents}>
25+
<DocsContainer {...props} />
26+
</MDXProvider>
27+
);
28+
};
29+
30+
const isEmbedded = window.location.href.includes("site:docs");
31+
32+
const Wrapper = ({ children }) => {
33+
const nodeRef = React.useRef(isEmbedded ? document.body : null);
34+
const callbackRef = React.useRef(() => {
35+
const height = document.querySelector(".embedded")?.clientHeight ?? 0;
36+
const padding = 32;
37+
window.parent.postMessage(
38+
{
39+
type: "animata-set-height",
40+
height: height + padding,
41+
},
42+
"*",
43+
);
44+
});
45+
46+
useMutationObserver(nodeRef, callbackRef.current);
47+
48+
useEffect(() => {
49+
if (!isEmbedded) {
50+
return;
51+
}
52+
callbackRef.current();
53+
}, []);
54+
55+
return (
56+
<div
57+
className={isEmbedded ? "embedded" : ""}
58+
style={{ padding: isEmbedded ? 0 : "4rem 20px" }}
59+
>
60+
{children}
61+
</div>
62+
);
63+
};
64+
65+
const CustomCanvas = () => {
66+
const [key, setKey] = React.useState(0);
67+
return (
68+
<div className="relative">
69+
<Canvas key={`render-${key}`} />
70+
<ReloadButton
71+
key={`button-${key}`}
72+
className="absolute right-4 top-4"
73+
onClick={() => setKey((k) => k + 1)}
74+
/>
75+
</div>
76+
);
77+
};
78+
79+
const preview: Preview = {
80+
parameters: {
81+
controls: {
82+
matchers: {
83+
color: /(background|color)$/i,
84+
date: /Date$/i,
85+
},
86+
},
87+
darkMode: {
88+
dark: { ...themes.dark, appBg: "black" },
89+
light: { ...themes.normal, appBg: "red" },
90+
},
91+
docs: {
92+
container: MdxContainer,
93+
page: () => {
94+
return (
95+
<Wrapper>
96+
{!isEmbedded && <Title />}
97+
<CustomCanvas />
98+
<Controls />
99+
<Stories includePrimary={false} title="Other examples" />
100+
</Wrapper>
101+
);
102+
},
103+
},
104+
},
105+
106+
decorators: [
107+
withThemeByClassName({
108+
themes: {
109+
light: "",
110+
dark: "dark",
111+
},
112+
defaultTheme: "light",
113+
}),
114+
],
115+
};
116+
117+
export default preview;

.yarn/releases/yarn-4.2.2.cjs

Lines changed: 894 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.2.2.cjs

CONTRIBUTING.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
2+
3+
## Getting Started
4+
5+
To get a local copy up and running, please follow these simple steps.
6+
7+
### Prerequisites
8+
9+
Here is what you need to be able to run animata.
10+
11+
- Node.js (Version: >=18.x)
12+
- Yarn _(recommended)_
13+
14+
## Development
15+
16+
### Setup
17+
18+
1. Clone the repo into a public GitHub repository (or fork https://github.com/codse/animata/fork).
19+
20+
```sh
21+
git clone https://github.com/codse/animata.git
22+
```
23+
24+
2. Go to the project folder
25+
26+
```sh
27+
cd animata
28+
```
29+
30+
3. Install packages with yarn
31+
32+
```sh
33+
yarn
34+
```
35+
36+
4. Set up your `.env` file
37+
38+
- Duplicate `.env.example` to `.env`
39+
40+
5. Setup Node
41+
42+
If your Node version does not meet the project's requirements as instructed by the docs, "nvm" (Node Version Manager) allows using Node at the version required by the project:
43+
44+
```sh
45+
nvm use
46+
```
47+
48+
You first might need to install the specific version and then use it:
49+
50+
```sh
51+
nvm install && nvm use
52+
```
53+
54+
You can install nvm from [here](https://github.com/nvm-sh/nvm).
55+
56+
6. Start storybook
57+
58+
```sh
59+
yarn storybook
60+
```
61+
62+
7. Start development server
63+
64+
```sh
65+
yarn dev
66+
```
67+
68+
8. Open [http://localhost:3000](http://localhost:3000) in the browser to see the result.
69+
70+
## Contributing animations
71+
72+
1. Run `yarn animata:new` to create a new component. It will ask couple of questions and generate required files for you.
73+
2. Create a new branch.
74+
3. Commit your changes.
75+
4. Push to the branch.
76+
5. Open a pull request.
77+
78+
If you have any questions, feel free to reach out to us.
79+
80+
## Folder structure
81+
82+
- `components/`: Contains all the components.
83+
- `animata/`: Contains all the animations.
84+
- `content/`: Contains the documentation pages.
85+
- `public/`: Contains the static files.
86+
- `app/`: Contains the main Next.js app.
87+
- `templates/`: Contains the templates for the new components.
88+
89+
You will mostly be working in the `animata` and `content/docs` folders while creating new animations and documentation pages.

LICENSE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) Animata
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)