import * as React from "react"; import { useContext, useEffect } from "react"; import styled from "styled-components"; import Dispatch from "../context/Dispatch"; import { Word } from "../types"; import Card from "./Card"; import CardAction from "./CardAction"; const saveIcon = require("../../icons/bookmark_o.png"); const savedIcon = require("../../icons/bookmark.png"); const nextIcon = require("../../icons/next.png"); export interface Props { word: Word; wordSaved: boolean; hideHiragana?: boolean; hideRomaji?: boolean; hideMeaning?: boolean; } const ActionBar = styled.div` width: 320px; height: 64px; display: flex; align-items: center; margin-top: 24px; `; const CardStack: React.FunctionComponent = (props: Props) => { let dispatch = useContext(Dispatch); return ( <> {props.wordSaved ? ( dispatch({ type: "removeWord" })} /> ) : ( dispatch({ type: "saveWord" })} /> )} dispatch({ type: "switchNext" })} /> ); }; export default CardStack;