Skip to content
Snippets Groups Projects
Commit fdb35ec0 authored by chris's avatar chris
Browse files

temp

parent 3f5fcc15
No related branches found
No related tags found
1 merge request!201Ui components
...@@ -4,7 +4,7 @@ import styled from 'styled-components'; ...@@ -4,7 +4,7 @@ import styled from 'styled-components';
import { grid } from '@pubsweet/ui-toolkit'; import { grid } from '@pubsweet/ui-toolkit';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { WaxContext } from 'wax-prosemirror-core'; import { WaxContext } from 'wax-prosemirror-core';
import { groupBy } from 'lodash'; import { filter, groupBy } from 'lodash';
import Icon from '../../helpers/Icon'; import Icon from '../../helpers/Icon';
import CharactersList from './CharactersList'; import CharactersList from './CharactersList';
...@@ -86,8 +86,18 @@ const SpecialCharactersComponent = ({ close }) => { ...@@ -86,8 +86,18 @@ const SpecialCharactersComponent = ({ close }) => {
const { app, view } = useContext(WaxContext); const { app, view } = useContext(WaxContext);
const [searchValue, setSearchValue] = useState(''); const [searchValue, setSearchValue] = useState('');
const groupedCharacters = groupBy(CharactersList, 'group'); const groupedCharacters = groupBy(CharactersList, 'group');
const [specialCharactersList, setSpecialCharactersList] = useState(
CharactersList,
);
const onChange = () => { const onChange = () => {
setSearchValue(searchRef.current.value); setSearchValue(searchRef.current.value);
const filtertedSpecialCharacters = filter(CharactersList, value => {
console.log(value);
if (value.name.toLowerCase().includes(searchValue.toLowerCase()))
return value.name;
return false;
});
setSpecialCharactersList(filtertedSpecialCharacters);
}; };
const insertCharacter = () => {}; const insertCharacter = () => {};
...@@ -95,7 +105,7 @@ const SpecialCharactersComponent = ({ close }) => { ...@@ -95,7 +105,7 @@ const SpecialCharactersComponent = ({ close }) => {
const renderList = () => { const renderList = () => {
const lists = []; const lists = [];
Object.keys(groupedCharacters).forEach(key => { Object.keys(groupBy(specialCharactersList, 'group')).forEach(key => {
lists.push( lists.push(
<SpecialCharactersGroup key={key}> <SpecialCharactersGroup key={key}>
<GroupTitle> {key} </GroupTitle> <GroupTitle> {key} </GroupTitle>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment