parent
e8f62a62cb
commit
8da03b02ea
3 changed files with 84 additions and 3 deletions
After Width: | Height: | Size: 293 B |
@ -0,0 +1,74 @@ |
||||
import React, { useState } from "react"; |
||||
import Button from "../Button"; |
||||
|
||||
const Tabbar = ({ tabs }) => { |
||||
const [activeTab, setActiveTab] = useState(); |
||||
|
||||
return ( |
||||
<div className="flex flex-col mt-7"> |
||||
<div className="flex items-center"> |
||||
{tabs.map((tab, index) => ( |
||||
<Button |
||||
key={index} |
||||
text={tab.title} |
||||
className={`${tab.className} ${ |
||||
activeTab === tab |
||||
? "bg-[#F1F3FF] text-[#3C58EA]" |
||||
: "bg-white text-[#333333]" |
||||
} w-full p-3 text-sm font-bold border border-b-2 border-t-2 border-[#3C58EA]`}
|
||||
icon={activeTab === tab ? "images/blue-correct-thick-icon.svg" : ""} |
||||
onClick={() => setActiveTab(tab)} |
||||
/> |
||||
))} |
||||
</div> |
||||
<div |
||||
className={`rounded w-full text-white flex items-center mt-5 ${activeTab?.bg}`} |
||||
> |
||||
{activeTab?.components} |
||||
</div> |
||||
</div> |
||||
); |
||||
}; |
||||
|
||||
export default Tabbar; |
||||
|
||||
Tabbar.defaultProps = { |
||||
tabs: [ |
||||
{ |
||||
title: "تنظیمات", |
||||
className: "rounded-tr-md rounded-br-md border-r-2", |
||||
components: "mahdi", |
||||
bg: "bg-blue-500", |
||||
}, |
||||
{ |
||||
title: "سوالات", |
||||
className: "", |
||||
components: "iran", |
||||
bg: "bg-blue-500", |
||||
}, |
||||
{ |
||||
title: "چک لیست", |
||||
className: "", |
||||
components: "zlatan", |
||||
bg: "bg-blue-500", |
||||
}, |
||||
{ |
||||
title: "مکاتبات", |
||||
className: "", |
||||
components: "mahdii", |
||||
bg: "bg-blue-500", |
||||
}, |
||||
{ |
||||
title: "توابع", |
||||
className: "", |
||||
components: "mahdiii", |
||||
bg: "bg-blue-500", |
||||
}, |
||||
{ |
||||
title: "شرایط و اجرا", |
||||
className: "rounded-tl-md rounded-bl-md border-l-2", |
||||
components: "mahdiii", |
||||
bg: "bg-blue-500", |
||||
}, |
||||
], |
||||
}; |
Loading…
Reference in new issue