|
1 | 1 | import { FC, useState } from 'react'
|
2 | 2 |
|
3 |
| -import { Accordion, Alert, Layout, Link, Skeleton, Spacer, Tag, Text } from '@/components' |
| 3 | +import { Accordion, Alert, Button, Layout, Link, Skeleton, Spacer, Tag, Text } from '@/components' |
4 | 4 | import { useTranslation } from '@/context'
|
5 | 5 | import { cn } from '@utils/cn'
|
6 | 6 |
|
@@ -110,7 +110,7 @@ export const SearchResultsList: FC<SearchResultsListProps> = ({
|
110 | 110 | </Link>
|
111 | 111 | </Layout.Horizontal>
|
112 | 112 | </Accordion.Trigger>
|
113 |
| - <Accordion.Content className="border-t bg-cn-background-1 pb-0"> |
| 113 | + <Accordion.Content className="bg-cn-background-1 border-t pb-0"> |
114 | 114 | {item.matches && item.matches.length >= 1 && (
|
115 | 115 | <Layout.Vertical gap="none" className="mt-1">
|
116 | 116 | {item.matches
|
@@ -147,31 +147,26 @@ export const SearchResultsList: FC<SearchResultsListProps> = ({
|
147 | 147 | </div>
|
148 | 148 | ))}
|
149 | 149 | {item.matches?.length > DEFAULT_NUM_ITEMS_TO_SHOW && (
|
150 |
| - <Text |
151 |
| - variant="caption-single-line-normal" |
152 |
| - className="mt-2 cursor-pointer bg-cn-background-0 py-1.5 pl-4 hover:underline" |
153 |
| - tabIndex={0} |
154 |
| - onMouseDown={e => { |
155 |
| - e.preventDefault() |
156 |
| - }} |
157 |
| - onClick={e => { |
158 |
| - e.stopPropagation() |
159 |
| - e.preventDefault() |
160 |
| - |
161 |
| - const key = `${item.repo_path}/${item.file_name}` |
162 |
| - setExpandedItems(prev => ({ |
163 |
| - ...prev, |
164 |
| - [key]: !prev[key] |
165 |
| - })) |
166 |
| - }} |
167 |
| - > |
168 |
| - {expandedItems[`${item.repo_path}/${item.file_name}`] |
169 |
| - ? t('views:search.showLess', '- Show Less') |
170 |
| - : t( |
171 |
| - 'views:search.showMore', |
172 |
| - `+ Show ${item.matches.length - DEFAULT_NUM_ITEMS_TO_SHOW} more matches` |
173 |
| - )} |
174 |
| - </Text> |
| 150 | + <div className="bg-cn-background-0 mt-2 py-1.5 pl-4"> |
| 151 | + <Button |
| 152 | + variant="link" |
| 153 | + className="text-cn-2 font-caption-single-line-normal p-cn-4xs h-fit" |
| 154 | + onClick={() => { |
| 155 | + const key = `${item.repo_path}/${item.file_name}` |
| 156 | + setExpandedItems(prev => ({ |
| 157 | + ...prev, |
| 158 | + [key]: !prev[key] |
| 159 | + })) |
| 160 | + }} |
| 161 | + > |
| 162 | + {expandedItems[`${item.repo_path}/${item.file_name}`] |
| 163 | + ? t('views:search.showLess', '- Show Less') |
| 164 | + : t( |
| 165 | + 'views:search.showMore', |
| 166 | + `+ Show ${item.matches.length - DEFAULT_NUM_ITEMS_TO_SHOW} more matches` |
| 167 | + )} |
| 168 | + </Button> |
| 169 | + </div> |
175 | 170 | )}
|
176 | 171 | </Layout.Vertical>
|
177 | 172 | )}
|
|
0 commit comments