lodash APIs
- cloneDeep
- get
- isEqual
- isEmpty
- debounce
- merge
- uniq
- omit
- isString
- isArray
- pick
- sortBy
- groupBy
- flatten
- set
- find
- orderBy
- mapValues
- isObject
- last
- isNil
- isNumber
- range
- chunk
- throttle
- filter
- uniqBy
- difference
- pickBy
- noop
- capitalize
- uniqueId
- has
- isUndefined
- map
- camelCase
- isFunction
- kebabCase
- intersection
- random
- includes
- isPlainObject
- compact
- Dictionary
- findIndex
- keyBy
- forEach
- trim
- clamp
- identity
- remove
- keys
- isNull
- times
- startCase
- first
- values
- mapKeys
- sumBy
- max
- reduce
- some
- zip
- every
- memoize
- clone
- countBy
- concat
- snakeCase
- assign
- isBoolean
- uniqWith
- omitBy
- without
- minBy
- head
- maxBy
- min
- upperFirst
- escapeRegExp
- reverse
- sample
- shuffle
- defaults
- inRange
- flattenDeep
- take
- union
- sum
- mergeWith
- castArray
- replace
- flatMap
- reject
- zipObject
- template
- isNaN
- mean
- size
- findLast
- unset
- partition
- round
- fromPairs
- floor
- toPairs
- indexOf
- toString
- sampleSize
- differenceBy
- update
- chain
- startsWith
- xor
- pull
- DebouncedFunc
- defaultsDeep
- split
- findKey
- unescape
- partial
- toNumber
- invert
- each
- differenceWith
- endsWith
- slice
- isDate
- unionBy
- findLastIndex
- join
- isInteger
- delay
- isObjectLike
- padStart
- result
- isError
- extend
- cloneDeepWith
- upperCase
- trimStart
- constant
- matches
- lowerCase
- forIn
- lowerFirst
- once
- transform
- isMatch
- escape
- isEqualWith
- zipWith
- isRegExp
- entries
- sortedIndexBy
- dropWhile
- takeWhile
- isElement
- forEachRight
- ReplaceFunction
- TemplateExecutor
- keysIn
- IsEqualCustomizer
- isTypedArray
- cond
- stubTrue
- toUpper
- isMap
- isSet
- meanBy
- rangeRight
- repeat
- trimEnd
- now
- nth
- pullAt
- toPath
- eq
- lt
- lte
- gt
- gte
- pullAllBy
- pullAll
- toLower
- fill
- ceil
- flatMapDeep
- CloneDeepWithCustomizer
- negate
- takeRightWhile
- invoke
- tap
- intersectionWith
- truncate
- Collection
- bind
- curry
- partialRight
- sortedUniq
- sortedIndexOf
- Object
- drop
- _
Other Related APIs
- lodash#sumBy
- next/router#useRouter
- @mui/material#Box
- @mui/material#Button
- @mui/material#CardActionArea
- @mui/material#CardContent
- @mui/material#CircularProgress
- @mui/material#Typography
- @mui/material#useMediaQuery
- @mui/material#CardActions
- @mui/material#Grid
- @mui/material#CardMedia
- @mui/material#Card
- @mui/material/styles#styled
lodash#truncate TypeScript Examples
The following examples show how to use
lodash#truncate.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DonationTab.tsx From frontend with MIT License | 4 votes |
export default function DonationTab() {
const router = useRouter()
const { t } = useTranslation()
const matches = useMediaQuery(theme.breakpoints.down('md'))
const { data: user } = getCurrentPerson(!!router.query?.register)
if (router.query?.register) {
delete router.query.register
router.replace({ pathname: router.pathname, query: router.query }, undefined, { shallow: true })
}
const { data: userDonations, isLoading: isUserDonationLoading } = useUserDonations()
const { data: campaigns, isLoading: isCampaignLoading } = useCampaignList()
return (
<StyledProfileTab name={ProfileTabs.donations}>
<Typography className={classes.h1}>{user?.user ? user.user.firstName + ',' : ''}</Typography>
<Typography variant="h5" fontWeight={'medium'}>
{t('profile:donations.helpThanks')} ❤️
</Typography>
<Grid
container
spacing={theme.spacing(2)}
marginTop={theme.spacing(1)}
alignItems={'flex-end'}>
<Grid order={matches ? 3 : 1} item xs={12} md={4}>
<Card>
{!isCampaignLoading && campaigns ? (
<CardActionArea>
<CardMedia
component="img"
height="193"
image={campaignListPictureUrl(campaigns[0])}
alt={campaigns[0].title}
/>
<CardContent>
<Typography gutterBottom variant="h5" component="div">
{campaigns[0].title}
</Typography>
<Typography variant="body2" color="text.secondary">
{truncate(campaigns[0].description, { length: 120 })}
</Typography>
</CardContent>
</CardActionArea>
) : (
<CircularProgress />
)}
<CardActions>
<Button variant="contained" size="medium" color="secondary">
{t('profile:donations.donateNow')} ❤️
</Button>
</CardActions>
</Card>
</Grid>
<Grid order={matches ? 1 : 2} item xs={12} md={8}>
{!isUserDonationLoading && userDonations ? (
<Card className={classes.donationsBox}>
<Box className={classes.donationsBoxRow}>
<Typography fontWeight="medium" variant="h5">
{t('profile:donations.totalDonations')}
</Typography>
<Typography fontWeight="medium" variant="h5">
{money(userDonations.total)}
</Typography>
</Box>
<Box className={classes.donationsBoxRow}>
<Box>
<Typography variant="h5">{t('profile:donations.recurringDonations')}</Typography>
{/* TODO: Use date-fns to format and localize the months,
that the user has recurring donations when that is possible */}
{/* <Typography>Я, Ф, М, А 2022</Typography> */}
</Box>
<Typography fontWeight="medium" variant="h5">
{money(sumBy(userDonations.donations, 'amount'))}
</Typography>
</Box>
<Box className={classes.donationsBoxRow}>
<Typography variant="h5">{t('profile:donations.cardDonations')}</Typography>
<Typography fontWeight="medium" variant="h5">
{money(userDonations.total)}
</Typography>
</Box>
<Box className={classes.donationsBoxRow}>
<Typography variant="h5">{t('profile:donations.bankDonations')}</Typography>
<Typography fontWeight="medium" variant="h5">
{money(userDonations.total)}
</Typography>
</Box>
</Card>
) : (
<CircularProgress />
)}
</Grid>
<Grid order={matches ? 2 : 3} item xs={12}>
<DonationTable donations={userDonations?.donations} />
</Grid>
</Grid>
</StyledProfileTab>
)
}