This repository was archived by the owner on Feb 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +111
-0
lines changed
pages/LandingPage/components/StatsView Expand file tree Collapse file tree 4 files changed +111
-0
lines changed Original file line number Diff line number Diff line change 1+ import React , { useState } from 'react' ;
2+ import { FiStar , FiZap } from 'react-icons/all' ;
3+
4+ class IconKeyMap {
5+ star = ( props ) => < FiStar { ...props } /> ;
6+ zap = ( props ) => < FiZap { ...props } /> ;
7+ }
8+
9+ type FunctionPropertyNames < T > = {
10+ [ K in keyof T ] : T [ K ] extends ( ...args : any [ ] ) => any ? K : never ;
11+ } [ keyof T ] &
12+ string ;
13+
14+ export type IconTypes <
15+ T = IconKeyMap ,
16+ M = FunctionPropertyNames < Required < T > >
17+ > = M ;
18+
19+ type Props = {
20+ type : IconTypes ;
21+ className : string ;
22+ } ;
23+
24+ const Icons : React . FC < Props > = ( props ) => {
25+ const { type } = props ;
26+ const [ iconKeyMap ] = useState ( new IconKeyMap ( ) ) ;
27+
28+ return iconKeyMap [ type ] ( props ) || < div > Icon '{ type } ' doesn't exists!</ div > ;
29+ } ;
30+
31+ export default Icons ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import styles from './styles.module.css' ;
3+ import { IconContext } from 'react-icons' ;
4+ import Icons , { IconTypes } from '../Icons' ;
5+
6+ export type Props = {
7+ icon ?: IconTypes ;
8+ number : number ;
9+ text : string ;
10+ to : string ;
11+ } ;
12+
13+ const StatBadge : React . FC < Props > = ( props ) => {
14+ const { icon, number, text, to } = props ;
15+
16+ return (
17+ < div className = { styles . Container } >
18+ { icon && (
19+ < div className = { styles . IconContainer } >
20+ < Icons type = { icon } className = { styles . Icon } />
21+ </ div >
22+ ) }
23+ < div className = { styles . ContentContainer } >
24+ < div className = { styles . Number } > { number } </ div >
25+ < div className = { styles . Text } > { text } </ div >
26+ </ div >
27+ </ div >
28+ ) ;
29+ } ;
30+
31+ export default StatBadge ;
Original file line number Diff line number Diff line change 1+ .Container {
2+ position : relative;
3+ display : flex;
4+ flex-direction : column;
5+ padding : 3rem 6rem ;
6+ border-radius : 8px ;
7+ border : 2px solid var (--ifm-color-on-background-3 );
8+ }
9+
10+ .IconContainer {
11+ position : absolute;
12+ top : 0 ;
13+ right : 0 ;
14+ padding : 1rem ;
15+ border-radius : 100px ;
16+ background-color : var (--ifm-background-color );
17+ filter : drop-shadow (0px 8px 10px rgba (0 , 0 , 0 , 0.25 ));
18+ }
19+
20+ .Icon {
21+ color : var (--ifm-color-on-background-2 );
22+ size : 1rem ;
23+ }
24+
25+ .ContentContainer {
26+ display : flex;
27+ flex-direction : column;
28+ }
29+
30+ .Number {
31+ color : var (--ifm-color-on-background-3 );
32+ font-size : var (--ifm-font-size-48 );
33+ font-weight : bold;
34+ }
35+
36+ .Text {
37+ color : var (--ifm-color-on-background-2 );
38+ font-size : var (--ifm-font-size-18 );
39+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
44import Spacer from '../../../../components/other/Spacer' ;
55import { useAgile } from '@agile-ts/react' ;
66import core from '../../../../core' ;
7+ import StatBadge from '../../../../components/other/StatBadge' ;
8+ import { FiStar } from 'react-icons/all' ;
79
810const StatsView : React . FC = ( ) => {
911 const { siteConfig } = useDocusaurusContext ( ) ;
@@ -22,6 +24,14 @@ const StatsView: React.FC = () => {
2224 < Spacer height = { 20 } />
2325 </ div >
2426 < Spacer height = { 60 } />
27+ < div className = { styles . Badges } >
28+ < StatBadge
29+ icon = { < FiStar /> }
30+ number = { githubStars }
31+ text = { 'Stars' }
32+ to = { `${ siteConfig . customFields . githubUrl } /stargazers` }
33+ />
34+ </ div >
2535 </ div >
2636 </ div >
2737 ) ;
You can’t perform that action at this time.
0 commit comments