mirror of
				https://github.com/strapi/strapi.git
				synced 2025-11-04 03:43:34 +00:00 
			
		
		
		
	constant naming
This commit is contained in:
		
							parent
							
								
									dfe3922ca7
								
							
						
					
					
						commit
						1a82ba625e
					
				@ -13,7 +13,7 @@ import {
 | 
			
		||||
} from './StyledMediaPreviewList';
 | 
			
		||||
 | 
			
		||||
function MediaPreviewList({ hoverable, files }) {
 | 
			
		||||
  const maxLength = 3;
 | 
			
		||||
  const IMAGE_PREVIEW_COUNT = 3;
 | 
			
		||||
  const getFileType = fileName => fileName.split('.').slice(-1)[0];
 | 
			
		||||
  const getSrc = fileURL =>
 | 
			
		||||
    fileURL.startsWith('/') ? `${strapi.backendURL}${fileURL}` : fileURL;
 | 
			
		||||
@ -74,8 +74,9 @@ function MediaPreviewList({ hoverable, files }) {
 | 
			
		||||
    return files.map((file, index) => {
 | 
			
		||||
      return (
 | 
			
		||||
        <React.Fragment key={JSON.stringify(file)}>
 | 
			
		||||
          {index === maxLength && files.length - maxLength > 1
 | 
			
		||||
            ? renderText(files.length - maxLength)
 | 
			
		||||
          {index === IMAGE_PREVIEW_COUNT &&
 | 
			
		||||
          files.length > IMAGE_PREVIEW_COUNT + 1
 | 
			
		||||
            ? renderText(files.length - IMAGE_PREVIEW_COUNT)
 | 
			
		||||
            : renderItem(file)}
 | 
			
		||||
        </React.Fragment>
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user