mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
use reflow to migrate from flow to typescript
This commit is contained in:
39
scm-ui/ui-components/src/buttons/ButtonAddons.tsx
Normal file
39
scm-ui/ui-components/src/buttons/ButtonAddons.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Flex = styled.div`
|
||||
&.field:not(:last-child) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
`;
|
||||
|
||||
type Props = {
|
||||
className?: string;
|
||||
children: React.Node;
|
||||
};
|
||||
|
||||
class ButtonAddons extends React.Component<Props> {
|
||||
render() {
|
||||
const { className, children } = this.props;
|
||||
|
||||
const childWrapper = [];
|
||||
React.Children.forEach(children, child => {
|
||||
if (child) {
|
||||
childWrapper.push(
|
||||
<p className="control" key={childWrapper.length}>
|
||||
{child}
|
||||
</p>,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return (
|
||||
<Flex className={classNames('field', 'has-addons', className)}>
|
||||
{childWrapper}
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ButtonAddons;
|
||||
Reference in New Issue
Block a user