Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99973295
useBadge.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 27, 13:16
Size
727 B
Mime Type
text/x-java
Expires
Wed, Jan 29, 13:16 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23813939
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useBadge.js
View Options
import { usePreviousProps } from '@mui/utils';
export default function useBadge(parameters) {
const {
badgeContent: badgeContentProp,
invisible: invisibleProp = false,
max: maxProp = 99,
showZero = false
} = parameters;
const prevProps = usePreviousProps({
badgeContent: badgeContentProp,
max: maxProp
});
let invisible = invisibleProp;
if (invisibleProp === false && badgeContentProp === 0 && !showZero) {
invisible = true;
}
const {
badgeContent,
max = maxProp
} = invisible ? prevProps : parameters;
const displayValue = badgeContent && Number(badgeContent) > max ? `${max}+` : badgeContent;
return {
badgeContent,
invisible,
max,
displayValue
};
}
Event Timeline
Log In to Comment