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

Commit 932e7a3

Browse files
authored
Merge pull request #58 from agile-ts/develop
Develop
2 parents 8578254 + 5320eb5 commit 932e7a3

File tree

49 files changed

+156
-42
lines changed

Some content is hidden

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

49 files changed

+156
-42
lines changed

docusaurus.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ const config = {
4949
projectName: 'agilets',
5050
themes: ['@docusaurus/theme-live-codeblock'],
5151
plugins: [
52-
'docusaurus-plugin-sass' /* @docusaurus/plugin-google-analytics (Not necessary because it automatically gets added) */,
52+
'docusaurus-plugin-sass',
53+
// @docusaurus/plugin-google-analytics (Not necessary because it automatically gets added)
5354
],
5455
customFields: { ...customFields },
5556
themeConfig: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { animated, useSpring } from 'react-spring';
2+
import React, { useEffect, useState } from 'react';
3+
import { useAgile } from '@agile-ts/react';
4+
import core from '../../../../../../core';
5+
import styles from './styles.module.css';
6+
import clsx from 'clsx';
7+
8+
type Props = { className?: string };
9+
10+
const Astronaut: React.FC<Props> = (props) => {
11+
const { className } = props;
12+
const [timing] = useState(200);
13+
const [isRaised, setIsRaised] = React.useState(false);
14+
const animated_Astronaut = useSpring({
15+
transform: isRaised ? `translateY(-${30}px)` : `translateY(0px)`,
16+
config: {
17+
mass: 1,
18+
tension: 400,
19+
friction: 15,
20+
},
21+
});
22+
const dark = useAgile(core.ui.ASTRONAUT_DARK);
23+
24+
useEffect(() => {
25+
if (!isRaised) {
26+
return;
27+
}
28+
29+
const timeoutId = setTimeout(() => {
30+
core.ui.toggleAstronautColor(!dark);
31+
setIsRaised(false);
32+
}, timing);
33+
34+
return () => clearTimeout(timeoutId);
35+
}, [isRaised, timing]);
36+
37+
const trigger = () => setIsRaised(true);
38+
39+
return (
40+
<div className={clsx(styles.Container, className)}>
41+
<animated.img
42+
onMouseEnter={trigger}
43+
style={animated_Astronaut}
44+
className={styles.Image}
45+
src={`img/astronaut-${dark ? 'dark' : 'light'}.svg`}
46+
alt={'Astronaut'}
47+
/>
48+
<div className={styles.Text}>Poke me 👆 to mutate my color State.</div>
49+
</div>
50+
);
51+
};
52+
53+
export default Astronaut;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.Container {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: flex-end;
5+
}
6+
7+
.Text {
8+
color: var(--ifm-color-on-background-2);
9+
margin-top: 30px;
10+
align-self: center;
11+
}
12+
13+
.Image {
14+
width: 100%;
15+
max-width: 800px;
16+
}

src/pages/LandingPage/components/HeaderView/index.tsx renamed to src/_pages/LandingPage/components/HeaderView/index.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import React, { useState } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
3-
import HeaderTyper from '../../../../components/other/HeaderTyper';
3+
import HeaderTyper from './components/HeaderTyper';
44
import Spacer from '../../../../components/other/Spacer';
55
import PrimaryButton from '../../../../components/buttons/PrimaryButton';
66
import GithubButton from '../../../../components/buttons/GithubButton';
77
import styles from './styles.module.css';
88
import { useWindowSize } from '../../../../hooks/useWindowSize';
9-
import MouseScroller from '../../../../components/other/MouseScroller';
9+
import MouseScroller from './components/MouseScroller';
10+
import { animated, useSpring } from 'react-spring';
11+
import Astronaut from './components/Astronaut';
1012

1113
const HeaderView: React.FC = () => {
1214
const { siteConfig } = useDocusaurusContext();
@@ -52,11 +54,7 @@ const HeaderView: React.FC = () => {
5254
/>
5355
</div>
5456
</div>
55-
<img
56-
className={styles.AstronautImage}
57-
src={'img/astronaut-light.svg'}
58-
alt={'Astronaut'}
59-
/>
57+
<Astronaut className={styles.AstronautImage} />
6058
{windowHeight > 850 && windowHeight < 1200 && <MouseScroller />}
6159
</div>
6260
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
3+
export interface CardInterface {
4+
title: string;
5+
description: string;
6+
imagePath: string;
7+
}
8+
9+
export type Props = { cards: CardInterface[]; startIndex?: number };
10+
11+
const Cards: React.FC<CardInterface> = (props) => {
12+
return (
13+
<div>
14+
<div>much todo</div>
15+
</div>
16+
);
17+
};
18+
19+
export default Cards;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import styles from './styles.module.css';
3+
import Spacer from '../../../../components/other/Spacer';
4+
5+
const OtherFeaturesView: React.FC = () => {
6+
return (
7+
<div className={styles.Container}>
8+
<Spacer height={30} />
9+
<div>todo</div>
10+
</div>
11+
);
12+
};
13+
14+
export default OtherFeaturesView;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.Container {
2+
display: flex;
3+
flex-direction: column;
4+
align-items: center;
5+
width: 95%;
6+
max-width: var(--ifm-container-width);
7+
margin: 0 auto;
8+
padding: 8rem 0;
9+
}

src/components/other/LiveCoder/components/LiveCoderReact/index.tsx renamed to src/_pages/LandingPage/components/StartCodingView/components/LiveCoder/components/LiveCoderReact/index.tsx

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
import * as React from 'react';
22
import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live';
3-
import clsx from 'clsx';
43
import styles from './styles.module.css';
54
import { CodeSectionPropsInterface } from '../../index';
65
import ReactLiveScope from '@theme/ReactLiveScope';
6+
import { useEffect, useState } from 'react';
77

88
interface Props extends CodeSectionPropsInterface {}
99

1010
const LiveCoderReact: React.FC<Props> = (props) => {
1111
const { code, theme, transformCode } = props;
1212

13+
const [mounted, setMounted] = useState(false);
14+
// The Prism theme on SSR is always the default theme but the site theme
15+
// can be in a different mode. React hydration doesn't update DOM styles
16+
// that come from SSR. Hence force a re-render after mounting to apply the
17+
// current relevant styles. There will be a flash seen of the original
18+
// styles seen using this current approach but that's probably ok. Fixing
19+
// the flash will require changing the theming approach and is not worth it
20+
// at this point.
21+
useEffect(() => {
22+
setMounted(true);
23+
}, []);
24+
1325
return (
1426
<LiveProvider
27+
key={String(mounted)}
1528
code={code.replace(/\n$/, '')}
1629
transformCode={transformCode || ((code) => `${code};`)}
1730
theme={theme}

src/components/other/LiveCoder/index.tsx renamed to src/_pages/LandingPage/components/StartCodingView/components/LiveCoder/index.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ import LiveCoderReact from './components/LiveCoderReact';
44
import { PrismTheme } from 'prism-react-renderer';
55
import { useState } from 'react';
66
import LiveCodeNotFound from './components/LiveCodeNotFound';
7-
import FrameworkButton, {
8-
FrameworkButtonProps,
9-
} from './components/FrameworkButton';
107
import { FaReact, FaVuejs } from 'react-icons/all';
11-
import usePrismTheme from '../../../theme/hooks/usePrismTheme';
12-
import PlainButton from '../../buttons/PlainButton';
8+
import usePrismTheme from '@theme/hooks/usePrismTheme';
9+
import PlainButton from '../../../../../../components/buttons/PlainButton';
10+
import FrameworkButton from './components/FrameworkButton';
1311

1412
type Props = {
1513
reactCode: string;

src/pages/LandingPage/components/StartCodingView/index.tsx renamed to src/_pages/LandingPage/components/StartCodingView/index.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React from 'react';
22
import styles from './styles.module.css';
3-
import LiveCoder from '../../../../components/other/LiveCoder';
3+
import LiveCoder from './components/LiveCoder';
44
import Spacer from '../../../../components/other/Spacer';
5-
import PlainButton from '../../../../components/buttons/PlainButton';
65

76
const reactCode = `// Let's start by creating an Agile Instance
87
const App = new Agile();

src/components/other/StatBadge/index.tsx renamed to src/_pages/LandingPage/components/StatsView/components/StatBadge/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import styles from './styles.module.css';
33
import { IconContext } from 'react-icons';
4-
import Icons, { IconTypes } from '../Icons';
4+
import Icons, { IconTypes } from '../../../../../../components/other/Icons';
55
import clsx from 'clsx';
66
import { useHistory } from 'react-router-dom';
77

src/pages/LandingPage/components/StatsView/index.tsx renamed to src/_pages/LandingPage/components/StatsView/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
44
import Spacer from '../../../../components/other/Spacer';
55
import { useAgile } from '@agile-ts/react';
66
import core from '../../../../core';
7-
import StatBadge from '../../../../components/other/StatBadge';
7+
import StatBadge from './components/StatBadge';
88

99
const StatsView: React.FC = () => {
1010
const { siteConfig } = useDocusaurusContext();

src/components/other/SectionScroller/components/SectionRightItem/index.tsx renamed to src/_pages/LandingPage/components/StraightforwardView/components/SectionScroller/components/SectionRightItem/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React from 'react';
22
import styles from './styles.module.css';
33
import clsx from 'clsx';
4-
import Icons, { IconTypes } from '../../../Icons';
4+
import Icons, {
5+
IconTypes,
6+
} from '../../../../../../../../components/other/Icons';
57

68
export type Props = {
79
icon?: IconTypes;

src/components/other/SectionScroller/index.tsx renamed to src/_pages/LandingPage/components/StraightforwardView/components/SectionScroller/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useCallback, useEffect, useRef, useState } from 'react';
22
import styles from './styles.module.css';
3-
import { useWindowSize } from '../../../hooks/useWindowSize';
3+
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';
7+
import { IconTypes } from '../../../../../../components/other/Icons';
88

99
export interface SectionInterface {
1010
codeWithComment?: string;

src/pages/LandingPage/components/StraightforwardView/index.tsx renamed to src/_pages/LandingPage/components/StraightforwardView/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styles from './styles.module.css';
33
import Spacer from '../../../../components/other/Spacer';
44
import SectionScroller, {
55
SectionInterface,
6-
} from '../../../../components/other/SectionScroller';
6+
} from './components/SectionScroller';
77
import PlainButton from '../../../../components/buttons/PlainButton';
88

99
const sections: SectionInterface[] = [
File renamed without changes.

src/core/entities/ui/ui.actions.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import { THEME_TYPE } from './ui.controller';
1+
import { ASTRONAUT_DARK, THEME_TYPE } from './ui.controller';
22
import { ThemeInterface } from './ui.interface';
33

44
export const toggleTheme = (dark: boolean): void => {
55
THEME_TYPE.set(dark ? 'dark' : 'light');
66
};
77

8+
export const toggleAstronautColor = (dark: boolean): void => {
9+
ASTRONAUT_DARK.set(dark);
10+
};
11+
812
export const mutateThemeCssProperties = (theme: ThemeInterface): void => {
913
document.documentElement.style.setProperty(
1014
'--ifm-background-color',

src/core/entities/ui/ui.controller.ts

+4
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ export const THEME = App.createState<ThemeInterface>(
1818
).watch('mutateColor', (value) => {
1919
mutateThemeCssProperties(value);
2020
});
21+
22+
export const ASTRONAUT_DARK = App.createState<boolean>(false).persist(
23+
'astronaut-color'
24+
);

src/css/custom.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ html[data-theme="dark"] {
273273
}
274274

275275
.menu__link--active.active {
276-
border-left: 5px solid var(--ifm-color-primary) !important;
276+
border-left: 5px solid #6c69a0 !important;
277277
font-weight: 700 !important;
278278
padding-left: 8px;
279279
background-color: rgba(121, 118, 171, 0.2);

src/pages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useEffect } from 'react';
22

3-
import LandingPage from './LandingPage';
3+
import LandingPage from '../_pages/LandingPage';
44
import core from '../core';
55

66
const Home = () => {

src/theme/hooks/usePrismTheme.ts

-16
This file was deleted.

static/img/meta.png

-87.9 KB

0 commit comments

Comments
 (0)