Skip to content

Commit

Permalink
✨ place the number of animations on first page
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpmohiburrahman committed Jun 25, 2024
1 parent 8f8f1a1 commit 84cfcc8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions components/totalComponents/TotalComponents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { useEffect, useState } from "react";

const TotalComponents: React.FC = () => {
const [total, setTotal] = useState<number>(0);

useEffect(() => {
const importAll = (r: __WebpackModuleApi.RequireContext) => {
return r.keys().map(r);
};

const jsonFiles = importAll(
require.context("../../data", false, /\.json$/)
);

const totalComponents = jsonFiles.reduce(
(acc, file) => acc + file.length,
0
);
setTotal(totalComponents);
}, []);

return (
<div>
<p>
We currently have <strong>{total}</strong> awesome UI components created
by the React Native community!
</p>
</div>
);
};

export default TotalComponents;
3 changes: 3 additions & 0 deletions docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Explore creative UI animations made with React Native by the community.

👉 **Check out the Animations on the sidebar** to see what's possible!

import TotalComponents from '@site/components/TotalComponents/TotalComponents';

<TotalComponents />
---

Enjoy your visit!

0 comments on commit 84cfcc8

Please sign in to comment.