Skip to content

Commit

Permalink
Merge pull request #600 from SUI-Components/feature/XCOMP-9946/remove…
Browse files Browse the repository at this point in the history
…-counter-in-badge-user
  • Loading branch information
andresin87 committed Jul 5, 2023
2 parents 56ebe91 + e207bcf commit 5ac75e9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/dropdown/user/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@s-ui/react-dropdown-user",
"version": "1.38.0",
"version": "2.0.0",
"description": "SUI Dropdown User",
"main": "lib/index.js",
"scripts": {
Expand Down
19 changes: 11 additions & 8 deletions components/dropdown/user/src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/* eslint-disable react/prop-types */
import {useReducer} from 'react'

import cx from 'classnames'
import PropTypes from 'prop-types'

import cx from 'classnames'
import MoleculeBadgeCounter, {
moleculeBadgeCounterSizes
} from '@s-ui/react-molecule-badge-counter'

import {reducer, reducerActions, reducerInitialState} from './reducer'
import {reducerActions, reducerInitialState, reducer} from './reducer'

const DropdownUser = ({
expandOnMouseOver = false,
Expand All @@ -19,7 +17,8 @@ const DropdownUser = ({
),
menu,
hasNotifications = menu.some(({notifications}) => Boolean(notifications)),
user
user,
hasBadgeLabel = false
}) => {
const [state, dispatch] = useReducer(reducer, reducerInitialState)

Expand Down Expand Up @@ -63,7 +62,7 @@ const DropdownUser = ({
{hasLinkNotifications && (
<span className="sui-DropdownUserMenu-listNotification">
<MoleculeBadgeCounter
label={notifications}
label={!!hasBadgeLabel && notifications}
size={moleculeBadgeCounterSizes.LARGE}
/>
</span>
Expand Down Expand Up @@ -157,9 +156,13 @@ DropdownUser.propTypes = {
*/
linkFactory: PropTypes.func,
/**
* Hasnotifications to show a badge notification.
* hasnotifications to show a badge notification.
*/
hasNotifications: PropTypes.bool,
/**
* hasBadgeLabel to show a counter in the badge notification.
*/
hasNotifications: PropTypes.bool
hasBadgeLabel: PropTypes.bool
}

export default DropdownUser

0 comments on commit 5ac75e9

Please sign in to comment.