From c3b268da61f1ad490eb736634fdd94d017daf11a Mon Sep 17 00:00:00 2001 From: Kyle Geib Date: Mon, 20 Dec 2021 15:45:53 -0500 Subject: [PATCH 1/2] ISSUE-001 - Playing around quite a bit. Not sure I've figured out a method of constructing the tool page I'm happy with here. Want to take a different path and see what I can do. --- .eslintrc.json | 9 +- .vscode/launch.json | 7 ++ package.json | 5 ++ src/App.test.tsx | 1 - src/App.tsx | 26 ++---- src/clear.css | 87 +++++++++++++++++++ src/components/Broadcast/Layout/Layout.tsx | 58 +++++++++++++ src/components/Broadcast/Layout/index.ts | 1 + src/components/Broadcast/Layout/styles.ts | 14 +++ src/components/Common/MockupBlock.styled.ts | 19 ++++ src/components/Common/Nav.styled.ts | 7 ++ .../Common/RouteHeader/RouteHeader.tsx | 16 ++++ src/components/Common/RouteHeader/index.ts | 1 + src/components/Common/RouteHeader/styles.ts | 11 +++ src/index.css | 2 + src/index.tsx | 25 ++++-- src/logo.svg | 1 - src/routes/BroadcastRoute.tsx | 22 +++++ src/routes/styles.ts | 7 ++ src/shared/theme.ts | 43 +++++++++ tsconfig.json | 4 +- yarn.lock | 79 ++++++++++++++++- 22 files changed, 412 insertions(+), 33 deletions(-) create mode 100644 src/clear.css create mode 100644 src/components/Broadcast/Layout/Layout.tsx create mode 100644 src/components/Broadcast/Layout/index.ts create mode 100644 src/components/Broadcast/Layout/styles.ts create mode 100644 src/components/Common/MockupBlock.styled.ts create mode 100644 src/components/Common/Nav.styled.ts create mode 100644 src/components/Common/RouteHeader/RouteHeader.tsx create mode 100644 src/components/Common/RouteHeader/index.ts create mode 100644 src/components/Common/RouteHeader/styles.ts delete mode 100644 src/logo.svg create mode 100644 src/routes/BroadcastRoute.tsx create mode 100644 src/routes/styles.ts create mode 100644 src/shared/theme.ts diff --git a/.eslintrc.json b/.eslintrc.json index 6ed0db0..893b410 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,8 @@ "extends": [ "eslint:recommended", "plugin:react/recommended", - "plugin:@typescript-eslint/recommended" + "plugin:@typescript-eslint/recommended", + "plugin:react/jsx-runtime" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -50,7 +51,7 @@ "always-multiline" ], "no-unused-vars": [ - "error", + "warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" @@ -59,6 +60,8 @@ "arrow-body-style" : [ "error", "as-needed" - ] + ], + "react/jsx-uses-react": "off", + "react/react-in-jsx-scope": "off" } } diff --git a/.vscode/launch.json b/.vscode/launch.json index 04a827f..9c0f5f5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,13 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "name": "Attach to Edge :3000", + "port": 9222, + "request": "attach", + "type": "pwa-msedge", + "webRoot": "${workspaceFolder}" + }, { "name": "Launch Edge :3000", "request": "launch", diff --git a/package.json b/package.json index 8380594..019b3fb 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,10 @@ "private": true, "dependencies": { "@bedrock-layout/appboundary": "^2.2.4", + "@bedrock-layout/columns": "^2.3.4", "@bedrock-layout/frame": "^2.2.4", + "@bedrock-layout/split": "^2.3.5", + "@bedrock-layout/stack": "^2.3.4", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^12.0.0", "@testing-library/user-event": "^13.2.1", @@ -15,8 +18,10 @@ "@types/react-dom": "^17.0.9", "@types/styled-components": "^5.1.18", "d3": "^7.2.1", + "history": "5", "react": "^17.0.2", "react-dom": "^17.0.2", + "react-router-dom": "6", "react-scripts": "5.0.0", "styled-components": "^5.3.3", "typescript": "^4.4.2", diff --git a/src/App.test.tsx b/src/App.test.tsx index d76787e..9382b9a 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,4 +1,3 @@ -import React from "react"; import { render, screen } from "@testing-library/react"; import App from "./App"; diff --git a/src/App.tsx b/src/App.tsx index 9cc63d9..4e5701a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,24 +1,16 @@ -import React from "react"; -import logo from "./logo.svg"; -import "./App.css"; +// import "./App.css"; +import { Outlet, Link } from "react-router-dom"; + +import { Nav } from "./components/Common/Nav.styled"; function App() { return (
-
- logo -

- Edit src/App.tsx and save to reload. -

- - Learn React - -
+

Main Page

+ +
); } diff --git a/src/clear.css b/src/clear.css new file mode 100644 index 0000000..86070a1 --- /dev/null +++ b/src/clear.css @@ -0,0 +1,87 @@ +*, +*::before, +*::after { + box-sizing: border-box; +} + +body, +h1, +h2, +h3, +h4, +p, +ul, +ol, +li, +figure, +figcaption, +blockquote, +dl, +dd { + margin: 0; +} + +ul[class], +ol[class] { + padding: 0; + list-style: none; +} + +html:focus-within { + scroll-behavior: smooth; +} + +body { + min-block-size: 100vh; + text-rendering: optimizeSpeed; + line-height: 1.5; + font-size: 100%; +} + +a:not([class]) { + text-decoration-skip-ink: auto; +} + +img { + display: block; + max-inline-size: 100%; +} + +p, +h1, +h2, +h3, +h4, +h5, +h6, +li, +figcaption { + max-inline-size: 60ch; +} + +input, +button, +textarea, +select { + font: inherit; + max-inline-size: 100%; +} + +.js-focus-visible :focus:not(.focus-visible) { + outline: none; +} + +@media (prefers-reduced-motion: reduce) { + html:focus-within { + scroll-behavior: auto; + } + + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + scroll-behavior: auto !important; + } +} \ No newline at end of file diff --git a/src/components/Broadcast/Layout/Layout.tsx b/src/components/Broadcast/Layout/Layout.tsx new file mode 100644 index 0000000..fc194cb --- /dev/null +++ b/src/components/Broadcast/Layout/Layout.tsx @@ -0,0 +1,58 @@ +import { Stack } from "@bedrock-layout/stack"; +import { Column, Columns } from "@bedrock-layout/columns"; + +import { MockupBlock } from "../../Common/MockupBlock.styled"; +import { ExpandedStack, ExpandedBlock } from "./styles"; + +type LayoutProps = { + headerHeight?: number, +}; + +export function Layout({ headerHeight }: LayoutProps) { + const headerOffset = headerHeight ? headerHeight + 5 : 0; + + return ( + + + Timing Board UI + + Video Feed + + + + + + + Race Status UI + + + Race Director UI + + + + + Broadcast Director UI + + + + ); +} diff --git a/src/components/Broadcast/Layout/index.ts b/src/components/Broadcast/Layout/index.ts new file mode 100644 index 0000000..f7ad548 --- /dev/null +++ b/src/components/Broadcast/Layout/index.ts @@ -0,0 +1 @@ +export * from "./Layout"; diff --git a/src/components/Broadcast/Layout/styles.ts b/src/components/Broadcast/Layout/styles.ts new file mode 100644 index 0000000..f024469 --- /dev/null +++ b/src/components/Broadcast/Layout/styles.ts @@ -0,0 +1,14 @@ +import styled from "styled-components"; + +export const ExpandedStack = styled.div` + display: flex; + flex-flow: column; + /* height: 100%; */ +`; + +export const ExpandedBlock = styled.div` + /* flex: 1 1 auto; */ + flex-grow: 1; + /* flex-shrink: 1; + flex-basis: auto; */ +`; diff --git a/src/components/Common/MockupBlock.styled.ts b/src/components/Common/MockupBlock.styled.ts new file mode 100644 index 0000000..e5a0fc1 --- /dev/null +++ b/src/components/Common/MockupBlock.styled.ts @@ -0,0 +1,19 @@ +import styled from "styled-components"; + +type MockupBlockProps = { + color: string, + height?: string, + width?: string, + minWidth?: string, + minHeight?: string, +}; + +export const MockupBlock = styled.div` + display: flex; + min-height: ${({ minHeight }) => minHeight ?? "0"}; + min-width: ${({ minWidth }) => minWidth ?? "0"}; + height: ${({ height }) => height ?? "100%"}; + width: ${({ width }) => width ?? "100%"}; + background-color: ${({ color }) => color}; + flex: 1 1 auto; +`; diff --git a/src/components/Common/Nav.styled.ts b/src/components/Common/Nav.styled.ts new file mode 100644 index 0000000..4c9024b --- /dev/null +++ b/src/components/Common/Nav.styled.ts @@ -0,0 +1,7 @@ +import styled from "styled-components"; + +export const Nav = styled.nav` + border-bottom: solid 1px; + padding-bottom: 1rem; + padding-left: 1rem; +`; diff --git a/src/components/Common/RouteHeader/RouteHeader.tsx b/src/components/Common/RouteHeader/RouteHeader.tsx new file mode 100644 index 0000000..e9a7e3d --- /dev/null +++ b/src/components/Common/RouteHeader/RouteHeader.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import { Container } from "./styles"; + +type RouteHeaderProps = { + title: string, +}; + +export const RouteHeader = React.forwardRef( + (props, ref) => ( + + {props.title} + + ), +); +RouteHeader.displayName = "RouteHeader"; // Required due to forwardRef(). + diff --git a/src/components/Common/RouteHeader/index.ts b/src/components/Common/RouteHeader/index.ts new file mode 100644 index 0000000..3c77bbe --- /dev/null +++ b/src/components/Common/RouteHeader/index.ts @@ -0,0 +1 @@ +export * from "./RouteHeader"; diff --git a/src/components/Common/RouteHeader/styles.ts b/src/components/Common/RouteHeader/styles.ts new file mode 100644 index 0000000..2c789a2 --- /dev/null +++ b/src/components/Common/RouteHeader/styles.ts @@ -0,0 +1,11 @@ +import styled from "styled-components"; + +export const Container = styled.header` + top: 0; + left: 0; + right: 0; + z-index: 5; + padding: 0; + background-color: ${p => p.theme.colors.grey}; + height: 20px; +`; diff --git a/src/index.css b/src/index.css index ec2585e..5e0ab8d 100644 --- a/src/index.css +++ b/src/index.css @@ -1,3 +1,5 @@ +@import-normalize; + body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', diff --git a/src/index.tsx b/src/index.tsx index 211e34a..6722ea9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,17 +1,26 @@ import React from "react"; import ReactDOM from "react-dom"; -import "./index.css"; +import { BrowserRouter, Route, Routes } from "react-router-dom"; +import { ThemeProvider } from "styled-components"; + +// import "./index.css"; +// import "./clear.css"; + import App from "./App"; -import reportWebVitals from "./reportWebVitals"; +import Broadcast from "./routes/BroadcastRoute"; +import { GlobalStyle, theme } from "./shared/theme"; ReactDOM.render( - + + + + + } /> + } /> + + + , document.getElementById("root"), ); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/src/logo.svg b/src/logo.svg deleted file mode 100644 index 9dfc1c0..0000000 --- a/src/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/routes/BroadcastRoute.tsx b/src/routes/BroadcastRoute.tsx new file mode 100644 index 0000000..329c575 --- /dev/null +++ b/src/routes/BroadcastRoute.tsx @@ -0,0 +1,22 @@ +import { useEffect, useRef, useState } from "react"; + +import { FullScreenContainer } from "./styles"; +import { Layout } from "../components/Broadcast/Layout"; +import { RouteHeader } from "../components/Common/RouteHeader"; + +export default function Broadcast() { + const [height, setHeight] = useState(0); + const ref = useRef < HTMLHeadElement>(null); + + useEffect(() => { + if (ref?.current != null) + setHeight(ref.current.clientHeight); + }); + + return ( + + + + + ); +} diff --git a/src/routes/styles.ts b/src/routes/styles.ts new file mode 100644 index 0000000..821e8d9 --- /dev/null +++ b/src/routes/styles.ts @@ -0,0 +1,7 @@ +import styled from "styled-components"; + +export const FullScreenContainer = styled.div` + overflow: hidden; + height: 100vh; + width: 100%; +`; diff --git a/src/shared/theme.ts b/src/shared/theme.ts new file mode 100644 index 0000000..2dba3c1 --- /dev/null +++ b/src/shared/theme.ts @@ -0,0 +1,43 @@ +import { createGlobalStyle, ThemeProps } from "styled-components"; + +export const theme = { + fonts: { + basic: "Helvetica, sans-serif", + accent: "\"Permanent Marker\", cursive", + }, + colors: { + orange: "#f4ae40", + blue: "#387af5", + pink: "#eb57a3", + grey: "#aaa", + }, +}; + +export type MainThemeProps = ThemeProps; +export const GlobalStyle = createGlobalStyle` + body { + margin: 0; + font-family: ${({ theme }) => theme.fonts.basic}; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + *, + *::after, + *::before { box-sizing: border-box; } + + h1, h2, h3, h4, h5, h6 { margin: 0; } + a { color: ${({ theme }) => theme.colors.blue} } + a:hover { color: ${({ theme }) => theme.colors.pink} } + + input, + textarea, + button { + font-family: ${({ theme }) => theme.fonts.basic}; + } + + .main { + padding: 70px 0 20px; + min-height: calc(100vh - 50px); + } +`; diff --git a/tsconfig.json b/tsconfig.json index a273b0c..e1dad34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,9 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "noUnusedLocals": false, + "noUnusedParameters": false, }, "include": [ "src" diff --git a/yarn.lock b/yarn.lock index 3dee9ee..0db0ba4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1014,7 +1014,7 @@ core-js-pure "^3.19.0" regenerator-runtime "^0.13.4" -"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.16.3", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2": version "7.16.5" resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz" integrity sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA== @@ -1074,6 +1074,17 @@ dependencies: "@bedrock-layout/spacing-constants" "^2.5.1" +"@bedrock-layout/columns@^2.3.4": + version "2.3.4" + resolved "https://registry.yarnpkg.com/@bedrock-layout/columns/-/columns-2.3.4.tgz#805de442f9c5962dd9609d8ef8a05dd9768d7bd1" + integrity sha512-ybBW9dh5JJdop0NYMkDmdxPjtDyA/D4npjsBhpKq2zh9TyFJjImTbrkYc6X8dj4+106DXDyxxiKkU2NxYGVK2A== + dependencies: + "@bedrock-layout/spacing-constants" "^2.5.1" + "@bedrock-layout/stack" "^2.3.4" + "@bedrock-layout/type-utils" "^0.0.14" + "@bedrock-layout/use-container-query" "^1.2.14" + "@bedrock-layout/use-forwarded-ref" "^1.1.11" + "@bedrock-layout/frame@^2.2.4": version "2.2.4" resolved "https://registry.yarnpkg.com/@bedrock-layout/frame/-/frame-2.2.4.tgz#7c124718e0543ec1b53903788d040d05a9e8e1de" @@ -1086,6 +1097,48 @@ resolved "https://registry.yarnpkg.com/@bedrock-layout/spacing-constants/-/spacing-constants-2.5.1.tgz#935f552df2e741d5e1ee561ba53da17b022d94b3" integrity sha512-bGpNIwFCaVu5mrJCakwawJfjuRZWJLWDgQUBlt5o2ZyOxT6Ytr+U2DszDm3DyadelTGxJAsYWGX64xSXPcUWzw== +"@bedrock-layout/split@^2.3.5": + version "2.3.5" + resolved "https://registry.yarnpkg.com/@bedrock-layout/split/-/split-2.3.5.tgz#4b4fee46bf46e7c293a6303e75a8d5f2edb6bf7a" + integrity sha512-iwqx0MZnJ/VdrJ7ZVQjgwgnaMA8zHLpPYnz0Rj0vvbJwyxbZehMo5QdN52fiRx+gODbPOowXRUYYOEejfG/Jng== + dependencies: + "@bedrock-layout/spacing-constants" "^2.5.1" + "@bedrock-layout/stack" "^2.3.4" + "@bedrock-layout/type-utils" "^0.0.14" + "@bedrock-layout/use-container-query" "^1.2.14" + "@bedrock-layout/use-forwarded-ref" "^1.1.11" + +"@bedrock-layout/stack@^2.3.4": + version "2.3.4" + resolved "https://registry.yarnpkg.com/@bedrock-layout/stack/-/stack-2.3.4.tgz#79b6ae45358ffde79442faf31d0f76c0b4b14121" + integrity sha512-h/W7en01AMnQusoUTlZmh3Lp1rIgn8TbZ+3N5272Me2GmyMa6zrkffI4FJeJZNPy9aoRjXTLlKyT6HXzVVYzkQ== + dependencies: + "@bedrock-layout/spacing-constants" "^2.5.1" + +"@bedrock-layout/type-utils@^0.0.14": + version "0.0.14" + resolved "https://registry.yarnpkg.com/@bedrock-layout/type-utils/-/type-utils-0.0.14.tgz#63288f5cb806f50ac6409e07a3cb73ae8488566f" + integrity sha512-SaZjUFF2wAMX5mJNn2YL6WbxIKK5P79X6cFUqvlmOLPHbjzmTHsJyqFbyBNp21ykpLpHmbYDD9W55dhhh+HQEQ== + +"@bedrock-layout/use-container-query@^1.2.14": + version "1.2.14" + resolved "https://registry.yarnpkg.com/@bedrock-layout/use-container-query/-/use-container-query-1.2.14.tgz#ae57f8d253e1828480c359cb6ed0c2a289a58bd8" + integrity sha512-Sumykay3uCKcFpn3SXisxIJo4CthEvy+wdEhn06BTB3wa904wofZDsqSOEyza+Shu5HxUapxZaE2i7RYpGtN0Q== + dependencies: + "@bedrock-layout/spacing-constants" "^2.5.1" + +"@bedrock-layout/use-forwarded-ref@^1.1.11": + version "1.1.11" + resolved "https://registry.yarnpkg.com/@bedrock-layout/use-forwarded-ref/-/use-forwarded-ref-1.1.11.tgz#c649a0dc442ee7633509f1d279f55152e55e718f" + integrity sha512-FR10Q59jOzOfAk1TMSWpBAPRG35cCW57Y1gLloqwBqbYypuUICaXnYGoMCy9bBqpeBpweVJNSWVvmFhuAFzLjg== + dependencies: + "@bedrock-layout/use-stateful-ref" "^1.1.11" + +"@bedrock-layout/use-stateful-ref@^1.1.11": + version "1.1.11" + resolved "https://registry.yarnpkg.com/@bedrock-layout/use-stateful-ref/-/use-stateful-ref-1.1.11.tgz#16c08097bec069ab234043383d1ccc77a4dacd4a" + integrity sha512-yU73p/LxInc3T4ZHF/2vGrmYB0LxHEbpw9bOLG8YE8cptmnDWbxd3vTEFERts9dwD0kqV+UV2iqXzuHWwj9kiA== + "@csstools/normalize.css@*": version "12.0.0" resolved "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-12.0.0.tgz" @@ -4237,7 +4290,7 @@ eslint-plugin-react-hooks@^4.3.0: eslint-plugin-react@^7.27.1: version "7.27.1" - resolved "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.27.1.tgz" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.27.1.tgz#469202442506616f77a854d91babaae1ec174b45" integrity sha512-meyunDjMMYeWr/4EBLTV1op3iSG3mjT/pz5gti38UzfM4OPpNc2m0t2xvKCOMU5D6FSdd34BIMFOvQbW+i8GAA== dependencies: array-includes "^3.1.4" @@ -4893,6 +4946,13 @@ he@^1.2.0: resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +history@5, history@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/history/-/history-5.2.0.tgz#7cdd31cf9bac3c5d31f09c231c9928fad0007b7c" + integrity sha512-uPSF6lAJb3nSePJ43hN3eKj1dTWpN9gMod0ZssbFTIsen+WehTmEadgL+kg78xLJFdRfrrC//SavDzmRVdE+Ig== + dependencies: + "@babel/runtime" "^7.7.6" + hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.3.0: version "3.3.2" resolved "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz" @@ -7502,6 +7562,21 @@ react-refresh@^0.11.0: resolved "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz" integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A== +react-router-dom@6: + version "6.2.1" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.2.1.tgz#32ec81829152fbb8a7b045bf593a22eadf019bec" + integrity sha512-I6Zax+/TH/cZMDpj3/4Fl2eaNdcvoxxHoH1tYOREsQ22OKDYofGebrNm6CTPUcvLvZm63NL/vzCYdjf9CUhqmA== + dependencies: + history "^5.2.0" + react-router "6.2.1" + +react-router@6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.2.1.tgz#be2a97a6006ce1d9123c28934e604faef51448a3" + integrity sha512-2fG0udBtxou9lXtK97eJeET2ki5//UWfQSl1rlJ7quwe6jrktK9FCCc8dQb5QY6jAv3jua8bBQRhhDOM/kVRsg== + dependencies: + history "^5.2.0" + react-scripts@5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/react-scripts/-/react-scripts-5.0.0.tgz" From 4d35b57a7734ddca098d7986dad61fa03a2da4c8 Mon Sep 17 00:00:00 2001 From: Kyle Geib Date: Mon, 20 Dec 2021 16:49:49 -0500 Subject: [PATCH 2/2] ISSUE-001 - Have tool page constructed with grid and added some basic scrolling rules for minimum UI size requirements. --- src/components/Broadcast/Layout/Layout.tsx | 73 ++++++++----------- src/components/Broadcast/Layout/styles.ts | 33 ++++++--- src/components/Common/MockupBlock.styled.ts | 3 +- .../Common/RouteHeader/RouteHeader.tsx | 6 +- src/components/Common/RouteHeader/styles.ts | 6 +- src/routes/BroadcastRoute.tsx | 2 +- src/routes/styles.ts | 19 ++++- 7 files changed, 79 insertions(+), 63 deletions(-) diff --git a/src/components/Broadcast/Layout/Layout.tsx b/src/components/Broadcast/Layout/Layout.tsx index fc194cb..b518866 100644 --- a/src/components/Broadcast/Layout/Layout.tsx +++ b/src/components/Broadcast/Layout/Layout.tsx @@ -1,58 +1,43 @@ -import { Stack } from "@bedrock-layout/stack"; -import { Column, Columns } from "@bedrock-layout/columns"; - import { MockupBlock } from "../../Common/MockupBlock.styled"; -import { ExpandedStack, ExpandedBlock } from "./styles"; +import { LayoutGrid, LayoutGridItem } from "./styles"; type LayoutProps = { headerHeight?: number, }; export function Layout({ headerHeight }: LayoutProps) { - const headerOffset = headerHeight ? headerHeight + 5 : 0; - return ( - - + + Timing Board UI - - Video Feed - - - - - - - Race Status UI - - - Race Director UI - - - - - Broadcast Director UI - - - + + + + Video Feed + + + + Race Status UI + + + + Race Director UI + + + + Broadcast Director UI + + ); } diff --git a/src/components/Broadcast/Layout/styles.ts b/src/components/Broadcast/Layout/styles.ts index f024469..65fafb0 100644 --- a/src/components/Broadcast/Layout/styles.ts +++ b/src/components/Broadcast/Layout/styles.ts @@ -1,14 +1,29 @@ import styled from "styled-components"; -export const ExpandedStack = styled.div` - display: flex; - flex-flow: column; - /* height: 100%; */ +type LayoutGridProps = { + columns?: number, + rows?: number, + headerOffset?: number, +}; +export const LayoutGrid = styled.div` + --columns: ${({ columns = 1 }) => columns}; + --rows: ${({ rows = 1 }) => rows}; + display: grid; + grid-template-columns: repeat(var(--columns), 1fr); + grid-template-rows: repeat(var(--rows), 1fr); + height: calc(100% - ${({ headerOffset = 0 }) => headerOffset}px); + width: 100%; `; -export const ExpandedBlock = styled.div` - /* flex: 1 1 auto; */ - flex-grow: 1; - /* flex-shrink: 1; - flex-basis: auto; */ +type LayoutGridItemProps = { + column: number, + columnSpan?: number, + row: number, + rowSpan?: number, +}; +export const LayoutGridItem = styled.div` + grid-column: ${({ column }) => column} + / span ${({ columnSpan = 1 }) => columnSpan}; + grid-row: ${({ row }) => row} + / span ${({ rowSpan = 1 }) => rowSpan};; `; diff --git a/src/components/Common/MockupBlock.styled.ts b/src/components/Common/MockupBlock.styled.ts index e5a0fc1..cd80f65 100644 --- a/src/components/Common/MockupBlock.styled.ts +++ b/src/components/Common/MockupBlock.styled.ts @@ -9,11 +9,10 @@ type MockupBlockProps = { }; export const MockupBlock = styled.div` - display: flex; min-height: ${({ minHeight }) => minHeight ?? "0"}; min-width: ${({ minWidth }) => minWidth ?? "0"}; height: ${({ height }) => height ?? "100%"}; width: ${({ width }) => width ?? "100%"}; background-color: ${({ color }) => color}; - flex: 1 1 auto; + padding: 0.3em; `; diff --git a/src/components/Common/RouteHeader/RouteHeader.tsx b/src/components/Common/RouteHeader/RouteHeader.tsx index e9a7e3d..3f42a2c 100644 --- a/src/components/Common/RouteHeader/RouteHeader.tsx +++ b/src/components/Common/RouteHeader/RouteHeader.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { Container } from "./styles"; +import { HeaderBar } from "./styles"; type RouteHeaderProps = { title: string, @@ -7,9 +7,9 @@ type RouteHeaderProps = { export const RouteHeader = React.forwardRef( (props, ref) => ( - + {props.title} - + ), ); RouteHeader.displayName = "RouteHeader"; // Required due to forwardRef(). diff --git a/src/components/Common/RouteHeader/styles.ts b/src/components/Common/RouteHeader/styles.ts index 2c789a2..5fca116 100644 --- a/src/components/Common/RouteHeader/styles.ts +++ b/src/components/Common/RouteHeader/styles.ts @@ -1,11 +1,13 @@ import styled from "styled-components"; -export const Container = styled.header` +export const HeaderBar = styled.header` top: 0; left: 0; right: 0; z-index: 5; - padding: 0; + padding: 0 0.3em; background-color: ${p => p.theme.colors.grey}; height: 20px; + font-family: ${p => p.theme.fonts.accent}; + font-size: 0.8em; `; diff --git a/src/routes/BroadcastRoute.tsx b/src/routes/BroadcastRoute.tsx index 329c575..8ba84dc 100644 --- a/src/routes/BroadcastRoute.tsx +++ b/src/routes/BroadcastRoute.tsx @@ -14,7 +14,7 @@ export default function Broadcast() { }); return ( - + diff --git a/src/routes/styles.ts b/src/routes/styles.ts index 821e8d9..c7c1b34 100644 --- a/src/routes/styles.ts +++ b/src/routes/styles.ts @@ -1,7 +1,22 @@ import styled from "styled-components"; -export const FullScreenContainer = styled.div` - overflow: hidden; +type FullScreenContainerProps = { + minHeight?: number, + minWidth?: number, +} + +export const FullScreenContainer = styled.div < FullScreenContainerProps>` + --minHeight: ${({ minHeight = 0 }) => `${minHeight}px`}; + --minWidth: ${({ minWidth = 0 }) => `${minWidth}px`}; + --overflowY: ${({ minHeight }) => minHeight ? "scroll" : "hidden" }; + --overflowX: ${({ minWidth }) => minWidth ? "scroll" : "hidden" }; + height: 100vh; width: 100%; + + /* Demand a minimum width/height and scroll to support them. */ + min-height: var(--minHeight); + min-width: var(--minWidth); + overflow-y: var(--overflowY); + overflow-x: var(--overflowX); `;