From ae6ddfb3fdd9c85b8dbca142ef2722fce57fbe86 Mon Sep 17 00:00:00 2001 From: Christine Yu Date: Thu, 8 Oct 2020 20:27:31 -0400 Subject: [PATCH] Make customize box logic reusable by pulling up into AddonsItem and creating CustomizeOptions component --- src/components/addons.js | 112 ++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 59 deletions(-) diff --git a/src/components/addons.js b/src/components/addons.js index 5f54f99..ae7e5a5 100644 --- a/src/components/addons.js +++ b/src/components/addons.js @@ -5,55 +5,54 @@ import links from "../constants/page-links" import { isMediumUsernameValid, isGitHubUsernameValid } from "../utils/validation" import { ToolsIcon, XCircleIcon } from "@primer/octicons-react"; -const CustomizeOptions = ({title, CustomizationOptions}) => { - const [open, setOpen] = useState(false) - const Icon = open ? XCircleIcon : ToolsIcon +const AddonsItem = ({ inputId, inputChecked, onInputChange, Options, onIconClick, ...props }) => { + const [open, setOpen] = useState(false); + const Icon = open ? XCircleIcon : ToolsIcon; return ( <> - - {open &&
-
{ title }
-
-
- {CustomizationOptions} -
-
} - - ) -} - -const AddonsItem = ({inputId, inputChecked, onInputChange, Icon, onIconClick, ...props}) => { - return ( -
- - { - Icon? - - :'' - } + )} +
+ {Options && open && Options} + + ); +}; + +const CustomizeOptions = ({ title, CustomizationOptions }) => ( +
+
{title}
+
+
+ {CustomizationOptions}
- ) -} +
+); + const CustomizeBadge = ({githubName, badgeOptions, onBadgeUpdate}) => { return ( -
-
Customize Badge
-
-
+ <>