Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrvvu committed Dec 16, 2024
1 parent 1540836 commit 9748840
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
11 changes: 5 additions & 6 deletions src/components/message/Message.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ export const styles = {
p: '8px 16px'
}),
findMessageCard: (isMyMessage: boolean, isFiltered: boolean) => {
let backgroundColor
const basicShade = isMyMessage ? 'turquoiseDark' : 'turquoiseChat'
const primaryShade = isMyMessage ? 500 : 100

if (isFiltered) {
backgroundColor = `basic.${isMyMessage ? 'turquoiseDark' : 'turquoiseChat'}`
} else {
backgroundColor = `primary.${isMyMessage ? 500 : 100}`
}
const backgroundColor = isFiltered
? `basic.${basicShade}`
: `primary.${primaryShade}`

return { backgroundColor }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ const OfferFilterList: FC<OfferFilterListProps> = ({
const handleFilterChange = (key: keyof FindOffersFilters) => () =>
updateFilterByKey(key)

const getOptionLabelForLanguage = (option: LanguageFilter | null): string => {
return option?.trim() ? option : t('common.languages.allLanguages')
}

const languagesFilter = (
<Box>
<AppAutoComplete
getOptionLabel={(option: LanguageFilter) =>
option?.trim() ? option : t('common.languages.allLanguages')
}
getOptionLabel={getOptionLabelForLanguage}
onChange={handleLanguagesChange}
options={languageValues}
value={filters.language}
Expand Down
6 changes: 3 additions & 3 deletions src/pages/find-offers/FindOffers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const FindOffers = () => {
})
}

const renderOffersContent = () => {
const offersContent = useMemo(() => {
if (offersLoading) {
return <Loader pageLoad />
}
Expand All @@ -165,7 +165,7 @@ const FindOffers = () => {
viewMode={cardsView}
/>
)
}
}, [offersLoading, items, updateInfo, cardsView, t])

return (
<PageWrapper>
Expand Down Expand Up @@ -215,7 +215,7 @@ const FindOffers = () => {
price={price}
/>
</AppDrawer>
{renderOffersContent()}
{offersContent}
</Box>
<AppPagination
onChange={handlePageChange}
Expand Down

0 comments on commit 9748840

Please sign in to comment.