collections: address L review

This commit is contained in:
Liam Fitzgerald 2021-06-15 09:48:57 +10:00
parent 5f7e4c34b2
commit 8bfbef1b45
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
2 changed files with 33 additions and 37 deletions

View File

@ -100,9 +100,6 @@ class RemoteContent extends Component<RemoteContentProps, RemoteContentState> {
}
}
componentDidMount() {
}
onLoad = () => {
window.requestAnimationFrame(() => {
const { restore } = this;
@ -257,35 +254,37 @@ return;
if (!this.state.embed || this.state.embed?.html === '') {
this.loadOembed();
}
const renderEmbed = !(this.state.embed !== 'error' && this.state.embed?.html);
const embed = <Box
mb={2}
width='100%'
flexShrink={0}
display={this.state.unfold ? 'block' : 'none'}
className='embed-container'
style={style}
onLoad={this.onLoad}
{...oembedProps}
{...props}
>
<TruncatedText
display={(renderUrl && this.state.embed?.title && this.state.embed.title !== url) ? 'inline-block' : 'none'}
fontWeight='bold' width='100%'
>
{this.state.embed?.title}
</TruncatedText>
{this.state.embed && this.state.embed.html && this.state.unfold
? <EmbedContainer markup={this.state.embed.html}>
<div className="embed-container" ref={(el) => {
this.onLoad();
this.containerRef = el;
}}
dangerouslySetInnerHTML={{ __html: this.state.embed.html }}
></div>
</EmbedContainer>
: null}
</Box>;
const renderEmbed = !(this.state.embed !== 'error' && this.state.embed?.html);
const embed = (
<Box
mb={2}
width='100%'
flexShrink={0}
display={this.state.unfold ? 'block' : 'none'}
className='embed-container'
style={style}
onLoad={this.onLoad}
{...oembedProps}
{...props}
>
<TruncatedText
display={(renderUrl && this.state.embed?.title && this.state.embed.title !== url) ? 'inline-block' : 'none'}
fontWeight='bold' width='100%'
>
{this.state.embed?.title}
</TruncatedText>
{this.state.embed && this.state.embed.html && this.state.unfold
? <EmbedContainer markup={this.state.embed.html}>
<div className="embed-container" ref={(el) => {
this.onLoad();
this.containerRef = el;
}}
dangerouslySetInnerHTML={{ __html: this.state.embed.html }}
></div>
</EmbedContainer>
: null}
</Box>
);
return (
<Fragment>

View File

@ -1,6 +1,6 @@
import React, { ChangeEvent, useCallback, useMemo, useState } from 'react';
import React, { ChangeEvent, useCallback, useMemo } from 'react';
import { Text, Box, BaseInput, BaseInputProps } from '@tlon/indigo-react';
import { Text, Box, BaseInput } from '@tlon/indigo-react';
import { PropFunc } from '~/types';
type StatelessUrlInputProps = PropFunc<typeof BaseInput> & {
@ -17,7 +17,6 @@ type StatelessUrlInputProps = PropFunc<typeof BaseInput> & {
export function StatelessUrlInput(props: StatelessUrlInputProps) {
const {
value,
error,
focussed,
disabled,
onChange = () => {},
@ -27,8 +26,6 @@ export function StatelessUrlInput(props: StatelessUrlInputProps) {
...rest
} = props;
console.log(focussed);
const placeholder = useMemo(
() => (
<Text