|
1 | | -import React, { useState } from "react"; |
2 | | -import { ThemeProvider } from "styled-components"; |
| 1 | +import React from "react"; |
| 2 | +import styled, { ThemeProvider } from "styled-components"; |
3 | 3 | import { GlobalStyle, Main, lightTheme, darkTheme } from "../styles/styles"; |
4 | 4 | import { useDarkMode } from "../components/useDarkMode"; |
5 | 5 | import Navigation from "../components/Navigation"; |
6 | 6 | import Footer from "../components/Footer"; |
7 | 7 | import ShapeBuilder from "../components/ShapeBuilder"; |
8 | | -import { Button, SistentThemeProviderWithoutBaseLine, Box } from "@sistent/sistent"; |
9 | | -import InstructionsModal from "../components/utils/instructionsModal"; |
| 8 | +import { SistentThemeProviderWithoutBaseLine, Box } from "@sistent/sistent"; |
| 9 | + |
| 10 | +const Kbd = styled.kbd` |
| 11 | + background-color: ${({ theme }) => |
| 12 | + theme.mode === "light" ? "#f4f4f4" : "#2b2b2b"}; |
| 13 | + border: 1px solid |
| 14 | + ${({ theme }) => (theme.mode === "light" ? "#d1d5da" : "#444")}; |
| 15 | + border-bottom-color: ${({ theme }) => |
| 16 | + theme.mode === "light" ? "#c6cbd1" : "#444"}; |
| 17 | + border-radius: 3px; |
| 18 | + box-shadow: inset 0 -1px 0 |
| 19 | + ${({ theme }) => (theme.mode === "light" ? "#c6cbd1" : "#444")}; |
| 20 | + color: ${({ theme }) => (theme.mode === "light" ? "#444" : "#e6e6e6")}; |
| 21 | + display: inline-block; |
| 22 | + font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; |
| 23 | + font-size: 11px; |
| 24 | + font-weight: 600; |
| 25 | + line-height: 1; |
| 26 | + padding: 3px 6px; |
| 27 | + margin-right: 6px; |
| 28 | + vertical-align: middle; |
| 29 | +`; |
| 30 | + |
| 31 | +const InstructionsContainer = styled.div` |
| 32 | + display: flex; |
| 33 | + justify-content: center; |
| 34 | + align-items: center; |
| 35 | + flex-wrap: wrap; |
| 36 | + gap: 24px; |
| 37 | + margin-top: 16px; |
| 38 | + font-size: 0.9rem; |
| 39 | + color: ${({ theme }) => (theme.mode === "light" ? "#666" : "#aaa")}; |
| 40 | +
|
| 41 | + span { |
| 42 | + display: flex; |
| 43 | + align-items: center; |
| 44 | + } |
| 45 | +`; |
10 | 46 |
|
11 | 47 | const IndexPage = () => { |
12 | | - // const themesistent = useTheme(); |
13 | 48 | const [theme, toggleTheme] = useDarkMode(); |
14 | 49 | const themeMode = theme === "light" ? lightTheme : darkTheme; |
15 | | - const [open, setOpen] = useState(false); |
| 50 | + const activeTheme = { ...themeMode, mode: theme }; |
16 | 51 |
|
17 | 52 | return ( |
18 | 53 | <SistentThemeProviderWithoutBaseLine> |
19 | | - <ThemeProvider theme={themeMode}> |
| 54 | + <ThemeProvider theme={activeTheme}> |
20 | 55 | <GlobalStyle /> |
21 | 56 | <Navigation theme={theme} toggleTheme={toggleTheme} /> |
22 | 57 | <Main> |
23 | 58 | <section className="hero"> |
24 | | - <h1>Shape Builder</h1> |
25 | | - <p className="desc-text"> |
26 | | - Click on the grid to start creating a polygon. Each click adds a point. |
27 | | - </p> |
28 | | - </section> |
29 | | - <Box sx={{ display: "flex", justifyContent: "center", mt: 2 }}> |
30 | | - <Button |
31 | | - variant="contained" |
32 | | - sx={{ minWidth: "fit-content" }} |
33 | | - onClick={() => setOpen(true)} |
| 59 | + <Box |
| 60 | + sx={{ |
| 61 | + display: "flex", |
| 62 | + flexDirection: "column", |
| 63 | + alignItems: "center", |
| 64 | + justifyContent: "center", |
| 65 | + gap: 2, |
| 66 | + mb: 4, |
| 67 | + }} |
34 | 68 | > |
35 | | - Show Instructions |
36 | | - </Button> |
37 | | - </Box> |
38 | | - <InstructionsModal open={open} onClose={() => setOpen(false)} /> |
| 69 | + <h1>Shape Builder</h1> |
| 70 | + |
| 71 | + <p className="desc-text" style={{ margin: 0 }}> |
| 72 | + Click on the grid to start creating a polygon. Each click adds a |
| 73 | + point. |
| 74 | + </p> |
| 75 | + |
| 76 | + <InstructionsContainer theme={activeTheme}> |
| 77 | + <span> |
| 78 | + <Kbd theme={activeTheme}>ENTER</Kbd> /{" "} |
| 79 | + <Kbd theme={activeTheme}>ESC</Kbd> Close shape |
| 80 | + </span> |
| 81 | + |
| 82 | + <span> |
| 83 | + <Kbd theme={activeTheme}>CTRL</Kbd> Snap to grid |
| 84 | + </span> |
| 85 | + |
| 86 | + <span> |
| 87 | + <Kbd theme={activeTheme}>CTRL</Kbd> +{" "} |
| 88 | + <Kbd theme={activeTheme}>Z</Kbd> Undo |
| 89 | + </span> |
| 90 | + |
| 91 | + <span> |
| 92 | + <Kbd theme={activeTheme}>Maximize</Kbd> Visibility |
| 93 | + </span> |
| 94 | + </InstructionsContainer> |
| 95 | + </Box> |
| 96 | + </section> |
| 97 | + |
39 | 98 | <ShapeBuilder /> |
40 | 99 | </Main> |
41 | 100 | <Footer /> |
|
0 commit comments