@woosmap/ui 4.251.8 → 4.251.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
function NotificationBadge({ count, max }) {
|
|
5
|
+
if (!count || count <= 0) return null;
|
|
6
|
+
const label = count > max ? `${max}+` : String(count);
|
|
7
|
+
return <span className="notification-badge">{label}</span>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
NotificationBadge.propTypes = {
|
|
11
|
+
count: PropTypes.number.isRequired,
|
|
12
|
+
max: PropTypes.number,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
NotificationBadge.defaultProps = {
|
|
16
|
+
max: 99,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default NotificationBadge;
|
package/src/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export { default as UseCase } from './components/UseCase/UseCase';
|
|
|
24
24
|
export { default as LocalitiesAutocomplete } from './components/Woosmap/LocalitiesAutocomplete';
|
|
25
25
|
export { default as AddressAutocomplete } from './components/Woosmap/AddressAutocomplete';
|
|
26
26
|
export { default as Modal } from './components/Modal/Modal';
|
|
27
|
+
export { default as NotificationBadge } from './components/NotificationBadge/NotificationBadge';
|
|
27
28
|
export { default as ConfirmationModal } from './components/Modal/ConfirmationModal';
|
|
28
29
|
export { default as Panel } from './components/Panel/Panel';
|
|
29
30
|
export { default as PasswordStrengthBar } from './components/PasswordStrengthBar/PasswordStrengthBar';
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
.notification-badge
|
|
2
|
+
position absolute
|
|
3
|
+
top -.5rem
|
|
4
|
+
right -.5rem
|
|
5
|
+
min-width 1.6rem
|
|
6
|
+
height 1.6rem
|
|
7
|
+
padding 0 .4rem
|
|
8
|
+
border-radius 1rem
|
|
9
|
+
background $error
|
|
10
|
+
color #fff
|
|
11
|
+
font-size 1rem
|
|
12
|
+
font-weight 700
|
|
13
|
+
line-height 1.6rem
|
|
14
|
+
text-align center
|
|
15
|
+
white-space nowrap
|
|
16
|
+
pointer-events none
|
|
17
|
+
z-index 1
|
|
18
|
+
|
|
1
19
|
.badge
|
|
2
20
|
br(50)
|
|
3
21
|
sq(1.4)
|