11import { rem } from 'polished' ;
2- import styled , { css } from 'styled-components' ;
2+ import styled , { css , keyframes } from 'styled-components' ;
33
44import { ChevronDown , CircleWarning } from '../../icons' ;
5- import { Paragraph } from '../../typography' ;
5+ import { Header } from '../../typography' ;
66
77import { grayscale } from '../../color' ;
88import { core } from '../../tokens' ;
@@ -72,7 +72,7 @@ export const TriggerContainer = styled.button<{
7272 }
7373` ;
7474
75- export const Header = styled . div `
75+ export const HeaderContainer = styled . div `
7676 display : flex;
7777 margin-right : ${ rem ( 10 ) } ;
7878` ;
@@ -81,17 +81,14 @@ export const TitleContainer = styled.div`
8181 display : flex;
8282 flex-direction : column;
8383 text-align : left;
84+ gap : ${ rem ( 4 ) } ;
8485` ;
8586
86- export const Title = styled ( Paragraph ) `
87- font-size: ${ rem ( 16 ) } ;
88- font-weight: 700;
89- margin-bottom: 0;
87+ export const Title = styled ( Header ) `
88+ margin-bottom: ${ rem ( 0 ) } ;
9089` ;
9190
92- export const Subcopy = styled ( Paragraph ) `
93- font-size: ${ rem ( 14 ) } ;
94- font-weight: 400;
91+ export const Subcopy = styled ( Header ) `
9592 margin-bottom: -${ rem ( 0.2 ) } ;
9693` ;
9794
@@ -103,18 +100,56 @@ export const CircleWarningIcon = styled(CircleWarning)`
103100 }
104101` ;
105102
103+ const rotateUp = keyframes `
104+ from {
105+ transform : rotate (0deg );
106+ }
107+ to {
108+ transform : rotate (-180deg );
109+ }
110+ ` ;
111+
112+ const rotateDown = keyframes `
113+ from {
114+ transform : rotate (-180deg );
115+ }
116+ to {
117+ transform : rotate (0deg );
118+ }
119+ ` ;
120+
106121export const StyledChevronDown = styled ( ChevronDown ) `
122+ animation: ${ rotateDown } 120ms ease-in-out both;
107123 path {
108124 fill: ${ core . color . text . primary } ;
109125 }
110126` ;
111127
112128export const ChevronUp = styled ( StyledChevronDown ) `
113- transform: rotate(180deg);
129+ animation: ${ rotateUp } 120ms ease-in-out both;
130+ ` ;
131+
132+ const fadeAndExpand = keyframes `
133+ from {
134+ transform : translateY (-50% );
135+ opacity : 0 ;
136+ }
137+ to {
138+ transform : translateY (0 );
139+ opacity : 1 ;
140+ }
114141` ;
115142
116143export const Content = styled . div < { active : boolean } > `
117- padding: ${ rem ( 0 ) } ${ rem ( 15 ) } ${ rem ( 20 ) } ;
144+ padding: ${ rem ( 0 ) } ${ rem ( 15 ) } ${ rem ( 20 ) } ${ rem ( 20 ) } ;
118145 max-height: ${ ( { active } ) => ( active ? '100%' : '0' ) } ;
119146 overflow: hidden;
147+ transform: translateY(-50%);
148+ opacity: 0;
149+ ${ ( { active } ) =>
150+ active &&
151+ css `
152+ animation : ${ fadeAndExpand } 150ms ease-in-out both;
153+ opacity : 1 ;
154+ ` } ;
120155` ;
0 commit comments