-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the Anagram helper to the Interactive grid (#1832)
Add the anagram helper to the interactive grid Add toggle to show Anagram helper in interactive grid remove unneeded CSS from anagram helper component Make Controls one exported component Only show clue controls if there is a clue selected
- Loading branch information
1 parent
240c044
commit b740b35
Showing
4 changed files
with
65 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 13 additions & 4 deletions
17
libs/@guardian/react-crossword/src/components/InteractiveGrid.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
import { memo } from 'react'; | ||
import { memo, useState } from 'react'; | ||
import { AnagramHelper } from './AnagramHelper'; | ||
import { Controls } from './Controls'; | ||
import { Grid } from './Grid'; | ||
|
||
export const InteractiveGrid = memo(() => { | ||
const [showAnagramHelper, setShowAnagramHelper] = useState(false); | ||
|
||
const toggleAnagramHelper = () => | ||
setShowAnagramHelper((prevState) => !prevState); | ||
|
||
return ( | ||
<> | ||
<Grid /> | ||
<Controls.Clues /> | ||
<Controls.Grid /> | ||
{showAnagramHelper ? ( | ||
<AnagramHelper onClickClose={() => setShowAnagramHelper(false)} /> | ||
) : ( | ||
<Grid /> | ||
)} | ||
<Controls toggleAnagramHelper={toggleAnagramHelper} /> | ||
</> | ||
); | ||
}); |