From 4d35b57a7734ddca098d7986dad61fa03a2da4c8 Mon Sep 17 00:00:00 2001 From: Kyle Geib Date: Mon, 20 Dec 2021 16:49:49 -0500 Subject: [PATCH] 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); `;