11import React , { useState } from 'react' ;
22import useEnvStore from 'stores/EnvStore' ;
33import 'react-edit-text/dist/index.css' ;
4- import { TrashIcon } from '@heroicons/react/24/outline' ;
4+ import { TrashIcon , PlusIcon } from '@heroicons/react/24/outline' ;
55import AddEnvVariableModal from '../modals/AddEnvVariableModal' ;
66import ConfirmActionModal from '../modals/ConfirmActionModal' ;
7+ import Button from 'components/atoms/common/Button' ;
8+ import { BUTTON_TYPES , OBJ_TYPES } from 'constants/Common' ;
79
810const Env = ( ) => {
911 const variables = useEnvStore ( ( state ) => state . variables ) ;
@@ -17,40 +19,60 @@ const Env = () => {
1719
1820 return (
1921 < div className = 'p-4' >
20- { /* <div>Test Tab panel for environment</div> */ }
21- < div className = 'overflow-x-auto' >
22- < table className = 'table table-zebra' >
23- { /* head */ }
24- < thead >
25- < tr >
26- < th > </ th >
27- < th > Key</ th >
28- < th > Value</ th >
29- { /* <th>New Value</th> */ }
22+ < table className = 'w-full leading-normal' >
23+ < thead >
24+ < tr >
25+ < th className = 'px-5 py-3 text-xs font-semibold tracking-wider text-left text-gray-600 uppercase border-r-0 max-w-4 rounded-tl-xl border-slate-400 bg-slate-200' >
26+ Serial Number
27+ </ th >
28+ < th className = 'px-5 py-3 text-xs font-semibold tracking-wider text-left text-gray-600 uppercase border-slate-400 bg-slate-200' >
29+ Key
30+ </ th >
31+ < th className = 'px-5 py-3 text-xs font-semibold tracking-wider text-left text-gray-600 uppercase border-slate-400 bg-slate-200 ' >
32+ Value
33+ </ th >
34+ < th className = 'px-5 py-3 text-xs font-semibold tracking-wider text-left text-gray-600 uppercase rounded-tr-xl border-slate-400 bg-slate-200' >
35+ Action
36+ </ th >
37+ </ tr >
38+ </ thead >
39+ < tbody >
40+ { Object . entries ( variables ) . map ( ( [ key , value ] , index ) => (
41+ < tr key = { index } className = 'text-sm hover:bg-slate-100' >
42+ < td className = 'px-5 py-3 border-b border-gray-200 max-w-4' >
43+ < p className = 'text-gray-900 whitespace-no-wrap' > { index + 1 } </ p >
44+ </ td >
45+ < td className = 'px-5 py-3 border-b border-gray-200' >
46+ < p className = 'text-gray-900 whitespace-no-wrap' > { key } </ p >
47+ </ td >
48+ < td className = 'px-5 py-3 border-b border-gray-200' >
49+ < p className = 'text-gray-900 whitespace-no-wrap' > { value } </ p >
50+ </ td >
51+ < td className = 'px-5 py-3 border-b border-gray-200' >
52+ < div
53+ className = 'relative inline-block p-2 text-left transition duration-200 ease-out rounded rounded-l-none cursor-pointer hover:bg-slate-200'
54+ onClick = { ( ) => {
55+ setDeleteKey ( key ) ;
56+ setConfirmActionModalOpen ( true ) ;
57+ } }
58+ >
59+ < TrashIcon className = 'w-4 h-4' aria-hidden = 'true' />
60+ </ div >
61+ </ td >
3062 </ tr >
31- </ thead >
32- < tbody >
33- { Object . entries ( variables ) . map ( ( [ key , value ] , index ) => (
34- < tr key = { index } >
35- < th > { index } </ th >
36- < td > { key } </ td >
37- < td > { value } </ td >
38- < td >
39- < div
40- className = 'relative inline-block p-2 text-left transition duration-200 ease-out rounded rounded-l-none hover:bg-slate-200'
41- onClick = { ( ) => {
42- setDeleteKey ( key ) ;
43- setConfirmActionModalOpen ( true ) ;
44- } }
45- >
46- < TrashIcon className = 'w-4 h-4' aria-hidden = 'true' />
47- </ div >
48- </ td >
49- </ tr >
50- ) ) }
51- </ tbody >
52- </ table >
53- < button onClick = { ( ) => setAddVariableModalOpen ( true ) } > + Add Variable</ button >
63+ ) ) }
64+ </ tbody >
65+ </ table >
66+ < div className = 'mt-6' >
67+ < Button
68+ btnType = { BUTTON_TYPES . tertiary }
69+ isDisabled = { false }
70+ onClickHandle = { ( ) => setAddVariableModalOpen ( true ) }
71+ fullWidth = { true }
72+ >
73+ < PlusIcon className = 'w-4 h-4' />
74+ < span > Add Variable</ span >
75+ </ Button >
5476 </ div >
5577 < AddEnvVariableModal
5678 closeFn = { ( ) => setAddVariableModalOpen ( false ) }
0 commit comments