ISSUE-005 - Initial work commit. Have some basic routing done and some mocked-up design of how the pay may look.
Made improvements to the LayoutGrid component, supporting richer definition of grid columns and rows.
This commit is contained in:
1 parent
262aca9d73
commit
02132bdbe2
13 files changed
+122
-39
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
import { FullScreenContainer } from "./styles";
|
||||
import { Layout } from "../components/Broadcast/Layout";
|
||||
import { menuSelector } from "../features/pageDimensions/pageDimensionsSelector";
|
||||
import { FullScreenContainer } from "../Common/FullScreenContainer.styled";
|
||||
import { Layout } from "./Layout";
|
||||
import { menuSelector } from "../../features/pageDimensions/pageDimensionsSelector";
|
||||
|
||||
export default function Broadcast() {
|
||||
const { height } = useSelector(menuSelector);
|
||||
@@ -1,6 +1,6 @@
|
||||
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
||||
import VideoFeed from "../VideoFeed/VideoFeed";
|
||||
import { LayoutGrid, LayoutGridItem } from "./styles";
|
||||
import { LayoutGrid, LayoutGridItem } from "../../Common/LayoutGrid.styled";
|
||||
|
||||
type LayoutProps = {
|
||||
headerHeight?: number,
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
import styled from "styled-components";
|
||||
|
||||
type LayoutGridProps = {
|
||||
columns?: number,
|
||||
rows?: number,
|
||||
headerOffset?: number,
|
||||
};
|
||||
export const LayoutGrid = styled.div<LayoutGridProps>`
|
||||
--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%;
|
||||
`;
|
||||
LayoutGrid.displayName = "LayoutGrid";
|
||||
|
||||
type LayoutGridItemProps = {
|
||||
column: number,
|
||||
columnSpan?: number,
|
||||
row: number,
|
||||
rowSpan?: number,
|
||||
};
|
||||
export const LayoutGridItem = styled.div<LayoutGridItemProps>`
|
||||
grid-column: ${({ column }) => column}
|
||||
/ span ${({ columnSpan = 1 }) => columnSpan};
|
||||
grid-row: ${({ row }) => row}
|
||||
/ span ${({ rowSpan = 1 }) => rowSpan};;
|
||||
`;
|
||||
LayoutGridItem.displayName = "LayoutGridItem";
|
||||
@@ -10,8 +10,8 @@ type FullScreenContainerProps = {
|
||||
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" };
|
||||
--overflowY: ${({ minHeight }) => minHeight ? "scroll" : "hidden"};
|
||||
--overflowX: ${({ minWidth }) => minWidth ? "scroll" : "hidden"};
|
||||
--heightCutoff: ${({ heightCutoff = 0 }) => `${heightCutoff}px`};
|
||||
--widthCutoff: ${({ widthCutoff = 0 }) => `${widthCutoff}px`};
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import styled from "styled-components";
|
||||
|
||||
type SizeProp = number | Array<number | string>;
|
||||
|
||||
/**
|
||||
* Slickly handle different values
|
||||
* @param prop a number will use 1fr repeated. An array will interpret numbers
|
||||
* as fractions. Else you can define anything with strings (such as "100px").
|
||||
* @returns
|
||||
*/
|
||||
const parseSize = (prop: SizeProp): string => {
|
||||
if (typeof prop === "number") {
|
||||
return `repeat(${prop}, 1fr)`;
|
||||
}
|
||||
if (Array.isArray(prop)) {
|
||||
return prop.map(value => {
|
||||
if (typeof value === "number") {
|
||||
return value + "fr";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}).join(" ");
|
||||
}
|
||||
return "1";
|
||||
};
|
||||
|
||||
type LayoutGridProps = {
|
||||
columns?: SizeProp,
|
||||
rows?: SizeProp,
|
||||
headerOffset?: number,
|
||||
};
|
||||
export const LayoutGrid = styled.div<LayoutGridProps>`
|
||||
display: grid;
|
||||
grid-template-columns: ${({ columns = 1 }) => parseSize(columns)};
|
||||
grid-template-rows: ${({ rows = 1 }) => parseSize(rows)};
|
||||
height: calc(100% - ${({ headerOffset = 0 }) => headerOffset}px);
|
||||
width: 100%;
|
||||
`;
|
||||
LayoutGrid.displayName = "LayoutGrid";
|
||||
|
||||
type LayoutGridItemProps = {
|
||||
column: number,
|
||||
columnSpan?: number,
|
||||
row: number,
|
||||
rowSpan?: number,
|
||||
};
|
||||
export const LayoutGridItem = styled.div<LayoutGridItemProps>`
|
||||
grid-column: ${({ column }) => column}
|
||||
/ span ${({ columnSpan = 1 }) => columnSpan};
|
||||
grid-row: ${({ row }) => row}
|
||||
/ span ${({ rowSpan = 1 }) => rowSpan};;
|
||||
`;
|
||||
LayoutGridItem.displayName = "LayoutGridItem";
|
||||
@@ -15,6 +15,7 @@ export const MainMenu = React.forwardRef<HTMLDivElement>(
|
||||
links={[
|
||||
{ label: "Home", to: "/" },
|
||||
{ label: "Broadcast Page", to: "/broadcast" },
|
||||
{ label: "Workspaces", to: "/workspaces" },
|
||||
]}
|
||||
/>
|
||||
),
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { WorkspaceListBox } from "./styles";
|
||||
|
||||
export const WorkspaceList = () => (
|
||||
<WorkspaceListBox>
|
||||
<ul>
|
||||
<li>what</li>
|
||||
<li>what</li>
|
||||
</ul>
|
||||
</WorkspaceListBox>
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./WorkspaceList";
|
||||
@@ -0,0 +1,11 @@
|
||||
import styled from "styled-components";
|
||||
import { PadBox } from "@bedrock-layout/padbox";
|
||||
|
||||
export const WorkspaceListBox = styled(PadBox).attrs(() => ({
|
||||
padding: ["lg", "sm"],
|
||||
}))`
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-image: linear-gradient(to bottom, #f0f0f0, #fff);
|
||||
border-right: 1px solid ${p => p.theme.colors.darkGrey};
|
||||
`;
|
||||
@@ -0,0 +1,25 @@
|
||||
import { useSelector } from "react-redux";
|
||||
import { Outlet } from "react-router-dom";
|
||||
|
||||
import { menuSelector } from "../../features/pageDimensions/pageDimensionsSelector";
|
||||
|
||||
import { FullScreenContainer } from "../Common/FullScreenContainer.styled";
|
||||
import { WorkspaceList } from "./WorkspaceList";
|
||||
import { LayoutGrid, LayoutGridItem } from "../Common/LayoutGrid.styled";
|
||||
|
||||
export default function Workspaces() {
|
||||
const { height } = useSelector(menuSelector);
|
||||
|
||||
return (
|
||||
<FullScreenContainer minHeight={700} minWidth={900} heightCutoff={height}>
|
||||
<LayoutGrid columns={[1, 5]} rows={1}>
|
||||
<LayoutGridItem column={1} row={1}>
|
||||
<WorkspaceList />
|
||||
</LayoutGridItem>
|
||||
<LayoutGridItem column={2} row={1}>
|
||||
<Outlet />
|
||||
</LayoutGridItem>
|
||||
</LayoutGrid>
|
||||
</FullScreenContainer>
|
||||
);
|
||||
}
|
||||
+7
-2
@@ -7,7 +7,9 @@ import { ThemeProvider } from "styled-components";
|
||||
import "./clear.css";
|
||||
|
||||
import App from "./App";
|
||||
import Broadcast from "./routes/BroadcastRoute";
|
||||
import Broadcast from "./components/Broadcast/BroadcastRoute";
|
||||
import Workspaces from "./components/Workspaces/WorkspacesRoute";
|
||||
|
||||
import { GlobalStyle, theme } from "./shared/theme";
|
||||
import { GlobalFonts } from "./fonts";
|
||||
import { store } from "./store";
|
||||
@@ -21,7 +23,10 @@ ReactDOM.render(
|
||||
<BrowserRouter>
|
||||
<Routes>
|
||||
<Route path="/" element={<App />} >
|
||||
<Route path="/broadcast" element={<Broadcast />} />
|
||||
<Route path="broadcast" element={<Broadcast />} />
|
||||
<Route path="workspaces" element={<Workspaces />}>
|
||||
<Route path=":workspaceName" element={<div>What</div>} />
|
||||
</Route>
|
||||
</Route>
|
||||
</Routes>
|
||||
</BrowserRouter>
|
||||
|
||||
Reference in new issue
Block a user