-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add react-virtualized to the files list (#957)
- Use `react-virtualized` to only render the files in view - Loading animation when listing takes more than 1s to load - Dir sizes only show if current dir has < 100 files (fix in an incoming PR)
- Loading branch information
Showing
18 changed files
with
41,580 additions
and
152 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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,16 +1,58 @@ | ||
import React from 'react' | ||
import { translate } from 'react-i18next' | ||
// Components | ||
import GlyphDots from '../../icons/GlyphDots' | ||
import Checkbox from '../../components/checkbox/Checkbox' | ||
import FileIcon from '../../files/file-icon/FileIcon' | ||
// Styles | ||
import './LoadingAnimation.css' | ||
|
||
const LoadingAnimation = ({ loading, children }) => { | ||
if (!loading) return children | ||
const FakeHeader = ({ t }) => ( | ||
<header className='gray pv2 flex items-center flex-none'> | ||
<div className='pa2 w2'><Checkbox disabled /></div> | ||
<div className='ph2 f6 flex-auto'>{t('fileName')}</div> | ||
<div className='pl2 pr4 tr f6 flex-none dn db-l'>{t('size')}</div> | ||
<div className='pa2' style={{ width: '2.5rem' }} /> | ||
</header> | ||
) | ||
|
||
return ( | ||
<div className='LoadingAnimation'> | ||
<div className='LoadingAnimationSwipe'> | ||
{ children } | ||
const FakeFile = ({ nameWidth }) => ( | ||
<div className='b--light-gray relative flex items-center bt' style={{ height: 55 }}> | ||
<div className='pa2 w2'> | ||
<Checkbox disabled /> | ||
</div> | ||
<div className='relative pointer flex items-center flex-grow-1 ph2 pv1 w-40'> | ||
<div className='dib flex-shrink-0 mr2'> | ||
<FileIcon cls='fill-charcoal' /> | ||
</div> | ||
<div className='w-100'> | ||
<div className={`w-${nameWidth} br1 bg-charcoal-muted f7`}> </div> | ||
<div className='w-80 br1 mt1 bg-gray f7 o-70'> </div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
<div className='size mr4 pl2 pr4 flex-none dn db-l br1 tr f7 bg-gray'> </div> | ||
<div className='ph2' style={{ width: '2.5rem' }}> | ||
<GlyphDots className='fill-gray-muted pointer' /> | ||
</div> | ||
</div> | ||
) | ||
|
||
const LoadingAnimation = ({ t }) => ( | ||
<div className='LoadingAnimation'> | ||
<div className='LoadingAnimationSwipe'> | ||
<FakeHeader t={t} /> | ||
<FakeFile nameWidth={50} /> | ||
<FakeFile nameWidth={40} /> | ||
<FakeFile nameWidth={60} /> | ||
<FakeFile nameWidth={30} /> | ||
<FakeFile nameWidth={50} /> | ||
<FakeFile nameWidth={60} /> | ||
<FakeFile nameWidth={70} /> | ||
<FakeFile nameWidth={40} /> | ||
<FakeFile nameWidth={30} /> | ||
<FakeFile nameWidth={50} /> | ||
</div> | ||
</div> | ||
) | ||
|
||
export default LoadingAnimation | ||
export default translate('files')(LoadingAnimation) |
This file contains 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
This file contains 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
This file contains 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.