Skip to content

Commit e47b168

Browse files
cooper-joeBRaimbaultjenniferarnesen
authored
fix(dimensions-panel): prevent movement of content in dimension item on hover [DHIS2-19046] (#1762)
Implements DHIS2-19046 This PR fixes issues displaying multiline content in the DimensionsItem shown in DimensionsPanel. Movement of content on hover is prevented. The OptionsButton and LockIcon now span full height. Co-authored-by: Bruno Raimbault <[email protected]> Co-authored-by: Jen Jones Arnesen <[email protected]>
1 parent df9b6fc commit e47b168

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

src/__demo__/DimensionsPanel.stories.js

+34-3
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,19 @@ const fixedDimensions = [
2424
const dynamicDimensions = [
2525
{
2626
id: '0000001',
27-
name: 'One',
27+
name: 'Dietary diversity score based on variety of consumed food groups over a weekly period',
2828
},
2929
{
3030
id: '0000002',
31-
name: 'Two',
31+
name: 'Healthcare services access and utilization frequency including preventive check-ups and specialist care',
3232
},
3333
{
3434
id: '0000003',
35-
name: 'Three',
35+
name: 'Sleep quality index incorporating duration, time to sleep, frequency of awakenings, and restfulness',
36+
},
37+
{
38+
id: '0000004',
39+
name: 'Malaria incidence rate',
3640
},
3741
]
3842

@@ -156,3 +160,30 @@ export const WithMenu = () => {
156160
WithMenu.story = {
157161
name: 'with menu',
158162
}
163+
164+
export const TextWrapping = () => {
165+
return (
166+
<div
167+
style={{
168+
width: '260px',
169+
height: '400px',
170+
borderInlineEnd: '1px dotted #CCC',
171+
resize: 'both',
172+
overflow: 'auto',
173+
}}
174+
>
175+
<DimensionsPanel
176+
dimensions={[...fixedDimensions, ...dynamicDimensions]}
177+
onDimensionClick={onDimensionClick}
178+
onDimensionOptionsClick={() => alert('options click')}
179+
recommendedDimension={(dimension) => dimension === '0000002'}
180+
lockedDimension={(dimension) => dimension === '0000003'}
181+
selectedIds={['0000003', '0000002']}
182+
/>
183+
</div>
184+
)
185+
}
186+
187+
TextWrapping.story = {
188+
name: 'text wrapping',
189+
}

src/components/DimensionsPanel/List/OptionsButton.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const OptionsButton = ({ onClick }) => (
1313
display: flex;
1414
align-items: center;
1515
justify-content: center;
16-
height: 20px;
16+
height: 100%;
1717
width: 20px;
1818
padding: 0;
1919
border: none;
@@ -24,8 +24,10 @@ const OptionsButton = ({ onClick }) => (
2424
border-bottom-left-radius: 2px;
2525
}
2626
button:hover {
27-
background-color: rgba(0, 0, 0, 0.09);
27+
background-color: rgba(33, 41, 52, 0.08);
2828
}
29+
button:active {
30+
background-color: rgba(33, 41, 52, 0.13);
2931
`}
3032
</style>
3133
</>

src/components/DimensionsPanel/List/styles/DimensionItem.style.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default css`
77
background-color: transparent;
88
fill: ${colors.grey800};
99
display: flex;
10+
gap: 4px;
1011
outline: none;
1112
justify-content: space-between;
1213
padding: 0 0 0 4px;
@@ -28,12 +29,13 @@ export default css`
2829
}
2930
.labelWrapper {
3031
display: flex;
31-
align-items: center;
32+
padding: 2px 0;
3233
}
3334
.labelText {
3435
font-size: 13px;
3536
line-height: 15px;
3637
margin-top: 1px;
38+
align-self: center;
3739
}
3840
3941
.iconWrapper {
@@ -63,7 +65,8 @@ export default css`
6365
6466
.optionsWrapper {
6567
width: 20px;
66-
height: 20px;
68+
flex-shrink: 0;
69+
align-self: stretch;
6770
}
6871
6972
.lockWrapper svg path {
@@ -72,7 +75,7 @@ export default css`
7275
7376
.lockWrapper {
7477
background: ${colors.grey300};
75-
height: 20px;
78+
align-self: stretch;
7679
padding: 0 2px 0 3px;
7780
display: flex;
7881
align-items: center;

0 commit comments

Comments
 (0)