Added: Placeholder when uploading images
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import type { Props } from '../types';
|
||||
import styled from 'styled-components';
|
||||
|
||||
const LoadingImage = styled.img`
|
||||
opacity: .5;
|
||||
`;
|
||||
|
||||
export default function Image({ attributes, node }: Props) {
|
||||
return (
|
||||
<img
|
||||
{...attributes}
|
||||
src={node.data.get('src')}
|
||||
alt={node.data.get('alt')}
|
||||
/>
|
||||
);
|
||||
const loading = node.data.get('loading');
|
||||
const Component = loading ? LoadingImage : 'img';
|
||||
const src = node.data.get('inlineSrc') || node.data.get('src');
|
||||
|
||||
return <Component {...attributes} src={src} alt={node.data.get('alt')} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user