mirror of
https://github.com/linsa-io/linsa.git
synced 2026-04-19 23:11:30 +02:00
active learning tab
This commit is contained in:
@@ -25,7 +25,6 @@ export const LinkHeader = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ContentHeader className="p-4">
|
<ContentHeader className="p-4">
|
||||||
{/* Toggle and Title */}
|
|
||||||
<div className="flex min-w-0 shrink-0 items-center gap-1.5">
|
<div className="flex min-w-0 shrink-0 items-center gap-1.5">
|
||||||
<SidebarToggleButton />
|
<SidebarToggleButton />
|
||||||
<div className="flex min-h-0 items-center">
|
<div className="flex min-h-0 items-center">
|
||||||
@@ -50,18 +49,25 @@ export const LinkHeader = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Tabs = () => {
|
const Tabs = () => {
|
||||||
|
const [activeTab, setActiveTab] = React.useState(TABS[0])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-secondary/50 flex items-baseline overflow-x-hidden rounded-md">
|
<div className="bg-secondary/50 flex items-baseline overflow-x-hidden rounded-md">
|
||||||
{TABS.map(tab => (
|
{TABS.map(tab => (
|
||||||
<TabItem key={tab} url="#" label={tab} />
|
<TabItem key={tab} url="#" label={tab} isActive={activeTab === tab} onClick={() => setActiveTab(tab)} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const TabItem = ({ url, label }: TabItemProps) => {
|
interface TabItemProps {
|
||||||
const [isActive, setIsActive] = React.useState(false)
|
url: string
|
||||||
|
label: string
|
||||||
|
isActive: boolean
|
||||||
|
onClick: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const TabItem = ({ url, label, isActive, onClick }: TabItemProps) => {
|
||||||
return (
|
return (
|
||||||
<div tabIndex={-1} className="rounded-md">
|
<div tabIndex={-1} className="rounded-md">
|
||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
@@ -72,8 +78,7 @@ const TabItem = ({ url, label }: TabItemProps) => {
|
|||||||
type="button"
|
type="button"
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className={`gap-x-2 truncate text-sm ${isActive ? "bg-accent text-accent-foreground" : ""}`}
|
className={`gap-x-2 truncate text-sm ${isActive ? "bg-accent text-accent-foreground" : ""}`}
|
||||||
onClick={() => setIsActive(true)}
|
onClick={onClick}
|
||||||
onBlur={() => setIsActive(false)}
|
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user