From e6758349fb041863695090bdfed81e8f9bebd90f Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Sat, 31 Aug 2019 12:56:57 -0500 Subject: [PATCH] refactor SubscribeButton for SRP -> Primary Button & MirrorButtons --- .../src/components/SubscribeButton.tsx | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/FilterLists.Web.V2/src/components/SubscribeButton.tsx b/src/FilterLists.Web.V2/src/components/SubscribeButton.tsx index e130d3030..89acdde27 100644 --- a/src/FilterLists.Web.V2/src/components/SubscribeButton.tsx +++ b/src/FilterLists.Web.V2/src/components/SubscribeButton.tsx @@ -10,15 +10,26 @@ interface Props { export const SubscribeButton = (props: Props) => { const buttonProps = buildButtonProps(props.name, props.viewUrl); - return - - {props.viewUrlMirrors && props.viewUrlMirrors.length && - props.viewUrlMirrors.map((viewUrlMirror: string, i: number) => { + return ( + <> + + + + ) +}; + +const PrimaryButton = (props: [ButtonProps, boolean]) => + ; + +const MirrorButtons = (props: Props) => + <> + {props.viewUrlMirrors && props.viewUrlMirrors.length + ? props.viewUrlMirrors.map((viewUrlMirror: string, i: number) => { const buttonProps = buildButtonProps(props.name, viewUrlMirror); return - })} - -}; + }) + : null} + ; const buildButtonProps = (name: string, viewUrl: string): [ButtonProps, boolean] => { let type: ButtonType = "primary";