Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 2864 Rev 3719
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React, { useState } from 'react';
2
import { useSelector } from 'react-redux'
2
import { useSelector } from 'react-redux';
3
import { Search } from '@mui/icons-material'
3
import { Search } from '@mui/icons-material';
4
 
4
 
5
import Widget from '@components/UI/Widget'
5
import Widget from '@components/UI/Widget';
6
import Input from '@components/UI/inputs/Input'
6
import Input from '@components/UI/inputs/Input';
7
 
7
 
8
export function withSearch(Component = <></>, items = []) {
8
export function withSearch(Component = <></>, items = []) {
9
  return function WithSearchComponent() {
9
  return function WithSearchComponent() {
10
    const [query, setQuery] = useState('')
10
    const [query, setQuery] = useState('');
11
    const labels = useSelector(({ intl }) => intl.labels)
11
    const labels = useSelector(({ intl }) => intl.labels);
12
 
12
 
13
    const handleInputChange = (e) => setQuery(e.target.value)
13
    const handleInputChange = (e) => setQuery(e.target.value);
14
 
14
 
15
    return (
15
    return (
16
      <Widget styles={{ paddingTop: '1rem' }}>
16
      <Widget styles={{ paddingTop: '1rem' }}>
17
        <Input
17
        <Input
18
          onChange={handleInputChange}
18
          onChange={handleInputChange}
19
          placeholder={labels.search}
19
          placeholder={labels.search}
20
          icon={<Search />}
20
          icon={<Search />}
21
          variant='search'
21
          variant='search'
22
        />
22
        />
23
        <Component query={query} capsules={items} />
23
        <Component query={query} capsules={items} />
24
      </Widget>
24
      </Widget>
25
    )
25
    );
26
  }
26
  };
27
}
27
}