mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
displaying image nodes
This commit is contained in:
parent
c6ccbb0fb4
commit
09b4fbd7b6
3 changed files with 7 additions and 8 deletions
|
@ -1,5 +1,4 @@
|
|||
import React, { FC, useState, useCallback } from 'react';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import { INode } from '~/redux/types';
|
||||
import { URLS } from '~/constants/urls';
|
||||
import { getImageSize } from '~/utils/dom';
|
||||
|
@ -38,11 +37,11 @@ const Cell: FC<IProps> = ({ node: { id, title, brief, type }, onSelect, is_text
|
|||
<div
|
||||
className={styles.thumbnail}
|
||||
style={{
|
||||
backgroundImage: `url("${getImageSize(brief.thumbnail, 'medium')}")`,
|
||||
backgroundImage: `url("${brief.thumbnail}")`,
|
||||
opacity: is_loaded ? 1 : 0,
|
||||
}}
|
||||
>
|
||||
<img src={getImageSize(brief.thumbnail, 'medium')} onLoad={onImageLoad} alt="" />
|
||||
<img src={brief.thumbnail} onLoad={onImageLoad} alt="" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -78,7 +78,7 @@ const NodeImageBlock: FC<IProps> = ({ node, is_loading }) => {
|
|||
>
|
||||
<img
|
||||
className={styles.image}
|
||||
src={getImageSize(file.url, 'node')}
|
||||
src={getImageSize(file, 'node')}
|
||||
alt=""
|
||||
key={file.id}
|
||||
onLoad={onImageLoad(index)}
|
||||
|
|
|
@ -58,12 +58,12 @@ export const getURL = (file: IFile) => {
|
|||
if (!file || !file.url) return null;
|
||||
|
||||
return file.url
|
||||
.replace('REMOTE_OLD://', process.env.REMOTE_OLD)
|
||||
.replace('REMOTE_CURRENT://', process.env.REMOTE_CURRENT);
|
||||
.replace('REMOTE_CURRENT://', process.env.REMOTE_CURRENT)
|
||||
.replace('REMOTE_OLD://', process.env.REMOTE_OLD);
|
||||
};
|
||||
|
||||
export const getImageSize = (image: string, size?: string): string =>
|
||||
`${process.env.API_HOST}${image}`.replace('{size}', size);
|
||||
export const getImageSize = (file: IFile, size?: string): string => getURL(file);
|
||||
// `${process.env.API_HOST}${image}`.replace('{size}', size);
|
||||
|
||||
export const formatCommentText = (author, text: string) =>
|
||||
text
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue