Skip to content

Commit

Permalink
Added code to allow toggle of active tabs so the active tab doesn't c…
Browse files Browse the repository at this point in the history
…over the t-shirt on mobile view
  • Loading branch information
GIT-Gizmo committed Apr 16, 2024
1 parent 53e0d8c commit 526b037
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/src/pages/Customizer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ const Customizer = () => {
}
}

// Toggle the selected editor tab
const toggleEditorTab = (tabName) => {
setActiveEditorTab((prevTab) => (prevTab === tabName ? '' : tabName));
}

const handleSubmit = async (type) => {
if (!prompt) return alert("Please enter a prompt!");

Expand Down Expand Up @@ -128,7 +133,8 @@ const Customizer = () => {
<Tab
key={tab.name}
tab={tab}
handleClick={() => setActiveEditorTab(tab.name)}
handleClick={() => toggleEditorTab(tab.name)}
isActive={activeEditorTab === tab.name}
/>
))}
{generateTabContent()}
Expand Down

0 comments on commit 526b037

Please sign in to comment.