fix: entries label weight, use string utils func instead of custom
This commit is contained in:
parent
893dbd8162
commit
e5ea16d83b
1 changed files with 7 additions and 11 deletions
|
|
@ -1,24 +1,19 @@
|
|||
import { makeStyles } from '@material-ui/core'
|
||||
import * as R from 'ramda'
|
||||
import React from 'react'
|
||||
|
||||
import Chip from 'src/components/Chip'
|
||||
import { ActionButton } from 'src/components/buttons'
|
||||
import { P, Label2 } from 'src/components/typography'
|
||||
import { P, Label3 } from 'src/components/typography'
|
||||
import { ReactComponent as CloseIcon } from 'src/styling/icons/action/close/zodiac.svg'
|
||||
import { ReactComponent as FilterIcon } from 'src/styling/icons/button/filter/white.svg'
|
||||
import { ReactComponent as ReverseFilterIcon } from 'src/styling/icons/button/filter/zodiac.svg'
|
||||
import { onlyFirstToUpper } from 'src/utils/string'
|
||||
|
||||
import { chipStyles, styles } from './SearchFilter.styles'
|
||||
|
||||
const useChipStyles = makeStyles(chipStyles)
|
||||
const useStyles = makeStyles(styles)
|
||||
|
||||
const capitalize = R.converge(R.concat(), [
|
||||
R.compose(R.toUpper, R.head),
|
||||
R.tail
|
||||
])
|
||||
|
||||
const SearchFilter = ({ filters, onFilterDelete, setFilters, entries }) => {
|
||||
const chipClasses = useChipStyles()
|
||||
const classes = useStyles()
|
||||
|
|
@ -32,16 +27,17 @@ const SearchFilter = ({ filters, onFilterDelete, setFilters, entries }) => {
|
|||
<Chip
|
||||
key={idx}
|
||||
classes={chipClasses}
|
||||
label={`${capitalize(f.type)}: ${f.value}`}
|
||||
label={`${onlyFirstToUpper(f.type)}: ${f.value}`}
|
||||
onDelete={() => onFilterDelete(f)}
|
||||
deleteIcon={<CloseIcon className={classes.button} />}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div className={classes.deleteWrapper}>
|
||||
{entries && (
|
||||
<Label2 className={classes.entries}>{`${entries} entries`}</Label2>
|
||||
)}
|
||||
{
|
||||
<Label3 className={classes.entries}>{`${entries ??
|
||||
0} entries`}</Label3>
|
||||
}
|
||||
<ActionButton
|
||||
color="secondary"
|
||||
Icon={ReverseFilterIcon}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue