disable editing of app access dropdowns when dashboard role is admin

This commit is contained in:
Davor 2022-06-28 12:20:55 +02:00
parent ca3a5454d1
commit edc318a25b
2 changed files with 16 additions and 12 deletions

View file

@ -2,7 +2,7 @@ import React from 'react';
import { useController } from 'react-hook-form';
/* eslint-disable react/react-in-jsx-scope */
export const Select = ({ control, name, label, options }: SelectProps) => {
export const Select = ({ control, name, label, options, disabled = false }: SelectProps) => {
const {
field,
// fieldState: { invalid, isTouched, isDirty },
@ -27,6 +27,7 @@ export const Select = ({ control, name, label, options }: SelectProps) => {
name={name} // send down the input name
ref={field.ref} // send input ref, so we can focus on input when error appear
className="shadow-sm focus:ring-primary-500 focus:border-primary-500 block w-full sm:text-sm border-gray-300 rounded-md"
disabled={disabled}
>
{options?.map((option) => (
<option key={option.value} value={option.value}>
@ -43,4 +44,5 @@ type SelectProps = {
name: string;
label?: string;
options?: any[];
disabled?: boolean;
};