Skip to content

Commit 14fffff

Browse files
authored
Merge pull request #226 from dxc-technology/jsuarezgonz-accordion
[Patch] Fix for #171 Accordion assistive text
2 parents ec3ed57 + 041be87 commit 14fffff

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

docs/src/pages/components/Components.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function Components() {
9595
</SideNavContainer>
9696
</DxcApplicationLayout.SideNav>
9797
<DxcApplicationLayout.Main>
98-
<SideNavContent>
98+
<MainContent>
9999
<Route exact path="/components">
100100
<ComponentDoc>
101101
<DxcHeading
@@ -138,7 +138,7 @@ function Components() {
138138
<path.component></path.component>
139139
</Route>
140140
))}
141-
</SideNavContent>
141+
</MainContent>
142142
</DxcApplicationLayout.Main>
143143
<DxcApplicationLayout.Footer>
144144
<DxcFooter
@@ -157,9 +157,8 @@ function Components() {
157157
const SideNavContainer = styled.div`
158158
margin-bottom: 40px;
159159
`;
160-
const SideNavContent = styled.div`
161-
display: flex;
162-
flex-grow: 1;
160+
const MainContent = styled.div`
161+
163162
height: 100%;
164163
min-height: 100vh;
165164
`;

lib/src/accordion/Accordion.jsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const DxcAccordion = ({
7676
iconSrc && <AccordionIcon src={iconSrc} />
7777
)}
7878
</AccordionInfo>
79-
<AccordionAssistiveText>{assistiveText}</AccordionAssistiveText>
79+
{assistiveText && <AccordionAssistiveText>{assistiveText}</AccordionAssistiveText>}
8080
</ExpansionPanelSummary>
8181
<ExpansionPanelDetails>
8282
<AccordionText>{children}</AccordionText>
@@ -119,8 +119,8 @@ DxcAccordion.propTypes = {
119119
PropTypes.oneOf([...Object.keys(spaces)]),
120120
]),
121121
};
122-
123122
const DXCAccordion = styled.div`
123+
display: flex;
124124
min-width: 280px;
125125
margin: ${(props) => (props.margin && typeof props.margin !== "object" ? spaces[props.margin] : "0px")};
126126
margin-top: ${(props) =>
@@ -137,11 +137,13 @@ const DXCAccordion = styled.div`
137137
font-family: "Open Sans", sans-serif;
138138
cursor: ${(props) => (props.disabled && "not-allowed") || "pointer"};
139139
.MuiPaper-root {
140+
min-width: 0;
141+
display: flex;
140142
left: 85px;
141143
background-color: ${(props) => props.theme.backgroundColor} !important;
142144
color: ${(props) => props.theme.fontColor};
143145
box-shadow: 0px 6px 10px #00000024;
144-
display: block;
146+
145147
position: static;
146148
width: 100%;
147149
border-radius: 4px;
@@ -150,7 +152,10 @@ const DXCAccordion = styled.div`
150152
border-radius: 4px;
151153
color: "#000000";
152154
}
153-
155+
&.MuiExpansionPanel-root {
156+
display: flex;
157+
flex-direction: column;
158+
}
154159
.MuiButtonBase-root.MuiExpansionPanelSummary-root {
155160
:hover {
156161
background-color: ${(props) => `${props.theme.hoverBackgroundColor}`};
@@ -175,6 +180,7 @@ const DXCAccordion = styled.div`
175180
176181
.MuiExpansionPanelSummary-content {
177182
padding-right: 24px;
183+
min-width: 0;
178184
&.Mui-expanded {
179185
div:nth-child(2) {
180186
opacity: 1;
@@ -242,13 +248,10 @@ const AccordionInfo = styled.div`
242248
display: flex;
243249
flex-direction: row-reverse;
244250
align-items: center;
245-
flex-grow: 1;
246-
margin-right: 15px;
251+
margin-right: 48px;
247252
`;
248253

249-
const AccordionLabel = styled.div`
250-
flex-grow: 1;
251-
`;
254+
const AccordionLabel = styled.div``;
252255

253256
const AccordionText = styled.div`
254257
width: 100%;
@@ -259,6 +262,12 @@ const AccordionAssistiveText = styled.div`
259262
font-size: 14px;
260263
font: italic normal 300 16px/22px Open Sans;
261264
letter-spacing: 0.49px;
265+
flex: 1;
266+
white-space: nowrap;
267+
overflow: hidden;
268+
text-overflow: ellipsis;
269+
min-width: 100px;
270+
text-align: end;
262271
`;
263272

264273
const IconContainer = styled.div`

lib/src/layout/ApplicationLayout.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ const ContentContainer = styled.div`
211211

212212
const MainBodyContainer = styled.div`
213213
width: 100%;
214+
min-width:0;
214215
display: flex;
215216
flex-direction: column;
216217
`;

0 commit comments

Comments
 (0)