import React from 'react' ; import { ButtonPrimary } from 'design' ; export default function ButtonAdd ( props ) { const { canCreate , isLeafCluster , onClick } = props ; const disabled = isLeafCluster || ! canCreate ; let title = '' ; if ( ! canCreate ) { title = 'You do not have access to add a database' ; } if ( isLeafCluster ) { title = 'Adding a database to a leaf cluster is not supported' ; } return ( < ButtonPrimary title = { title } disabled = { disabled } width = "240px" onClick = { onClick } > Add Database < /ButtonPrimary>); } type Props = { isLeafCluster : boolean ; canCreate : boolean ; onClick ? : ( ) => void ; } ;