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

Fixed loading issue #5

Merged
merged 2 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ module.exports = {
respectPrefersColorScheme: true,
},
announcementBar: {
id: 'supportus',
id: 'github-star',
content:
'⭐️ If you like AgileTs, give it a star on <a target="_blank" rel="noopener noreferrer" href="https://github.com/agile-ts/agile">GitHub</a>! ⭐️',
backgroundColor: "#9c9abf"
},
navbar: {
title: 'AgileTs',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"clsx": "^1.1.1",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"react-lazy-load-image-component": "^1.5.1",
"react-spring": "^8.0.27",
"styled-components": "^5.1.1"
},
Expand Down
11 changes: 7 additions & 4 deletions src/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React, {useCallback} from "react";
import { useSpring, animated } from "react-spring";
import styled from "styled-components";
import { LazyLoadImage } from 'react-lazy-load-image-component';

export interface Props {
src: string,
image: string,
width?: number,
height?: number,
onClick?: () => void
}

const Card: React.FC<Props> = (props) => {
const {src, width, height, onClick} = props;
const {image, width, height, onClick} = props;

const [spring, setSpring] = useSpring(() => ({
xys: [0, 0, 1],
Expand All @@ -25,7 +26,9 @@ const Card: React.FC<Props> = (props) => {

return (
<Container width={width} height={height} onClick={onClick} isClickable={!!onClick}>
<AnimatedCard src={src}
<AnimatedCard
src={image}
effect={"blur"}
onMouseMove={({ clientX: x, clientY: y }) =>
setSpring({
xys: calculateRotation(x, y, width, height),
Expand Down Expand Up @@ -56,7 +59,7 @@ const Container = styled.div<{width: number, height: number, isClickable: boolea
cursor: ${props => props.isClickable ? "pointer" : "auto"};
`;

const AnimatedCard = styled(animated.img)`
const AnimatedCard = styled(animated(LazyLoadImage))`
border-radius: 5px;
box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
transition: box-shadow 0.5s;
Expand Down
3 changes: 1 addition & 2 deletions src/page-parts/LandingPage/parts/CodeExample1View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import styled from "styled-components";
import RandomComponent from "../../../components/RandomComponent";
import {useWindowSize} from "../../../hooks/useWindowSize";


const CodeExample1View: React.FC = () => {
const windowSize = useWindowSize();

return (
<CodeExampleContainer>
<Container>
<Card src={"img/first_state.svg"} width={windowSize.windowWidth / 2}
<Card image={"img/first_state.svg"} width={windowSize.windowWidth / 2}
height={windowSize.windowWidth / 3} onClick={() => {
window.open("https://codesandbox.io/s/agilets-first-state-f12cz?file=/src/RandomComponent.js");
}}/>
Expand Down
6 changes: 3 additions & 3 deletions src/page-parts/LandingPage/parts/FeatureView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {featuresData} from "../../../data/featuresData";
import React from "react";
import styled from "styled-components";
import useBaseUrl from '@docusaurus/useBaseUrl';

import { LazyLoadImage } from 'react-lazy-load-image-component';

const FeatureView: React.FC = () => {

Expand All @@ -11,7 +11,7 @@ const FeatureView: React.FC = () => {
return (
<FeatureContainer className="col">
{imgUrl && (
<FeatureImage src={imgUrl} alt={title}/>
<FeatureImage src={imgUrl} alt={title} effect={"blur"}/>
)}
<h3>{title}</h3>
<p>{description}</p>
Expand All @@ -35,7 +35,7 @@ const FeatureView: React.FC = () => {

export default FeatureView;

const FeatureImage = styled.img<{ width?: number, height?: number }>`
const FeatureImage = styled(LazyLoadImage)<{ width?: number, height?: number }>`
width: ${props => props.width || 250}px;
height: ${props => props.height || 150}px;
margin-bottom: 20px;
Expand Down
19 changes: 12 additions & 7 deletions src/page-parts/LandingPage/parts/HeaderView.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import React, {useState} from "react";
import styled from "styled-components";
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import {useWindowSize} from "../../../hooks/useWindowSize";
import Button from "../../../components/Button";
import { LazyLoadImage } from 'react-lazy-load-image-component';

const HeaderView: React.FC = () => {
const windowSize = useWindowSize();
Expand All @@ -29,7 +30,16 @@ const HeaderView: React.FC = () => {
return (
windowSize.windowWidth > 1300 ?
<header>
<Image src={"img/header_background.svg"} alt={"Header Background"}/>
<LazyLoadImage
height={windowSize.windowWidth / 4.08}
src={"img/header_background.svg"}
alt={"Header Background"}
placeholder={
<header
style={{backgroundColor: "#3F3D56", height: windowSize.windowWidth / 4.08}}
className={'hero hero--primary'}
/>}
/>
<ImageContent>
<HeaderContent/>
</ImageContent>
Expand All @@ -50,11 +60,6 @@ const Container = styled.div`
text-align: center;
`;

const Image = styled.img`
width: 100%;
height: 100%;
`;

const ImageContent = styled.div`
position: absolute;
top: 150px;
Expand Down
20 changes: 10 additions & 10 deletions src/page-parts/LandingPage/parts/IncludesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {useWindowSize} from "../../../hooks/useWindowSize";

const IncludesView: React.FC = () => {
const [open, setOpen] = useState(false);
const [showContent, setShowContent] = useState(false);
const [showItems, setShowItems] = useState(false);
const windowSize = useWindowSize();

useEffect(() => {
if (open) {
setShowContent(true)
setShowItems(true)
} else {
setTimeout(() => {
setShowContent(false);
setShowItems(false);
}, 800)
}
}, [open]);
Expand Down Expand Up @@ -49,7 +49,7 @@ const IncludesView: React.FC = () => {

return (
<Container>
<Main showContent={showContent}
<Main showItems={showItems}
style={{...mainSpringProps, width: mainSpringProps.size, height: mainSpringProps.size, transform: scaleSpringProps.scale.interpolate((s) => `scale(${s})`)}}
onClick={() => setOpen(open => !open)}
onMouseMove={() =>
Expand All @@ -64,7 +64,7 @@ const IncludesView: React.FC = () => {
}
>
{
showContent ?
showItems ?
transitions.map(({item, key, props}) =>
<Link to={useBaseUrl(item.route)}>
<Item key={key} style={{...props}}>
Expand All @@ -77,7 +77,7 @@ const IncludesView: React.FC = () => {
<img src={"img/logo.svg"} alt={"Header Background"}/>
}
</Main>
{showContent && <Background onClick={() => setOpen(false)} height={windowSize.scrollHeight}/>}
{showItems && <Background onClick={() => setOpen(false)} height={windowSize.scrollHeight}/>}
</Container>
)
}
Expand All @@ -91,14 +91,14 @@ const Container = styled.div`
height: 200px;
`;

const Main = styled(animated.div)<{ showContent: boolean }>`
const Main = styled(animated.div)<{ showItems: boolean }>`
position: absolute;
display: grid;
grid-template-columns: repeat(4, minmax(100px, 1fr));
grid-gap: ${props => props.showContent ? 25 : 0}px;
padding: ${props => props.showContent ? 25 : 0}px;
grid-gap: ${props => props.showItems ? 25 : 0}px;
padding: ${props => props.showItems ? 25 : 0}px;
border-radius: 25px;
cursor: ${props => props.showContent ? "auto" : "pointer"};
cursor: ${props => props.showItems ? "auto" : "pointer"};
box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
will-change: width, height;
z-index: 100;
Expand Down
23 changes: 0 additions & 23 deletions src/page-parts/LoadingPage/index.tsx

This file was deleted.

18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6466,6 +6466,11 @@ lodash.curry@^4.0.1:
resolved "https://registry.yarnpkg.com/lodash.curry/-/lodash.curry-4.1.1.tgz#248e36072ede906501d75966200a86dab8b23170"
integrity sha1-JI42By7ekGUB11lmIAqG2riyMXA=

lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=

lodash.defaults@^4.0.1:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
Expand Down Expand Up @@ -6586,6 +6591,11 @@ lodash.templatesettings@^4.0.0:
dependencies:
lodash._reinterpolate "^3.0.0"

lodash.throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
integrity sha1-wj6RtxAkKscMN/HhzaknTMOb8vQ=

lodash.toarray@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.toarray/-/lodash.toarray-4.4.0.tgz#24c4bfcd6b2fba38bfd0594db1179d8e9b656561"
Expand Down Expand Up @@ -8699,6 +8709,14 @@ react-json-view@^1.19.1:
react-lifecycles-compat "^3.0.4"
react-textarea-autosize "^6.1.0"

react-lazy-load-image-component@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/react-lazy-load-image-component/-/react-lazy-load-image-component-1.5.1.tgz#59cc92326ba5604e9c4a86805a2cf1667fafbc71"
integrity sha512-grTEZzURLHPkq7JoipcBBQU44ijdF4fH3Cb+eSD5eSAaMsjugbXqTaVWm5ruPUNLduoNR9KKQF6bOR9h2WphEg==
dependencies:
lodash.debounce "^4.0.8"
lodash.throttle "^4.1.1"

react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
Expand Down