Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 311fc87

Browse files
committed
fixed some styling
1 parent e2a5ca3 commit 311fc87

File tree

11 files changed

+97
-34
lines changed

11 files changed

+97
-34
lines changed

src/components/other/Icons/icons.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
import {
2+
FiDownload,
3+
FiEdit,
4+
FiGitMerge,
5+
FiRepeat,
6+
FiServer,
7+
FiStar,
8+
FiUsers,
9+
FiZap,
10+
} from 'react-icons/all';
111
import React from 'react';
2-
import { FiStar, FiZap } from 'react-icons/all';
312

4-
export const IconKeyMap = {
13+
export const iconKeyMap = {
514
star: (props) => <FiStar {...props} />,
615
zap: (props) => <FiZap {...props} />,
16+
repeat: (props) => <FiRepeat {...props} />,
17+
users: (props) => <FiUsers {...props} />,
18+
server: (props) => <FiServer {...props} />,
19+
edit: (props) => <FiEdit {...props} />,
20+
gitMerge: (props) => <FiGitMerge {...props} />,
21+
download: (props) => <FiDownload {...props} />,
722
};

src/components/other/Icons/index.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
import React from 'react';
2-
import { IconKeyMap } from './icons';
2+
import { iconKeyMap } from './icons';
33

44
type FunctionPropertyNames<T> = {
55
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
66
}[keyof T] &
77
string;
88

99
export type IconTypes<
10-
T = typeof IconKeyMap,
10+
T = typeof iconKeyMap,
1111
M = FunctionPropertyNames<Required<T>>
1212
> = M;
1313

1414
type Props = {
1515
type: IconTypes;
16-
className: string;
16+
className?: string;
1717
};
1818

1919
const Icons: React.FC<Props> = (props) => {
2020
const { type } = props;
2121

22-
return IconKeyMap[type](props) || <div>Icon '{type}' doesn't exists!</div>;
22+
return iconKeyMap[type] ? (
23+
iconKeyMap[type](props)
24+
) : (
25+
<div>Icon '{type}' doesn't exists!</div>
26+
);
2327
};
2428

2529
export default Icons;

src/components/other/SectionScroller/components/SectionRightItem/index.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from "react";
2-
import styles from "./styles.module.css";
3-
import clsx from "clsx";
1+
import React from 'react';
2+
import styles from './styles.module.css';
3+
import clsx from 'clsx';
4+
import Icons, { IconTypes } from '../../../Icons';
45

56
export type Props = {
6-
icon?: React.ComponentElement<any, any>;
7+
icon?: IconTypes;
78
title: string;
89
description: string;
910
onClick: () => void;
@@ -18,10 +19,9 @@ const SectionRightItem: React.FC<Props> = (props) => {
1819
className={clsx(styles.Container, {
1920
[styles.Container_Active]: active,
2021
})}
21-
onClick={onClick}
22-
>
22+
onClick={onClick}>
2323
<h3 className={styles.Header}>
24-
{icon && <div className={styles.Icon}>{icon}</div>}
24+
{icon && <Icons type={icon} className={styles.Icon} />}
2525
{title}
2626
</h3>
2727
<p className={styles.Description}>{description}</p>

src/components/other/SectionScroller/components/SectionRightItem/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
}
4040

4141
.Icon {
42-
margin: 5px 10px 0 0;
42+
margin-right: 10px;
4343
}
4444

4545
.Header {

src/components/other/SectionScroller/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { useWindowSize } from '../../../hooks/useWindowSize';
44
import SectionRightItem from './components/SectionRightItem';
55
import SectionLeftItem from './components/SectionLeftItem';
66
import { FiChevronDown, FiChevronUp } from 'react-icons/all';
7+
import { IconTypes } from '../Icons';
78

89
export interface SectionInterface {
910
codeWithComment?: string;
1011
code: string;
1112
title: string;
1213
description: string;
13-
icon?: React.ComponentElement<any, any>;
14+
icon?: IconTypes;
1415
}
1516

1617
export type Props = { sections: SectionInterface[]; startIndex?: number };

src/components/other/StatBadge/index.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,31 @@ import React from 'react';
22
import styles from './styles.module.css';
33
import { IconContext } from 'react-icons';
44
import Icons, { IconTypes } from '../Icons';
5+
import clsx from 'clsx';
6+
import { useHistory } from 'react-router-dom';
57

68
export type Props = {
79
icon?: IconTypes;
810
number: number;
911
text: string;
1012
to: string;
13+
className?: string;
1114
};
1215

1316
const StatBadge: React.FC<Props> = (props) => {
14-
const { icon, number, text, to } = props;
17+
const { icon, number, text, to, className } = props;
18+
const history = useHistory();
1519

1620
return (
17-
<div className={styles.Container}>
21+
<div
22+
className={clsx(styles.Container, className)}
23+
onClick={() => {
24+
if (to.startsWith('http')) {
25+
window.open(to, '_blank');
26+
return;
27+
}
28+
history.push(to);
29+
}}>
1830
{icon && (
1931
<div className={styles.IconContainer}>
2032
<Icons type={icon} className={styles.Icon} />
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
.Container {
22
position: relative;
33
display: flex;
4+
align-items: center;
5+
justify-content: center;
6+
text-align: center;
47
flex-direction: column;
5-
padding: 3rem 6rem;
8+
height: 170px;
9+
width: 260px;
10+
cursor: pointer;
611
border-radius: 8px;
712
border: 2px solid var(--ifm-color-on-background-3);
813
}
914

1015
.IconContainer {
1116
position: absolute;
12-
top: 0;
13-
right: 0;
17+
display: flex;
18+
top: -1rem;
19+
right: -1rem;
1420
padding: 1rem;
15-
border-radius: 100px;
21+
border-radius: 50%;
22+
align-items: center;
23+
justify-content: center;
1624
background-color: var(--ifm-background-color);
1725
filter: drop-shadow(0px 8px 10px rgba(0, 0, 0, 0.25));
1826
}
1927

2028
.Icon {
2129
color: var(--ifm-color-on-background-2);
22-
size: 1rem;
30+
font-size: 1.5rem;
2331
}
2432

2533
.ContentContainer {
@@ -28,12 +36,12 @@
2836
}
2937

3038
.Number {
31-
color: var(--ifm-color-on-background-3);
39+
color: var(--ifm-color-on-background-2);
3240
font-size: var(--ifm-font-size-48);
3341
font-weight: bold;
3442
}
3543

3644
.Text {
37-
color: var(--ifm-color-on-background-2);
45+
color: var(--ifm-color-on-background-3);
3846
font-size: var(--ifm-font-size-18);
3947
}

src/pages/LandingPage/components/StatsView/index.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Spacer from '../../../../components/other/Spacer';
55
import { useAgile } from '@agile-ts/react';
66
import core from '../../../../core';
77
import StatBadge from '../../../../components/other/StatBadge';
8-
import { FiStar } from 'react-icons/all';
98

109
const StatsView: React.FC = () => {
1110
const { siteConfig } = useDocusaurusContext();
@@ -24,12 +23,27 @@ const StatsView: React.FC = () => {
2423
<Spacer height={20} />
2524
</div>
2625
<Spacer height={60} />
27-
<div className={styles.Badges}>
26+
<div className={styles.BadgesContainer}>
2827
<StatBadge
29-
icon={<FiStar />}
28+
icon={'star'}
3029
number={githubStars}
3130
text={'Stars'}
3231
to={`${siteConfig.customFields.githubUrl}/stargazers`}
32+
className={styles.Badge}
33+
/>
34+
<StatBadge
35+
icon={'gitMerge'}
36+
number={githubForks}
37+
text={'Forks'}
38+
to={`${siteConfig.customFields.githubUrl}/network/members`}
39+
className={styles.Badge}
40+
/>
41+
<StatBadge
42+
icon={'download'}
43+
number={npmDownloads}
44+
text={'Downloads'}
45+
to={siteConfig.customFields.npmCoreUrl}
46+
className={styles.Badge}
3347
/>
3448
</div>
3549
</div>

src/pages/LandingPage/components/StatsView/styles.module.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@
3535
color: var(--ifm-color-on-background);
3636
font-weight: bold;
3737
}
38+
39+
.BadgesContainer {
40+
display: flex;
41+
justify-content: center;
42+
flex-wrap: wrap;
43+
}
44+
45+
.Badge {
46+
margin: 2em;
47+
}

src/pages/LandingPage/components/StraightforwardView/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Spacer from '../../../../components/other/Spacer';
44
import SectionScroller, {
55
SectionInterface,
66
} from '../../../../components/other/SectionScroller';
7-
import { FiEdit, FiRepeat, FiServer, FiUsers, FiZap } from 'react-icons/all';
87
import PlainButton from '../../../../components/buttons/PlainButton';
98

109
const sections: SectionInterface[] = [
@@ -23,7 +22,7 @@ MY_STATE.set("Frank");
2322
title: 'Create State',
2423
description:
2524
'Create an Information we need to remember at a later point in time.',
26-
icon: <FiZap />,
25+
icon: 'zap',
2726
},
2827
{
2928
code: `
@@ -36,7 +35,7 @@ const myState = useAgile(MY_STATE);
3635
`,
3736
title: 'Subscribe State',
3837
description: 'Bind any State to any Component.',
39-
icon: <FiRepeat />,
38+
icon: 'repeat',
4039
},
4140
{
4241
code: `
@@ -52,7 +51,7 @@ MY_COLLECTION.collect({id: 1, name: "Jeff"});
5251
`,
5352
title: 'Create set of States',
5453
description: 'Create a dynamic and reactive set of States.',
55-
icon: <FiUsers />,
54+
icon: 'users',
5655
},
5756
{
5857
code: `
@@ -64,7 +63,7 @@ MY_STATE.persist();
6463
`,
6564
title: 'Persist State',
6665
description: 'Store State permanently in any Storage.',
67-
icon: <FiServer />,
66+
icon: 'server',
6867
},
6968
{
7069
code: `
@@ -82,7 +81,7 @@ const IS_AUTH = App.createComputed(() => {
8281
`,
8382
title: 'Compute State',
8483
description: 'Compute State depending on other States.',
85-
icon: <FiEdit />,
84+
icon: 'edit',
8685
},
8786
];
8887

0 commit comments

Comments
 (0)