PolicyAllowedOperation.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { noop } from 'lodash'
  2. import { RadioGroupCard, RadioGroupCardItem } from 'ui'
  3. interface PolicyAllowedOperationProps {
  4. operation: string
  5. onSelectOperation: (operation: string) => void
  6. }
  7. const PolicyAllowedOperation = ({
  8. operation = '',
  9. onSelectOperation = noop,
  10. }: PolicyAllowedOperationProps) => {
  11. return (
  12. <div className="flex justify-between space-x-12">
  13. <div className="flex w-1/3 flex-col space-y-2">
  14. <label className="text-base text-foreground-light" htmlFor="allowed-operation">
  15. Allowed operation
  16. </label>
  17. <p className="text-sm text-foreground-lighter">Select an operation for this policy</p>
  18. </div>
  19. <div className="w-2/3">
  20. <div className="flex items-center space-x-8">
  21. <RadioGroupCard
  22. id="allowed-operation"
  23. name="allowed-operation"
  24. className="flex flex-wrap gap-3"
  25. value={operation}
  26. onValueChange={(value) => onSelectOperation(value)}
  27. >
  28. {['SELECT', 'INSERT', 'UPDATE', 'DELETE', 'ALL'].map((op) => (
  29. <RadioGroupCardItem key={op} value={op} id={`r${op}`} label={op} className="w-24" />
  30. ))}
  31. </RadioGroupCard>
  32. </div>
  33. </div>
  34. </div>
  35. )
  36. }
  37. export default PolicyAllowedOperation