Skip to content

Commit 944740c

Browse files
authored
fix(collapsible-panel): disabled state fix (#777)
1 parent 2020ff5 commit 944740c

File tree

1 file changed

+50
-45
lines changed

1 file changed

+50
-45
lines changed

src/components/panels/collapsible-panel/header-icon.js

+50-45
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,65 @@ import { css } from '@emotion/core';
44
import { AngleDownIcon, AngleRightIcon } from '../../icons';
55
import vars from '../../../../materials/custom-properties';
66

7-
const sizeIconContainer = '24px';
8-
const sizeIconContainerSmall = '16px';
7+
const sizeIconContainer = '22px';
8+
const sizeIconContainerSmall = '14px';
99

1010
const getArrowTheme = ({ tone, isDisabled }) => {
1111
if (isDisabled) return 'grey';
1212
if (tone === 'urgent') return 'white';
1313
return 'black';
1414
};
1515

16-
const HeaderIcon = props => (
17-
<div
18-
css={[
19-
css`
20-
display: flex;
21-
align-items: center;
22-
justify-content: center;
23-
height: ${props.size === 'small'
24-
? sizeIconContainerSmall
25-
: sizeIconContainer};
26-
width: ${props.size === 'small'
27-
? sizeIconContainerSmall
28-
: sizeIconContainer};
29-
border-radius: 50%;
30-
flex-shrink: 0;
31-
box-shadow: ${vars.shadow7};
32-
background-color: ${props.tone === 'urgent'
33-
? vars.colorWarning
34-
: vars.colorSurface};
35-
`,
36-
props.isDisabled &&
16+
const HeaderIcon = props => {
17+
const backgroundColor =
18+
props.tone === 'urgent' ? vars.colorWarning : vars.colorSurface;
19+
return (
20+
<div
21+
css={[
3722
css`
38-
box-shadow: none;
23+
display: flex;
24+
align-items: center;
25+
justify-content: center;
26+
height: ${props.size === 'small'
27+
? sizeIconContainerSmall
28+
: sizeIconContainer};
29+
width: ${props.size === 'small'
30+
? sizeIconContainerSmall
31+
: sizeIconContainer};
32+
border-radius: 50%;
33+
flex-shrink: 0;
34+
box-shadow: ${vars.shadow7};
35+
background-color: ${backgroundColor};
36+
border: 1px solid ${backgroundColor};
3937
`,
40-
]}
41-
>
42-
{props.isClosed ? (
43-
<AngleRightIcon
44-
theme={getArrowTheme({
45-
tone: props.tone,
46-
isDisabled: props.isDisabled,
47-
})}
48-
size={props.size}
49-
/>
50-
) : (
51-
<AngleDownIcon
52-
theme={getArrowTheme({
53-
tone: props.tone,
54-
isDisabled: props.isDisabled,
55-
})}
56-
size={props.size}
57-
/>
58-
)}
59-
</div>
60-
);
38+
props.isDisabled &&
39+
css`
40+
box-shadow: none;
41+
border: 1px solid ${vars.colorNeutral};
42+
background-color: ${vars.colorAccent98};
43+
`,
44+
]}
45+
>
46+
{props.isClosed ? (
47+
<AngleRightIcon
48+
theme={getArrowTheme({
49+
tone: props.tone,
50+
isDisabled: props.isDisabled,
51+
})}
52+
size={props.size}
53+
/>
54+
) : (
55+
<AngleDownIcon
56+
theme={getArrowTheme({
57+
tone: props.tone,
58+
isDisabled: props.isDisabled,
59+
})}
60+
size={props.size}
61+
/>
62+
)}
63+
</div>
64+
);
65+
};
6166

6267
HeaderIcon.displayName = 'HeaderIcon';
6368
HeaderIcon.propTypes = {

0 commit comments

Comments
 (0)