From edc318a25b6bf5f37c8c859774696296d57130e1 Mon Sep 17 00:00:00 2001 From: Davor Date: Tue, 28 Jun 2022 12:20:55 +0200 Subject: [PATCH] disable editing of app access dropdowns when dashboard role is admin --- src/components/Form/Select/Select.tsx | 4 +++- src/components/UserModal/UserModal.tsx | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/Form/Select/Select.tsx b/src/components/Form/Select/Select.tsx index b5416d2..aad51fa 100644 --- a/src/components/Form/Select/Select.tsx +++ b/src/components/Form/Select/Select.tsx @@ -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) => (