Skip to content

Commit

Permalink
fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
wkrzywiec committed Feb 15, 2025
1 parent 7ccbb0f commit c9b4a34
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ tasks:
- echo "Starting mankkoo UI..."
- npm run dev --turbo

ui:build:
desc: Build UI
dir: services/mankkoo-ui
cmds:
- echo "Starting building UI..."
- npm run build

test:
desc: Run all tests
cmds:
Expand Down
12 changes: 8 additions & 4 deletions services/mankkoo-ui/components/elements/TabList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,28 @@ export default function TabList({children, activeTabIndex = 0}: {children: React
const handleTabClick = (index: number) => {
setActiveTab(index);
};

const labels = children
.map(tab => tab.props as { [key: string]: any })
.map(tabProps => tabProps.label as string)

return (
<div className="tabs">
<nav className="tab-list-wrapper">
<ul className="tab-list" role="tablist" aria-orientation="horizontal">
{children.map((tab, index) => (
{labels.map((label, index) => (
<li key={`tab-${index}`}>
<button
key={`tab-btn-${index}`}
role="tab"
id={`tab-${sanitizeForId(tab.props.label)}`}
aria-controls={`panel-${sanitizeForId(tab.props.label)}`}
id={`tab-${sanitizeForId(label)}`}
aria-controls={`panel-${sanitizeForId(label)}`}
aria-selected={activeTab === index}
onClick={() => handleTabClick(index)}
className={`tab-btn ${
activeTab === index && "tab-btn--active"
}`}
>{tab.props.label}</button>
>{label}</button>
</li>
))}
</ul>
Expand Down

0 comments on commit c9b4a34

Please sign in to comment.