Skip to content

Commit

Permalink
[Snyk] Security upgrade postcss from 8.4.27 to 8.4.31 (#1416)
Browse files Browse the repository at this point in the history
* fix: packages/synapse-interface/package.json to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-POSTCSS-5926692

* Add disabled prop to FilterInput

* Ensure search input is disabled until app successfully mounts

* Add border opacity when not mounted

---------

Co-authored-by: snyk-bot <[email protected]>
Co-authored-by: Jonah Lin <[email protected]>
  • Loading branch information
3 people authored Oct 10, 2023
1 parent 59aac3f commit 9c5bbc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/synapse-interface/components/Portfolio/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ export const SearchBar = () => {
searchedBalancesAndAllowances,
}: PortfolioState = usePortfolioState()

const [mounted, setMounted] = useState<boolean>(false)
const [isFocused, setIsFocused] = useState<boolean>(false)
const isActive: boolean = searchInput !== portfolioInitialState.searchInput

useEffect(() => {
setMounted(true)
}, [])

useEffect(() => {
const handleFocus = () => setIsFocused(true)
const handleBlur = () => setIsFocused(false)
Expand Down Expand Up @@ -96,6 +101,7 @@ export const SearchBar = () => {
className={`
relative flex items-center ml-auto
border rounded-xl
${!mounted && 'border-opacity-30'}
${
isFocused || isActive
? 'border-synapsePurple bg-tint'
Expand All @@ -107,6 +113,7 @@ export const SearchBar = () => {
placeholder={placeholder}
searchStr={searchInput}
onSearch={onSearchInput}
disabled={mounted ? false : true}
/>
<ClearSearchButton show={isActive} onClick={clearSearchInput} />
</div>
Expand All @@ -117,13 +124,16 @@ export default function FilterInput({
searchStr,
onSearch,
placeholder,
disabled = false,
}: {
searchStr: string
onSearch: (str: string) => void
placeholder: string
disabled: boolean
}) {
return (
<input
disabled={disabled}
ref={inputRef}
tabIndex={0}
data-test-id="filter-input"
Expand All @@ -134,6 +144,7 @@ export default function FilterInput({
placeholder-white placeholder-opacity-40
border-transparent outline-none ring-0
focus:outline-none focus:ring-0 focus:border-transparent
${disabled && 'opacity-30'}
`}
placeholder={placeholder}
onChange={(e) => onSearch(e.target.value)}
Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"lodash.debounce": "^4.0.8",
"next": "13.3.0",
"numeral": "^2.0.6",
"postcss": "^8.4.21",
"postcss": "^8.4.31",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-ga": "^3.3.1",
Expand Down

0 comments on commit 9c5bbc1

Please sign in to comment.