pineafan | df39fd4 | 2021-09-04 16:05:27 +0100 | [diff] [blame] | 1 | import '../styles/globals.css'; |
| 2 | import NavBar from '../Components/NavBar'; |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 3 | import { ThemeProvider } from 'theme-ui'; |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 4 | import React from 'react'; |
pineafan | ff3d452 | 2022-05-06 19:51:02 +0100 | [diff] [blame] | 5 | import Styles from '../styles/globals.module.css'; |
pineafan | df39fd4 | 2021-09-04 16:05:27 +0100 | [diff] [blame] | 6 | |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 7 | const theme = { |
| 8 | config: { |
| 9 | useColorSchemeMediaQuery: true, |
| 10 | initialColorModeName: 'light', |
| 11 | }, |
| 12 | colors: { |
| 13 | text: '#424242', |
| 14 | background: '#ffffff', |
| 15 | primary: '#6576CC', |
| 16 | cardText: '#ffffff', |
| 17 | cardBackground: 'rgba(255, 255, 255, 0.65)', |
| 18 | cardBorder: '#C4C4C4', |
| 19 | cardFilter: 'rgba(0, 0, 0, 0)', |
| 20 | cardOverlay: '#00000080', |
pineafan | e0283a8 | 2022-02-13 10:05:56 +0000 | [diff] [blame] | 21 | hint: '#E4E4E4', |
| 22 | panelColor: "#F0F0F0", |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 23 | fadeGradient: "rgba(240, 240, 240, 1)", |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 24 | offset: "2.5px", |
pineafan | df39fd4 | 2021-09-04 16:05:27 +0100 | [diff] [blame] | 25 | |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 26 | borders: "#FFFFFF", |
| 27 | borderHint: "#E4E4E4", |
| 28 | |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 29 | modes: { |
| 30 | dark: { |
| 31 | text: '#ffffff', |
pineafan | 74f1674 | 2022-11-07 21:57:55 +0000 | [diff] [blame] | 32 | background: '#000000', |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 33 | primary: '#6576CC', |
| 34 | cardText: '#424242', |
| 35 | cardBackground: 'rgba(0, 0, 0, 0.65)', |
| 36 | cardBorder: '#424242', |
pineafan | a841c76 | 2021-11-14 21:21:04 +0000 | [diff] [blame] | 37 | cardFilter: 'brightness(0.5)', |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 38 | cardOverlay: '#42424280', |
pineafan | e0283a8 | 2022-02-13 10:05:56 +0000 | [diff] [blame] | 39 | hint: '#242424', |
pineafan | 4627016 | 2022-02-13 12:06:17 +0000 | [diff] [blame] | 40 | panelColor: "rgba(255, 255, 255, 0.05)", |
| 41 | fadeGradient: "rgba(48, 48, 48, 1)", |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 42 | offset: "-20px", |
| 43 | |
| 44 | borders: "#000000", |
| 45 | borderHint: "#424242", |
Skyler Turner | 16c08d3 | 2021-11-04 20:06:50 +0000 | [diff] [blame] | 46 | } |
| 47 | } |
| 48 | }, |
| 49 | }; |
| 50 | |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 51 | |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 52 | function App({ Component, pageProps }) { |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 53 | const [subBar, setSubBar] = React.useState(false); |
| 54 | const [currentElement, setElement] = React.useState(<></>); |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 55 | |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 56 | const showSubBar = (element, timeout, positioning="left") => { |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 57 | setSubBar(true); |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 58 | if (positioning === "center") { |
| 59 | element = <div className={Styles.centeredSubBar}>{element}</div> |
| 60 | } |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 61 | setElement(element); |
| 62 | if (timeout) { |
| 63 | setTimeout(() => { |
| 64 | setSubBar(false); |
| 65 | setTimeout(() => { |
| 66 | setElement(<></>); |
| 67 | }, 0.31 * 1000) |
| 68 | }, timeout * 1000) |
| 69 | } |
| 70 | } |
pineafan | 7bd0ad6 | 2022-10-26 22:11:29 +0100 | [diff] [blame] | 71 | |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 72 | const hideSubBar = () => { |
| 73 | setSubBar(false); |
| 74 | } |
| 75 | |
pineafan | b7c7974 | 2022-11-06 18:08:36 +0000 | [diff] [blame] | 76 | const showMessage = (text, positioning="left") => { |
| 77 | showSubBar(<p className={Styles.message}>{text}</p>, 5, positioning); |
pineafan | b18f019 | 2022-10-27 22:08:36 +0100 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | return <> |
| 81 | <ThemeProvider theme={theme}> |
| 82 | <NavBar |
| 83 | subBar={subBar} |
| 84 | setSubBar={setSubBar} |
| 85 | element={currentElement} |
| 86 | setElement={setElement} |
| 87 | showMessage={showMessage} |
| 88 | showSubBar={showSubBar} |
| 89 | /> |
| 90 | <Component |
| 91 | {...pageProps} |
| 92 | showSubBar={showSubBar} |
| 93 | hideSubBar={hideSubBar} |
| 94 | showMessage={showMessage} |
| 95 | /> |
| 96 | <div className={Styles.container} /> |
| 97 | </ThemeProvider> |
| 98 | </> |
Samuel Shuert | 016ea02 | 2021-09-01 16:17:24 -0500 | [diff] [blame] | 99 | } |
| 100 | |
pineafan | a5ce910 | 2021-09-02 17:21:31 +0100 | [diff] [blame] | 101 | export default App |