Skip to content

Commit

Permalink
🎨 update
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Nov 27, 2024
1 parent eb3d35e commit d8af63d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 0 additions & 1 deletion web/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ export * from './Accordion'
export * from './Menu'
export * from './Heading'
export * from './Table'
export * from './Tabs'
export * from './Form'
export * from './Breadcrumbs'
10 changes: 4 additions & 6 deletions web/core/Tabs/Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ export const Tab = forwardRef<HTMLButtonElement, TabProps>(function Tab({ childr
py-2
pl-3
pr-8
border-b
border-0
hover:underline
hover:underline-offset-4
underline-offset-2
decoration-1
border-slate-80
dark:border-white-100
hover:cursor-pointer
data-active:font-medium
data-active:border-l
data-active:border-r
data-active:border-b-0
data-active:first:border-l-0
data-active:border-b-2
focus:envis-outline
dark:focus:envis-outline-invert
`,
Expand Down
14 changes: 13 additions & 1 deletion web/pageComponents/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,25 @@ const SearchResults = (props: SearchResultsProps) => {
return TopicHit
}
}
const handleTabChange = (value: string) => {
setUserClicked(true)
const activeIndex = options.find((option) => option.label === value)
if (activeIndex) {
refine(activeIndex.value)
}
}

const activeTab = options.findIndex((it) => it.value === currentRefinement)
const hasQuery = results && results.query !== ''
return (
<>
{hasQuery && (
<div ref={resultsRef} className="dark mt-10">
<Tabs value={options[activeTab].label || options[0].label}>
<Tabs
value={options[activeTab].label || options[0].label}
activationMode="manual"
onValueChange={handleTabChange}
>
<TabList>
{options.map((item) => (
<Tab key={item.label} value={item.label} className="text-sm flex gap-2">
Expand Down

0 comments on commit d8af63d

Please sign in to comment.