Skip to content

Commit

Permalink
fix lateral padding in chips lists and better naming for useState
Browse files Browse the repository at this point in the history
  • Loading branch information
vmilan committed Jun 15, 2023
1 parent fd143f1 commit 42e895c
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Box, Chip, List, ListItem, Tooltip, styled } from '@mui/material';
import PropTypes from 'prop-types';
import React, { useState } from 'react';

const ChipList = styled(List)(({ theme: { spacing } }) => ({
const ChipList = styled(List)(({ theme }) => ({
display: 'flex',
alignItems: 'center',
margin: 0,
marginLeft: theme.spacing(1.5),
padding: 0,
overflowX: 'auto',
maxWidth: '100%',
Expand Down Expand Up @@ -59,7 +59,7 @@ function FeatureSelectionUIGeometryChips({
return chipLabel || feature.properties?.name || `${type} ${index + 1}`;
}

const [onMouseElement, setOnMouseElement] = useState(false);
const [showDeleteTooltip, setShowDeleteTooltip] = useState(false);

return (
<Box sx={{ overflowX: 'auto' }}>
Expand All @@ -68,7 +68,7 @@ function FeatureSelectionUIGeometryChips({
const isDisabled = geometry.properties?.disabled;
const tooltipText = isDisabled
? disabledChipTooltip || chipTooltip
: onMouseElement
: showDeleteTooltip
? 'Remove'
: chipTooltip;

Expand All @@ -89,8 +89,8 @@ function FeatureSelectionUIGeometryChips({
}
deleteIcon={
<Cancel
onMouseEnter={() => setOnMouseElement(true)}
onMouseLeave={() => setOnMouseElement(false)}
onMouseEnter={() => setShowDeleteTooltip(true)}
onMouseLeave={() => setShowDeleteTooltip(false)}
/>
}
/>
Expand Down

0 comments on commit 42e895c

Please sign in to comment.