Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120482876
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
Fri, Jul 4, 16:51
Size
727 B
Mime Type
text/x-java
Expires
Sun, Jul 6, 16:51 (2 d)
Engine
blob
Format
Raw Data
Handle
27180889
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