Skip to content

Commit

Permalink
fix: The last ItemRow must not have a Divider
Browse files Browse the repository at this point in the history
  • Loading branch information
Merkur39 committed Sep 11, 2023
1 parent ad5cc6b commit 0525a4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions react/NestedSelect/ItemRow.jsx
Expand Up @@ -12,7 +12,7 @@ import Typography from '../Typography'

const infoStyle = { color: 'var(--secondaryTextColor)' }

const ItemRow = ({ item, onClick, isSelected, radioPosition }) => {
const ItemRow = ({ item, onClick, isSelected, radioPosition, isLast }) => {
const { isDesktop } = useBreakpoints()

return (
Expand Down Expand Up @@ -68,7 +68,7 @@ const ItemRow = ({ item, onClick, isSelected, radioPosition }) => {
? item.action.Component({ item, ...item.action.props })
: null}
</ListItem>
<Divider />
{!isLast && <Divider />}
</>
)
}
Expand Down
6 changes: 4 additions & 2 deletions react/NestedSelect/NestedSelect.jsx
Expand Up @@ -138,24 +138,26 @@ class NestedSelect extends Component {
{searchOptions.noDataLabel}
</Typography>
) : (
searchResult.map(item => (
searchResult.map((item, index) => (
<ItemRow
radioPosition={radioPosition}
key={item.key || item.title}
item={item}
onClick={this.handleClickItem}
isSelected={isSelectedWithLevel(item)}
isLast={index === searchResult.length - 1}
/>
))
)
) : (
children.map(item => (
children.map((item, index) => (
<ItemRow
radioPosition={radioPosition}
key={item.key || item.title}
item={item}
onClick={this.handleClickItem}
isSelected={isSelectedWithLevel(item)}
isLast={index === children.length - 1}
/>
))
)}
Expand Down

0 comments on commit 0525a4c

Please sign in to comment.