Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3719 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3719 Rev 3736
Línea 5... Línea 5...
5
import { useAlert, useApi } from '@shared/hooks';
5
import { useAlert, useApi } from '@shared/hooks';
6
import { searchUsers } from '@shared/services';
6
import { searchUsers } from '@shared/services';
Línea 7... Línea 7...
7
 
7
 
Línea 8... Línea 8...
8
import { List, ListItem, SearchBar, Spinner } from '@shared/components';
8
import { List, ListItem, SearchBar, Spinner } from '@shared/components';
9
 
9
 
10
export const SearchUserModal = ({ onSelect }) => {
10
export const SearchUserModal = ({ onSelect = () => {}, renderAction }) => {
Línea 11... Línea 11...
11
  const [search, setSearch] = useState('');
11
  const [search, setSearch] = useState('');
Línea 12... Línea 12...
12
  const debouncedSearch = useDebounce(search, 500);
12
  const debouncedSearch = useDebounce(search, 500);
13
 
13
 
14
  const { showError } = useAlert();
14
  const { showError } = useAlert();
Línea -... Línea 15...
-
 
15
 
-
 
16
  const { data, loading, execute } = useApi(searchUsers, {
15
 
17
    onError: (error) => showError(error.message)
16
  const { data, loading, execute } = useApi(searchUsers, {
18
  });
17
    onError: (error) => showError(error.message)
19
 
Línea 18... Línea 20...
18
  });
20
  console.log({ renderAction });
Línea 34... Línea 36...
34
      ) : (
36
      ) : (
35
        <List
37
        <List
36
          items={data?.current?.items ?? []}
38
          items={data?.current?.items ?? []}
37
          keyExtractor={(item) => item.uuid}
39
          keyExtractor={(item) => item.uuid}
38
          renderItem={(item) => (
40
          renderItem={(item) => (
-
 
41
            <ListItem
-
 
42
              title={item.name}
-
 
43
              image={item.image}
39
            <ListItem title={item.name} image={item.image} onClick={() => onSelect(item)} />
44
              onClick={() => onSelect(item)}
-
 
45
              renderAction={renderAction ? () => renderAction(item) : undefined}
-
 
46
            />
40
          )}
47
          )}
41
          emptyMessage='No se encontraron usuarios'
48
          emptyMessage='No se encontraron usuarios'
42
        />
49
        />
43
      )}
50
      )}
44
    </Box>
51
    </Box>