diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..177bc7d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "pwa-chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} diff --git a/src/components/Interaction.tsx b/src/components/Interaction.tsx new file mode 100644 index 0000000..4923154 --- /dev/null +++ b/src/components/Interaction.tsx @@ -0,0 +1,138 @@ +/** @jsxImportSource @emotion/react */ +import { css } from "@emotion/react"; +import { + InfoInteraction, + LinkInteraction, + TraverseInteraction, +} from "../types/Interactions"; +import { useState } from "react"; + +import Parser from "../modules/Parser"; +import JohnsYard from "../test/johns-yard.json"; +import { TourGraph } from "../types/TourGraph"; + +const buttonCss = css` + padding: 7px 15px; + background-color: #0099ff; + color: white; + border: none; + width: 100%; + cursor: pointer; + transition: transform 0.2s; + border-radius: 10px; + margin: 5px 0; + font-size: 15px; + + &:active { + transform: scale(0.95); + } + + svg, + span { + display: inline-block; + vertical-align: middle; + } + + span { + margin-left: 5px; + font-weight: 700; + } +`; + +const infoCss = css` + padding: 7px 15px; + background-color: #0099ff; + color: white; + border: none; + width: 100%; + /* cursor: pointer; */ + transition: transform 0.2s; + border-radius: 10px; + margin: 5px 0; + font-size: 15px; + + /* &:active { + transform: scale(0.95); + } */ + + svg, + span { + display: inline-block; + vertical-align: middle; + } + + span { + margin-left: 5px; + font-weight: 700; + } +`; + +interface InfoInteractionProps { + interaction: InfoInteraction; +} + +interface LinkInteractionProps { + interaction: LinkInteraction; +} + +interface TraverseInteractionProps { + interaction: TraverseInteraction; + setLocation: any; +} + +// Remove onClicks from class and set them in here +export function InfoInteractionC(props: InfoInteractionProps) { + const { interaction } = props; + const [toggleButton, setToggleButton] = useState(false); + const { Icon, information } = interaction; + const onClick = () => setToggleButton(!toggleButton); + + return ( + <> + + {toggleButton &&
{description}
-