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 = () => { onLoad = () => {
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
const { restore } = this; const { restore } = this;
@ -257,35 +254,37 @@ return;
if (!this.state.embed || this.state.embed?.html === '') { if (!this.state.embed || this.state.embed?.html === '') {
this.loadOembed(); this.loadOembed();
} }
const renderEmbed = !(this.state.embed !== 'error' && this.state.embed?.html); const renderEmbed = !(this.state.embed !== 'error' && this.state.embed?.html);
const embed = <Box const embed = (
mb={2} <Box
width='100%' mb={2}
flexShrink={0} width='100%'
display={this.state.unfold ? 'block' : 'none'} flexShrink={0}
className='embed-container' display={this.state.unfold ? 'block' : 'none'}
style={style} className='embed-container'
onLoad={this.onLoad} style={style}
{...oembedProps} onLoad={this.onLoad}
{...props} {...oembedProps}
> {...props}
<TruncatedText >
display={(renderUrl && this.state.embed?.title && this.state.embed.title !== url) ? 'inline-block' : 'none'} <TruncatedText
fontWeight='bold' width='100%' 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?.title}
{this.state.embed && this.state.embed.html && this.state.unfold </TruncatedText>
? <EmbedContainer markup={this.state.embed.html}> {this.state.embed && this.state.embed.html && this.state.unfold
<div className="embed-container" ref={(el) => { ? <EmbedContainer markup={this.state.embed.html}>
this.onLoad(); <div className="embed-container" ref={(el) => {
this.containerRef = el; this.onLoad();
}} this.containerRef = el;
dangerouslySetInnerHTML={{ __html: this.state.embed.html }} }}
></div> dangerouslySetInnerHTML={{ __html: this.state.embed.html }}
</EmbedContainer> ></div>
: null} </EmbedContainer>
</Box>; : null}
</Box>
);
return ( return (
<Fragment> <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'; import { PropFunc } from '~/types';
type StatelessUrlInputProps = PropFunc<typeof BaseInput> & { type StatelessUrlInputProps = PropFunc<typeof BaseInput> & {
@ -17,7 +17,6 @@ type StatelessUrlInputProps = PropFunc<typeof BaseInput> & {
export function StatelessUrlInput(props: StatelessUrlInputProps) { export function StatelessUrlInput(props: StatelessUrlInputProps) {
const { const {
value, value,
error,
focussed, focussed,
disabled, disabled,
onChange = () => {}, onChange = () => {},
@ -27,8 +26,6 @@ export function StatelessUrlInput(props: StatelessUrlInputProps) {
...rest ...rest
} = props; } = props;
console.log(focussed);
const placeholder = useMemo( const placeholder = useMemo(
() => ( () => (
<Text <Text