This commit is contained in:
Alejandro
2023-02-06 22:42:47 +01:00
committed by GitHub
parent 72ab0e25b4
commit a230b2ce61
33 changed files with 842 additions and 311 deletions

39
src/Element/Tabs.tsx Normal file
View File

@ -0,0 +1,39 @@
import './Tabs.css'
export interface Tab {
text: string, value: number
}
interface TabsProps {
tabs: Tab[]
tab: Tab
setTab: (t: Tab) => void
}
interface TabElementProps extends Omit<TabsProps, 'tabs'> {
t: Tab
}
export const TabElement = ({ t, tab, setTab }: TabElementProps) => {
return (
<div className={`tab ${tab.value === t.value ? "active" : ""}`} onClick={() => setTab(t)}>
{t.text}
</div>
)
}
const Tabs = ({ tabs, tab, setTab }: TabsProps) => {
return (
<div className="tabs">
{tabs.map((t) => {
return (
<div className={`tab ${tab.value === t.value ? "active" : ""}`} onClick={() => setTab(t)}>
{t.text}
</div>
)
})}
</div>
)
}
export default Tabs