Skip to content

Commit f3055c5

Browse files
authored
Merge pull request #2255 from oasisprotocol/mz/uil-search
Replace MUI dependencies in Search with Oasis UI Library
2 parents 78c3f34 + 6c161d1 commit f3055c5

9 files changed

Lines changed: 96 additions & 351 deletions

File tree

.changelog/2255.internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Replace MUI dependencies in Search with Oasis UI Library

src/app/components/AppendMobileSearch/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export const AppendMobileSearch: FC<PropsWithChildren<AppendMobileSearchProps> &
3030
{action}
3131

3232
{isMobile && enableMobileSearch && (
33-
<div className="w-[50px] h-[47px] ml-auto">
34-
<Search scope={scope} variant="expandable" />
33+
<div className="w-[40px] h-[40px] ml-auto">
34+
<Search scope={scope} expandable />
3535
</div>
3636
)}
3737
</div>

src/app/components/PageLayout/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const StyledMain = styled('main')({
2020

2121
export const PageLayout: FC<PropsWithChildren<PageLayoutProps>> = ({ children, mobileFooterAction }) => {
2222
const theme = useTheme()
23-
const { isMobile, isTablet } = useScreenSize()
23+
const { isMobile } = useScreenSize()
2424
const scope = useScopeParam()
2525
const isApiReachable = useIsApiReachable(scope?.network ?? 'mainnet').reachable
2626

@@ -62,7 +62,7 @@ export const PageLayout: FC<PropsWithChildren<PageLayoutProps>> = ({ children, m
6262
mb: 6,
6363
}}
6464
>
65-
<Search scope={scope} variant={isTablet ? 'icon' : 'button'} disabled={!isApiReachable} />
65+
<Search scope={scope} disabled={!isApiReachable} />
6666
</Box>
6767
)}
6868
<StyledMain>{children}</StyledMain>

src/app/components/Search/SearchSuggestionsButtons.tsx

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,47 @@ export const SearchSuggestionsButtons: FC<Props> = ({ scope, onClickSuggestion }
4141
const defaultComponents = {
4242
OptionalBreak: <OptionalBreak />,
4343
BlockIcon: <WidgetsIcon sx={{ fontSize: '18px' }} />,
44-
BlockLink: <SuggestionButton onClick={() => onClickSuggestion(suggestedBlock)} />,
44+
BlockLink: (
45+
<SuggestionButton
46+
onClick={() => onClickSuggestion(suggestedBlock)}
47+
onMouseDown={e => e.preventDefault()}
48+
/>
49+
),
4550
TransactionIcon: <RepeatIcon sx={{ fontSize: '18px' }} />,
46-
TransactionLink: <SuggestionButton onClick={() => onClickSuggestion(suggestedTransaction)} />,
51+
TransactionLink: (
52+
<SuggestionButton
53+
onClick={() => onClickSuggestion(suggestedTransaction)}
54+
onMouseDown={e => e.preventDefault()}
55+
/>
56+
),
4757
AccountIcon: <AccountBalanceWalletIcon sx={{ fontSize: '18px' }} />,
48-
AccountLink: <SuggestionButton onClick={() => onClickSuggestion(suggestedAccount)} />,
58+
AccountLink: (
59+
<SuggestionButton
60+
onClick={() => onClickSuggestion(suggestedAccount)}
61+
onMouseDown={e => e.preventDefault()}
62+
/>
63+
),
4964
}
5065
const runtimeComponents = {
5166
...defaultComponents,
5267
TokenIcon: <TokenIcon sx={{ fontSize: '18px' }} />,
53-
TokenLink: <SuggestionButton onClick={() => onClickSuggestion(suggestedTokenFragment)} />,
68+
TokenLink: (
69+
<SuggestionButton
70+
onClick={() => onClickSuggestion(suggestedTokenFragment)}
71+
onMouseDown={e => e.preventDefault()}
72+
/>
73+
),
5474
}
5575

5676
return (
57-
<span>
58-
<span className="text-gray-800 text-xs">
59-
<Trans
60-
t={t}
61-
i18nKey={
62-
scope?.layer === 'consensus'
63-
? 'search.searchSuggestionsForConsensus'
64-
: 'search.searchSuggestionsForRuntime'
65-
}
66-
components={scope?.layer === 'consensus' ? defaultComponents : runtimeComponents}
67-
/>
68-
</span>
69-
</span>
77+
<Trans
78+
t={t}
79+
i18nKey={
80+
scope?.layer === 'consensus'
81+
? 'search.searchSuggestionsForConsensus'
82+
: 'search.searchSuggestionsForRuntime'
83+
}
84+
components={scope?.layer === 'consensus' ? defaultComponents : runtimeComponents}
85+
/>
7086
)
7187
}

src/app/components/Search/TableSearchBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const TableSearchBar: FC<TableSearchBarProps> = ({
3636
<SearchInput
3737
className={className}
3838
autoFocus={autoFocus}
39-
hint={warning}
39+
warning={warning}
4040
onChange={onChange}
4141
onKeyDown={handleKeyPress}
4242
placeholder={placeholder}

0 commit comments

Comments
 (0)