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