parent
d5ba20621f
commit
79ac970b69
@ -0,0 +1,33 @@ |
|||||||
|
import React, { useContext, useEffect, useState } from 'react' |
||||||
|
import { SearchContext } from '../context/context' |
||||||
|
import { Find } from './Find' |
||||||
|
import { Replace } from './Replace' |
||||||
|
|
||||||
|
export const FindContainer = props => { |
||||||
|
const { setReplaceEnabled } = useContext(SearchContext) |
||||||
|
const [expanded, setExpanded] = useState<boolean>(false) |
||||||
|
const toggleExpand = () => setExpanded(!expanded) |
||||||
|
useEffect(() => { |
||||||
|
setReplaceEnabled(expanded) |
||||||
|
}, [expanded]) |
||||||
|
return ( |
||||||
|
<div className="search_plugin_find_container"> |
||||||
|
<div |
||||||
|
title="Toggle Replace" |
||||||
|
data-id="toggle_replace" |
||||||
|
className={`codicon codicon-find-${ |
||||||
|
expanded ? 'expanded' : 'collapsed' |
||||||
|
} search_plugin_find_container_arrow`}
|
||||||
|
role="button" |
||||||
|
onClick={toggleExpand} |
||||||
|
aria-label="Toggle Replace" |
||||||
|
aria-expanded="true" |
||||||
|
aria-disabled="false" |
||||||
|
></div> |
||||||
|
<div className="search_plugin_find_container_internal"> |
||||||
|
<Find></Find> |
||||||
|
{expanded ? <Replace></Replace> : null} |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
) |
||||||
|
} |
Loading…
Reference in new issue