You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
748 B
33 lines
748 B
import { styled } from '@mui/material'; |
|
import { FC, ReactElement, useMemo } from 'react'; |
|
import { v4 as uuidv4 } from 'uuid'; |
|
|
|
import ContainedButton from './ContainedButton'; |
|
import FlexBox from './FlexBox'; |
|
|
|
const FlexEndBox = styled(FlexBox)({ |
|
justifyContent: 'flex-end', |
|
width: '100%', |
|
}); |
|
|
|
const ActionGroup: FC<ActionGroupProps> = (props) => { |
|
const { actions = [] } = props; |
|
|
|
const elements = useMemo( |
|
() => |
|
actions.map<ReactElement>((actionProps) => ( |
|
<ContainedButton key={uuidv4()} {...actionProps}> |
|
{actionProps.children} |
|
</ContainedButton> |
|
)), |
|
[actions], |
|
); |
|
|
|
return ( |
|
<FlexEndBox row spacing=".5em"> |
|
{elements} |
|
</FlexEndBox> |
|
); |
|
}; |
|
|
|
export default ActionGroup;
|
|
|