|
1 |
| -import { useState } from "react"; |
| 1 | +import React from "react"; |
| 2 | +import "./App.css"; |
| 3 | +import { Box, Typography, Grid, List, ListItem, AppBar } from "@mui/material"; |
2 | 4 | import QRCode from "react-qr-code";
|
| 5 | +import { createTheme, ThemeProvider } from "@mui/material/styles"; |
| 6 | +import useMediaQuery from "@mui/material/useMediaQuery"; |
| 7 | +import CssBaseline from "@mui/material/CssBaseline"; |
| 8 | +import icon from "./Icon.png"; |
| 9 | +import Switch from "@mui/material/Switch"; |
| 10 | + |
| 11 | +const label = { inputProps: { "aria-label": "Switch demo" } }; |
3 | 12 |
|
4 | 13 | function Auth() {
|
5 |
| - const [value, setValue] = useState(); |
6 |
| - const [back, setBack] = useState("#FFFFFF"); |
7 |
| - const [fore, setFore] = useState("#000000"); |
8 |
| - const [size, setSize] = useState(256); |
| 14 | + // Theme |
| 15 | + const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)"); |
9 | 16 |
|
| 17 | + const theme = React.useMemo( |
| 18 | + () => |
| 19 | + createTheme({ |
| 20 | + palette: { |
| 21 | + mode: prefersDarkMode ? "dark" : "light", |
| 22 | + }, |
| 23 | + }), |
| 24 | + [prefersDarkMode] |
| 25 | + ); |
| 26 | + //Theme End |
10 | 27 | return (
|
11 |
| - <div className="Auth"> |
12 |
| - <center> |
13 |
| - <br /> |
14 |
| - <br /> |
15 |
| - <input |
16 |
| - type="text" |
17 |
| - onChange={(e) => setValue(e.target.value)} |
18 |
| - placeholder="Value of Qr-code" |
19 |
| - /> |
20 |
| - <br /> |
21 |
| - <br /> |
22 |
| - <input |
23 |
| - type="text" |
24 |
| - onChange={(e) => setBack(e.target.value)} |
25 |
| - placeholder="Background color" |
26 |
| - /> |
27 |
| - <br /> |
28 |
| - <br /> |
29 |
| - <input |
30 |
| - type="text" |
31 |
| - onChange={(e) => setFore(e.target.value)} |
32 |
| - placeholder="Foreground color" |
33 |
| - /> |
34 |
| - <br /> |
35 |
| - <br /> |
36 |
| - <input |
37 |
| - type="number" |
38 |
| - onChange={(e) => |
39 |
| - setSize(parseInt(e.target.value === "" ? 0 : e.target.value, 10)) |
40 |
| - } |
41 |
| - placeholder="Size of Qr-code" |
42 |
| - /> |
43 |
| - <br /> |
44 |
| - <br /> |
45 |
| - <br /> |
46 |
| - {value && ( |
47 |
| - <QRCode |
48 |
| - title="GeeksForGeeks" |
49 |
| - value={value} |
50 |
| - bgColor={back} |
51 |
| - fgColor={fore} |
52 |
| - size={size === "" ? 0 : size} |
53 |
| - /> |
54 |
| - )} |
55 |
| - </center> |
56 |
| - </div> |
| 28 | + <> |
| 29 | + <ThemeProvider theme={theme}> |
| 30 | + <CssBaseline /> |
| 31 | + <AppBar |
| 32 | + sx={{ |
| 33 | + p: 2, |
| 34 | + pb: 1, |
| 35 | + pl: 15, |
| 36 | + }} |
| 37 | + > |
| 38 | + {" "} |
| 39 | + <Box |
| 40 | + sx={{ |
| 41 | + display: "flex", |
| 42 | + }} |
| 43 | + > |
| 44 | + <img |
| 45 | + src={icon} |
| 46 | + width="30px" |
| 47 | + alt="Deku Icon" |
| 48 | + style={{ marginRight: 10 }} |
| 49 | + /> |
| 50 | + <span>Deku Messaging</span> |
| 51 | + </Box> |
| 52 | + </AppBar> |
| 53 | + |
| 54 | + <Grid |
| 55 | + container |
| 56 | + spacing={2} |
| 57 | + padding={15} |
| 58 | + sx={{ |
| 59 | + height: "100%", |
| 60 | + display: "flex", |
| 61 | + alignItems: "center", |
| 62 | + justifyContent: "center", |
| 63 | + }} |
| 64 | + > |
| 65 | + <Grid item xs={4}> |
| 66 | + <Typography |
| 67 | + variant="h4" |
| 68 | + sx={{ |
| 69 | + p: 2, |
| 70 | + }} |
| 71 | + > |
| 72 | + Deku Messaging |
| 73 | + </Typography> |
| 74 | + <List> |
| 75 | + <ListItem>1. On your phone, open Deku messaging app </ListItem> |
| 76 | + <ListItem> |
| 77 | + 2. Tap Menu from your conversation list and select Device |
| 78 | + pairing |
| 79 | + </ListItem> |
| 80 | + <ListItem> |
| 81 | + 3. Tap QR code scanner and scan the code on this device{" "} |
| 82 | + </ListItem> |
| 83 | + </List> |
| 84 | + <Typography |
| 85 | + variant="body2" |
| 86 | + sx={{ |
| 87 | + p: 2, |
| 88 | + color: "text.secondary", |
| 89 | + }} |
| 90 | + > |
| 91 | + Don't have Messages on your phone?{" "} |
| 92 | + <a href="#" style={{ color: "#9BBFF2" }}> |
| 93 | + Install Deku |
| 94 | + </a> |
| 95 | + </Typography> |
| 96 | + </Grid> |
| 97 | + <Grid item xs={4}> |
| 98 | + <Box |
| 99 | + sx={{ |
| 100 | + p: 2, |
| 101 | + backgroundColor: "white", |
| 102 | + width: "80%", |
| 103 | + borderRadius: "8%", |
| 104 | + }} |
| 105 | + > |
| 106 | + <QRCode |
| 107 | + title="DekuMessaging" |
| 108 | + value="smswithoutborders.com" |
| 109 | + size="100%" |
| 110 | + /> |
| 111 | + </Box> |
| 112 | + <Box |
| 113 | + sx={{ |
| 114 | + p: 2, |
| 115 | + }} |
| 116 | + > |
| 117 | + <Typography> |
| 118 | + Remember this computer <Switch {...label} /> |
| 119 | + </Typography> |
| 120 | + </Box> |
| 121 | + </Grid> |
| 122 | + </Grid> |
| 123 | + |
| 124 | + <Box |
| 125 | + sx={{ |
| 126 | + p: 2, |
| 127 | + flexDirection: "column", |
| 128 | + wordSpacing: 50, |
| 129 | + color: "gray", |
| 130 | + pl: 15, |
| 131 | + }} |
| 132 | + > |
| 133 | + <Typography sx={{ typography: "body2" }}> |
| 134 | + <a className="footer" href="#"> |
| 135 | + Privacy |
| 136 | + </a>{" "} |
| 137 | + <a className="footer" href="#"> |
| 138 | + Terms |
| 139 | + </a>{" "} |
| 140 | + <a className="footer" href="#"> |
| 141 | + Feedback |
| 142 | + </a> |
| 143 | + </Typography> |
| 144 | + </Box> |
| 145 | + </ThemeProvider> |
| 146 | + </> |
57 | 147 | );
|
58 | 148 | }
|
59 | 149 |
|
|
0 commit comments