-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(explorer): use proper layout for no results found
- Loading branch information
Showing
3 changed files
with
19 additions
and
22 deletions.
There are no files selected for viewing
28 changes: 9 additions & 19 deletions
28
packages/apps/explorer/src/components/Search/NoSearchResults/NoSearchResults.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,35 @@ | ||
import { Heading, Stack } from '@kadena/kode-ui'; | ||
import { Heading, Text } from '@kadena/kode-ui'; | ||
import type { FC } from 'react'; | ||
import React from 'react'; | ||
|
||
interface NoSearchResultsProps { | ||
interface INoSearchResultsProps { | ||
type?: 'requestKey' | 'accountName' | 'blockhash'; | ||
value?: string; | ||
} | ||
|
||
export const NoSearchResults: FC<NoSearchResultsProps> = ({ type, value }) => { | ||
export const NoSearchResults: FC<INoSearchResultsProps> = ({ type, value }) => { | ||
// TODO: add buttons to navigate to other networks testnet/mainnet | ||
// Use url from router to query other networks to see if the search result is | ||
// there | ||
|
||
switch (true) { | ||
case type === 'requestKey' && value !== undefined: | ||
return ( | ||
<Stack justifyContent="center" width="100%"> | ||
<Heading as="h3">No search results for request key: {value}</Heading> | ||
</Stack> | ||
<Heading as="h3">No search results for request key: {value}</Heading> | ||
); | ||
|
||
case type === 'accountName' && value !== undefined: | ||
return ( | ||
<Stack justifyContent="center" flexDirection={'column'} width="100%"> | ||
<> | ||
<Heading as="h3">No search results for account: {value}</Heading> | ||
<Heading as="h4">Please check the account name and try again</Heading> | ||
</Stack> | ||
<Text>Please check the network and account name and try again</Text> | ||
</> | ||
); | ||
|
||
case type === 'blockhash' && value !== undefined: | ||
return ( | ||
<Stack justifyContent="center" width="100%"> | ||
<Heading as="h3">No search results for block: {value}</Heading> | ||
</Stack> | ||
); | ||
return <Heading as="h3">No search results for block: {value}</Heading>; | ||
|
||
default: | ||
return ( | ||
<Stack justifyContent="center" width="100%"> | ||
<Heading as="h3">No search results</Heading> | ||
</Stack> | ||
); | ||
return <Heading as="h3">No search results</Heading>; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters