File tree Expand file tree Collapse file tree 4 files changed +28
-1
lines changed
pattern-library/components/patterns Expand file tree Collapse file tree 4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const Slider: TransitionComponent = ({
6
6
children,
7
7
direction = 'in' ,
8
8
onTransitionEnd,
9
+ delay,
9
10
} ) => {
10
11
const visible = direction === 'in' ;
11
12
const containerRef = useRef < HTMLDivElement | null > ( null ) ;
@@ -93,6 +94,8 @@ const Slider: TransitionComponent = ({
93
94
// are visible.
94
95
overflow : isFullyVisible ? 'visible' : 'hidden' ,
95
96
transition : `height 0.15s ease-in` ,
97
+
98
+ transitionDelay : delay ,
96
99
} }
97
100
>
98
101
{ children }
Original file line number Diff line number Diff line change @@ -268,6 +268,21 @@ export default function UsingComponentsPage() {
268
268
</ Library . Link >
269
269
</ p >
270
270
< Library . Section title = "API" id = "transition-components-api" >
271
+ < Library . SectionL3 title = "delay" >
272
+ < Library . Info >
273
+ < Library . InfoItem label = "description" >
274
+ Sets delay before transitions begin. See the{ ' ' }
275
+ < a href = "https://developer.mozilla.org/en-US/docs/Web/CSS/transition-delay" >
276
+ transition-delay
277
+ </ a > { ' ' }
278
+ CSS property.
279
+ </ Library . InfoItem >
280
+ < Library . InfoItem label = "type" >
281
+ < code > string | undefined</ code >
282
+ </ Library . InfoItem >
283
+ </ Library . Info >
284
+ </ Library . SectionL3 >
285
+
271
286
< Library . SectionL3 title = "direction" >
272
287
< Library . Info >
273
288
< Library . InfoItem label = "description" >
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export default function SliderPage() {
72
72
73
73
< Library . SectionL2 title = "Component API" >
74
74
< p >
75
- < code > Button </ code > accepts{ ' ' }
75
+ < code > Slider </ code > accepts{ ' ' }
76
76
< Library . Link href = "/using-components#transition-components-api" >
77
77
transition component props
78
78
</ Library . Link >
Original file line number Diff line number Diff line change @@ -55,8 +55,17 @@ export type IconComponent = FunctionComponent<JSX.SVGAttributes<SVGSVGElement>>;
55
55
* animate the mounting and unmounting of a child component.
56
56
*/
57
57
export type TransitionComponent = FunctionComponent < {
58
+ /** Whether the children should be revealed ("in") or hidden ("out"). */
58
59
direction ?: 'in' | 'out' ;
60
+
61
+ /** Callback invoked when transition ends. */
59
62
onTransitionEnd ?: ( direction : 'in' | 'out' ) => void ;
63
+
64
+ /**
65
+ * Delay before transitions begin. This corresponds to the `transition-delay`
66
+ * CSS property.
67
+ */
68
+ delay ?: string ;
60
69
} > ;
61
70
62
71
export type OrderDirection = 'ascending' | 'descending' ;
You can’t perform that action at this time.
0 commit comments