This repository was archived by the owner on Nov 8, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork37
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletionsnext-env.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/types/global" /> | ||
/// <reference types="next/image-types/global" /> | ||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
2 changes: 1 addition & 1 deletionpackage.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletionssrc/components/ArticleMenu/RealArticleMenu.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
47 changes: 20 additions & 27 deletionssrc/components/Img/LazyLoadImg.js → src/components/Img/LazyLoadImg.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,50 @@ | ||
import { FC, Fragment, ReactNode, memo, useState } from 'react' | ||
import { LazyLoadImage } from 'react-lazy-load-image-component' | ||
import 'react-lazy-load-image-component/src/effects/blur.css' | ||
import { Wrapper, FallbackWrapper } from './styles/lazy_load_image' | ||
type TProps = { | ||
className?: string | ||
src: string | ||
alt?: string | ||
fallback?: ReactNode | null | ||
scrollPosition: any | ||
visibleByDefault?: boolean | ||
} | ||
/** | ||
* lazy load images like .jpg .jpeg .png etc | ||
* the fallback is for the image offen block in china, like github avatars | ||
* fallback 常被用于图片间歇性被墙的情况,比如 github 头像等 | ||
*/ | ||
const LazyLoadImg: FC<TProps> = ({ | ||
className = 'img-class', | ||
src, | ||
alt = 'image', | ||
fallback = null, | ||
visibleByDefault = false, | ||
}) => { | ||
const [imgLoaded, setImgLoaded] = useState(false) | ||
return ( | ||
<Wrapper> | ||
<FallbackWrapper> | ||
{!imgLoaded && <Fragment>{fallback}</Fragment>} | ||
</FallbackWrapper> | ||
<LazyLoadImage | ||
className={className} | ||
src={src} | ||
alt={alt} | ||
// placeholder={<PlaceHolder child={fallback} />} | ||
effect="blur" | ||
scrollPosition={null} | ||
visibleByDefault={visibleByDefault} | ||
afterLoad={() => setImgLoaded(true)} | ||
/> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(LazyLoadImg) |
43 changes: 43 additions & 0 deletionssrc/components/Img/NextImg.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { FC, Fragment, ReactNode, memo, useState } from 'react' | ||
import Image from 'next/image' | ||
import { Wrapper, FallbackWrapper } from './styles/lazy_load_image' | ||
type TProps = { | ||
className?: string | ||
src: string | ||
alt?: string | ||
fallback?: ReactNode | null | ||
visibleByDefault?: boolean | ||
} | ||
/** | ||
* lazy load images like .jpg .jpeg .png etc | ||
* the fallback is for the image offen block in china, like github avatars | ||
* fallback 常被用于图片间歇性被墙的情况,比如 github 头像等 | ||
*/ | ||
const NextImg: FC<TProps> = ({ | ||
className = 'img-class', | ||
src, | ||
alt = 'image', | ||
fallback = null, | ||
}) => { | ||
const [imgLoaded, setImgLoaded] = useState(false) | ||
return ( | ||
<Wrapper> | ||
<FallbackWrapper> | ||
{!imgLoaded && <Fragment>{fallback}</Fragment>} | ||
</FallbackWrapper> | ||
<Image | ||
className={className} | ||
src={src} | ||
alt={alt} | ||
placeholder="blur" | ||
onLoadStart={() => setImgLoaded(true)} | ||
/> | ||
</Wrapper> | ||
) | ||
} | ||
export default memo(NextImg) |
40 changes: 23 additions & 17 deletionssrc/components/Img/NormalImg.js → src/components/Img/NormalImg.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
31 changes: 7 additions & 24 deletionssrc/components/Img/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletionssrc/containers/layout/ThemePalette/ThirdPartyOverWrite.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.