diff --git a/.eslintrc b/.eslintrc index 1f8ebe1..aa3690a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -47,6 +47,7 @@ }], "keyword-spacing": ["error"], "linebreak-style": "off", + "no-console": ["warn", { "allow": [ "info", "warn", "error" ] }], "no-plusplus": "off", "no-prototype-builtins": "off", "no-undef": "error", diff --git a/src/components/_mobile/collection/Search.tsx b/src/components/_mobile/collection/Search.tsx index b25f7ee..25942cf 100644 --- a/src/components/_mobile/collection/Search.tsx +++ b/src/components/_mobile/collection/Search.tsx @@ -1,8 +1,10 @@ -import React, { ChangeEventHandler, FormEvent, useEffect, useRef, useState } from 'react'; +import React, { FormEvent, useEffect, useRef, useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; import API, { sets } from '../../SpreadsheetData/API'; import search_api from '../../collection/search/search'; -import { Loading, UnderConstruction } from '../../Snippets'; +import { Loading } from '../../Snippets'; +import { Modal, Fab, Zoom, useTheme } from '@mui/material'; +import SearchIcon from '@mui/icons-material/Search'; const initInput = () => { /* @ts-ignore */ @@ -115,11 +117,13 @@ const updateQuery = (input, history) => { }; export default function Search ({ setContent, setInfo }) { + const theme = useTheme(); const history = useHistory(); const location = useLocation(); const prevLocation = useRef(undefined); const [input, setInput] = useState(initInput()); const [loaded, setLoaded] = useState(false); + const [open, setOpen] = useState(false); useEffect(() => { setInfo({ 'text': 'Loading..' }); @@ -176,5 +180,45 @@ export default function Search ({ setContent, setInfo }) { return (); } - return ; + const form = (<> + + ); + + const handleOpen = () => { + setOpen(true); + }; + + const handleClose = () => { + setOpen(false); + }; + + const transitionDuration = { + enter: theme.transitions.duration.enteringScreen, + exit: theme.transitions.duration.leavingScreen, + }; + + return (<> + + {form} + + {!open && form} + + + + + + ); } diff --git a/src/components/_mobile/collection/collection.scss b/src/components/_mobile/collection/collection.scss index 379ba32..5bb0829 100644 --- a/src/components/_mobile/collection/collection.scss +++ b/src/components/_mobile/collection/collection.scss @@ -14,3 +14,21 @@ .icon24 { height: 24px; } + +.name { + -webkit-user-select: all; + -moz-user-select: all; + -ms-user-select: all; + user-select: all; +} + +.name .subname::before { + content: "\a "; + white-space: pre; +} + +.name .subname { + font-size: 13px; + padding-bottom: 4px; + display: inherit; +} diff --git a/src/components/_mobile/collection/index.tsx b/src/components/_mobile/collection/index.tsx index f6f1252..38d661d 100644 --- a/src/components/_mobile/collection/index.tsx +++ b/src/components/_mobile/collection/index.tsx @@ -1,15 +1,48 @@ -import { Card, Typography } from '@mui/material'; +import { + Box, Card, Checkbox, createTheme, FormControl, FormControlLabel, InputLabel, MenuItem, Pagination, Paper, Select, SelectChangeEvent, styled, ThemeProvider, Typography +} from '@mui/material'; import React, { useState } from 'react'; +import { Attack as AttackCard, Card as ChaoticCard } from '../../common/definitions'; import Attack from './Attack'; +import { chaoticCardProps, statsType } from './ChaoticCard'; import Search from './Search'; -import { Card as ChaoticCard, Attack as AttackCard } from '../../common/definitions'; import './collection.scss'; -type statsType = "avg" | "min" | "max"; +let theme = createTheme({ + breakpoints: { + values: { + xs: 0, + sm: 600, + md: 900, + lg: 1200, + xl: 1536, + } + } +}); -export default function Collection (props) { - const [loaded, setLoaded] = useState(false); +theme = createTheme(theme, createTheme({ + components: { + MuiCard: { + styleOverrides: { + root: { + backgroundColor: "#1F1F1F", + color: "gray", + paddingLeft: theme.spacing(.5) + } + } + } + } +})); + +const CustomSelect = styled(Select)(() => ({ + '& > .MuiSelect-outlined': { + paddingTop: "5px", + paddingBottom: "5px" + } +})); + +export default function Collection (_props) { const [p, sp] = useState(1); const [n, sn] = useState(10); const [ext, setExt] = useState(false); @@ -17,34 +50,119 @@ export default function Collection (props) { const [hideStats, setHideStats] = useState(false); const [content, setContent] = useState([]); const [info, setInfo] = useState<{text?: string}>({}); + + const handlePerPage = (event: SelectChangeEvent) => { + sn(event.target.value as number); + }; + + const handlePage = (event: React.ChangeEvent, value: number) => { + sp(value); + }; + + const hanldeStats = (event: SelectChangeEvent) => { + setStats(event.target.value as statsType); + }; + + const handleExt = (event: React.ChangeEvent) => { + setExt(event.target.checked); + }; + + const handleHideStats = (event: React.ChangeEvent) => { + setHideStats(event.target.checked); + }; - return (<> - - {info.text ? ( - {info.text} - ) : ( - - )} - ); - + return ( + + + + {content.length} results + + Per Page + + 5 + 10 + 25 + 50 + + + + + Stats + + Min + Average + Max + + + } + sx={{ + marginLeft: 0, + marginRight: 0, + '& > .MuiCheckbox-root': { + padding: 0 + } + }} + /> + } + sx={{ + marginLeft: 0, + marginRight: 0, + '& > .MuiCheckbox-root': { + padding: 0 + } + }} + /> + + {info.text ? ( + {info.text} + ) : ( + + )} + + ); } -interface listProps { +type listProps = Omit, "card"> & { cards: ChaoticCard[] - info?: string - ext: boolean - stats: statsType - hideStats: boolean } -const CardList = ({ cards, info, ...props }: listProps) => { +const CardList = ({ cards, ...props }: listProps) => { const list = cards.map((card, i) => { switch (card.gsx$type) { case "Attacks": - return (); + return (); // case "Battlegear": // return (); // case "Creatures": diff --git a/src/components/app.js b/src/components/app.js index b3d9e6e..1a4baac 100644 --- a/src/components/app.js +++ b/src/components/app.js @@ -36,7 +36,6 @@ export default function App() { const isMobile = useCheckMobileScreen(); useEffect(() => { - console.log(document.styleSheets); if (isMobile) { document.styleSheets[0].disabled = true; } else {