From 50d8058366c0621d494a6bedfa1b2cc49bf74b6a Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Tue, 11 Dec 2018 11:39:43 +0000 Subject: [PATCH] refmt CardSource --- src/components/presentational/CardSource.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/presentational/CardSource.js b/src/components/presentational/CardSource.js index c66d685..95fdb06 100644 --- a/src/components/presentational/CardSource.js +++ b/src/components/presentational/CardSource.js @@ -6,24 +6,22 @@ import copy from '../../js/data/copy.json' const CardSource = ({ source, language, isLoading, error }) => { const source_lang = copy[language].cardstack.source - if (isLoading) { - return - } - function renderSource() { - return ( + return source.error ? ( +
{source.error}
+ ) : (

TODO: display source properly.

) } + function renderContent() { + return isLoading ? : renderSource() + } + return (

{source_lang}:

- {source.error ? ( -
{source.error}
- ) : ( - renderSource() - )} + {renderContent()}
) }