GrammarLookup.tsx 478 B

12345678910111213141516171819202122
  1. import { grammar } from "../../reducers/command";
  2. import { openPanel } from "../../reducers/right-panel";
  3. import store from "../../store";
  4. interface IWidget {
  5. word?: string;
  6. children?: React.ReactNode;
  7. }
  8. const GrammarLookup = ({ word, children }: IWidget) => {
  9. return (
  10. <span
  11. onClick={() => {
  12. store.dispatch(grammar(word));
  13. store.dispatch(openPanel("grammar"));
  14. }}
  15. >
  16. {children}
  17. </span>
  18. );
  19. };
  20. export default GrammarLookup;