mirror of
https://github.com/maputnik/editor.git
synced 2026-01-07 22:10:01 +00:00
This is to continue the work of migrating all the jsx files into tsx files. The MO is basically described here: #848. About 7 files to go...
35 lines
700 B
TypeScript
35 lines
700 B
TypeScript
import React from 'react'
|
|
import { Collapse as ReactCollapse } from 'react-collapse'
|
|
import {reducedMotionEnabled} from '../libs/accessibility'
|
|
|
|
|
|
type CollapseProps = {
|
|
isActive: boolean
|
|
children: React.ReactElement
|
|
};
|
|
|
|
|
|
export default class Collapse extends React.Component<CollapseProps> {
|
|
static defaultProps = {
|
|
isActive: true
|
|
}
|
|
|
|
render() {
|
|
if (reducedMotionEnabled()) {
|
|
return (
|
|
<div style={{display: this.props.isActive ? "block" : "none"}}>
|
|
{this.props.children}
|
|
</div>
|
|
)
|
|
}
|
|
else {
|
|
return (
|
|
<ReactCollapse isOpened={this.props.isActive}>
|
|
{this.props.children}
|
|
</ReactCollapse>
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|