Commit aedc0206 authored by eddie's avatar eddie Committed by GitHub

fix: use render function for SearchBar placeholder translation (#5710)

* fix: use render function for SearchBar placeholder translation

* fix: use render function for SearchBar placeholder translation

* fix: correct clsx usage
parent fd808572
// eslint-disable-next-line no-restricted-imports // eslint-disable-next-line no-restricted-imports
import { t } from '@lingui/macro' import { t, Trans } from '@lingui/macro'
import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics' import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics'
import { BrowserEvent, ElementName, EventName, SectionName } from '@uniswap/analytics-events' import { BrowserEvent, ElementName, EventName, SectionName } from '@uniswap/analytics-events'
import clsx from 'clsx' import clsx from 'clsx'
...@@ -156,9 +156,9 @@ export const SearchBar = () => { ...@@ -156,9 +156,9 @@ export const SearchBar = () => {
> >
<Row <Row
className={clsx( className={clsx(
` ${styles.nftSearchBar} ${!isOpen && !isMobile && magicalGradientOnHover} ${ styles.nftSearchBar,
!isOpen && !isMobile && magicalGradientOnHover,
isMobileOrTablet && (isOpen ? styles.visible : styles.hidden) isMobileOrTablet && (isOpen ? styles.visible : styles.hidden)
} `
)} )}
borderRadius={isOpen || isMobileOrTablet ? undefined : '12'} borderRadius={isOpen || isMobileOrTablet ? undefined : '12'}
borderTopRightRadius={isOpen && !isMobile ? '12' : undefined} borderTopRightRadius={isOpen && !isMobile ? '12' : undefined}
...@@ -182,9 +182,12 @@ export const SearchBar = () => { ...@@ -182,9 +182,12 @@ export const SearchBar = () => {
element={ElementName.NAVBAR_SEARCH_INPUT} element={ElementName.NAVBAR_SEARCH_INPUT}
properties={{ ...trace }} properties={{ ...trace }}
> >
<Trans
id={placeholderText}
render={({ translation }) => (
<Box <Box
as="input" as="input"
placeholder={placeholderText} placeholder={translation as string}
onChange={(event: ChangeEvent<HTMLInputElement>) => { onChange={(event: ChangeEvent<HTMLInputElement>) => {
!isOpen && toggleOpen() !isOpen && toggleOpen()
setSearchValue(event.target.value) setSearchValue(event.target.value)
...@@ -195,6 +198,8 @@ export const SearchBar = () => { ...@@ -195,6 +198,8 @@ export const SearchBar = () => {
ref={inputRef} ref={inputRef}
width="full" width="full"
/> />
)}
/>
</TraceEvent> </TraceEvent>
{!isOpen && <KeyShortCut>/</KeyShortCut>} {!isOpen && <KeyShortCut>/</KeyShortCut>}
</Row> </Row>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment