Skip to content

Commit

Permalink
feat: Make collapsed callout clickable eveywhere (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
floreks authored Jan 30, 2023
1 parent e0d9a15 commit fac45f4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/Callout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ ref) => {
return (
<FillLevelProvider value={fillLevel}>
<CalloutWrap
className={className}
className={`${className} ${classNames({ expandable })}`}
$borderColorKey={borderColorKey}
$fillLevel={fillLevel}
$size={size}
$expanded={expanded}
ref={ref}
onClick={expandable && !expanded ? () => onExpand && onExpand(!expanded) : null}
>
<div className="icon">
<Icon
Expand Down Expand Up @@ -202,6 +203,17 @@ const CalloutWrap = styled.div<{
backgroundColor:
$fillLevel >= 3 ? theme.colors['fill-three'] : theme.colors['fill-two'],
color: theme.colors['text-light'],

'&.expandable': {
cursor: $expanded ? 'inherit' : 'pointer',

...(!$expanded && {
'&:hover': {
backgroundColor: $fillLevel >= 3 ? theme.colors['fill-four'] : theme.colors['fill-three'],
},
}),
},

h6: {
...theme.partials.text.body1Bold,
color: theme.colors.text,
Expand All @@ -211,6 +223,7 @@ const CalloutWrap = styled.div<{

'&.expandable': {
marginBottom: $expanded ? theme.spacing.small : 0,
transition: 'margin-bottom .5s',
},
},
'.children *:first-child': {
Expand Down

0 comments on commit fac45f4

Please sign in to comment.