-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:blockscout/frontend into address-en…
…tity
- Loading branch information
Showing
17 changed files
with
222 additions
and
38 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import xss from 'xss'; | ||
|
||
import escapeRegExp from 'lib/escapeRegExp'; | ||
|
||
export default function highlightText(text: string, query: string) { | ||
const regex = new RegExp('(' + escapeRegExp(query) + ')', 'gi'); | ||
return text.replace(regex, '<mark>$1</mark>'); | ||
return xss(text.replace(regex, '<mark>$1</mark>')); | ||
} |
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import type { SystemStyleObject } from '@chakra-ui/react'; | ||
import { Text, useColorModeValue } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
const COUNTER_OVERLOAD = 50; | ||
|
||
type Props = { | ||
count?: number; | ||
parentClassName: string; | ||
} | ||
|
||
const TasCounter = ({ count, parentClassName }: Props) => { | ||
|
||
const zeroCountColor = useColorModeValue('blackAlpha.400', 'whiteAlpha.400'); | ||
|
||
if (count === undefined) { | ||
return null; | ||
} | ||
|
||
const sx: SystemStyleObject = { | ||
[`.${ parentClassName }:hover &`]: { color: 'inherit' }, | ||
}; | ||
|
||
return ( | ||
<Text | ||
color={ count > 0 ? 'text_secondary' : zeroCountColor } | ||
ml={ 1 } | ||
sx={ sx } | ||
transitionProperty="color" | ||
transitionDuration="normal" | ||
transitionTimingFunction="ease" | ||
> | ||
{ count > COUNTER_OVERLOAD ? `${ COUNTER_OVERLOAD }+` : count } | ||
</Text> | ||
); | ||
}; | ||
|
||
export default TasCounter; |
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
Oops, something went wrong.