From e2a13405063522140e124bc0ad0176075875a1e2 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Fri, 20 Apr 2018 08:31:19 -0700 Subject: [PATCH] slightly refactor compose box --- routes/_components/compose/ComposeBox.html | 30 ++++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/routes/_components/compose/ComposeBox.html b/routes/_components/compose/ComposeBox.html index 90e4d546..88533ba7 100644 --- a/routes/_components/compose/ComposeBox.html +++ b/routes/_components/compose/ComposeBox.html @@ -153,20 +153,16 @@ }, store: () => store, computed: { - computedClassName: (overLimit, realm, size, postPrivacyKey, isReply) => { - return classname( - 'compose-box', - overLimit && 'over-char-limit', - size === 'slim' && 'slim-size', - isReply && postPrivacyKey === 'direct' && 'direct-reply' - ) - }, - hideAndFadeIn: (hidden) => { - return classname( - 'compose-box-fade-in', - hidden && 'hidden' - ) - }, + computedClassName: (overLimit, realm, size, postPrivacyKey, isReply) => (classname( + 'compose-box', + overLimit && 'over-char-limit', + size === 'slim' && 'slim-size', + isReply && postPrivacyKey === 'direct' && 'direct-reply' + )), + hideAndFadeIn: (hidden) => (classname( + 'compose-box-fade-in', + hidden && 'hidden' + )), composeData: ($currentComposeData, realm) => $currentComposeData[realm] || {}, text: (composeData) => composeData.text || '', media: (composeData) => composeData.media || [], @@ -175,9 +171,9 @@ postPrivacyKey: (composeData, defaultPostPrivacyKey) => composeData.postPrivacy || defaultPostPrivacyKey, textLength: (text) => measureText(text), contentWarningLength: (contentWarning) => measureText(contentWarning), - length: (textLength, contentWarningLength, contentWarningShown) => { - return textLength + (contentWarningShown ? contentWarningLength : 0) - }, + length: (textLength, contentWarningLength, contentWarningShown) => ( + textLength + (contentWarningShown ? contentWarningLength : 0) + ), overLimit: (length) => length > CHAR_LIMIT, contentWarningShown: (composeData) => composeData.contentWarningShown, contentWarning: (composeData) => composeData.contentWarning || '',