From ab4c8eefa62a5b88ab6a6ffd002e76e69a8fb22f Mon Sep 17 00:00:00 2001 From: Kyle Geib Date: Fri, 7 Jan 2022 18:03:27 -0500 Subject: [PATCH] ISSUE-005 - Implemented a PreviewWindow component. Improvements to the way that the workspaces are generated. Using mock components. --- package.json | 1 + .../Workspaces/Workspace/Workspace.tsx | 31 ++++++++++++++++-- .../Workspace/WorkspaceControls.tsx | 11 +++++++ src/components/Workspaces/Workspace/styles.ts | 29 ++++++++++++++++ .../WorkspaceList/WorkspaceList.tsx | 9 +++-- src/components/Workspaces/workspaces.ts | 28 ++++++++++++++++ src/index.tsx | 2 +- src/public/images/misc/checker-40x40.png | Bin 0 -> 2852 bytes yarn.lock | 7 ++++ 9 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 src/components/Workspaces/Workspace/WorkspaceControls.tsx create mode 100644 src/components/Workspaces/Workspace/styles.ts create mode 100644 src/components/Workspaces/workspaces.ts create mode 100644 src/public/images/misc/checker-40x40.png diff --git a/package.json b/package.json index 13b7adc..057ca60 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@bedrock-layout/appboundary": "^2.2.4", + "@bedrock-layout/center": "^2.2.5", "@bedrock-layout/columns": "^2.3.4", "@bedrock-layout/cover": "^2.2.5", "@bedrock-layout/frame": "^2.2.4", diff --git a/src/components/Workspaces/Workspace/Workspace.tsx b/src/components/Workspaces/Workspace/Workspace.tsx index d280c63..ff1a249 100644 --- a/src/components/Workspaces/Workspace/Workspace.tsx +++ b/src/components/Workspaces/Workspace/Workspace.tsx @@ -1,7 +1,32 @@ import { useParams } from "react-router-dom"; +import { Cover } from "@bedrock-layout/cover"; +import { Center } from "@bedrock-layout/center"; +import { Stack } from "@bedrock-layout/stack"; + +import { PreviewWindow, H2 } from "./styles"; +import { WorkspaceControls } from "./WorkspaceControls"; +import { MockupBlock } from "../../Common/MockupBlock.styled"; + +import { workspaceObject } from "../workspaces"; export const Workspace = () => { - const params = useParams(); - return

{params.workspaceName}

; - + const { workspaceId } = useParams(); + return ( + +

{workspaceId ? workspaceObject[workspaceId] : ""}

+ + Preview Item + + +
+ ); }; diff --git a/src/components/Workspaces/Workspace/WorkspaceControls.tsx b/src/components/Workspaces/Workspace/WorkspaceControls.tsx new file mode 100644 index 0000000..82aa46c --- /dev/null +++ b/src/components/Workspaces/Workspace/WorkspaceControls.tsx @@ -0,0 +1,11 @@ +import { MockupBlock } from "../../Common/MockupBlock.styled"; + +export const WorkspaceControls = () => ( + + WorkspaceControls + +); diff --git a/src/components/Workspaces/Workspace/styles.ts b/src/components/Workspaces/Workspace/styles.ts new file mode 100644 index 0000000..e4f3f3c --- /dev/null +++ b/src/components/Workspaces/Workspace/styles.ts @@ -0,0 +1,29 @@ +import styled from "styled-components"; +import { PadBox } from "@bedrock-layout/padbox"; + +import bg from "../../../public/images/misc/checker-40x40.png"; + +export type PreviewWindowProps = { + height: number, + width: number, +}; +export const PreviewWindow = styled(PadBox).attrs(() => ({ + padding: "lg", +}))` + display: flex; + justify-content: center; + align-items: center; + + height: ${({ height }) => height}px; + width: ${({ width }) => width}px; + + border-radius: 2em; + background-image: url("${bg}"); +`; + +export const H2 = styled.h2` + margin: 0.2em; + color: ${p => p.theme.colors.darkGrey}; + font-family: ${p => p.theme.fonts.f1Regular}; + max-inline-size: 600px; +`; diff --git a/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx b/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx index b3fb792..b620190 100644 --- a/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx +++ b/src/components/Workspaces/WorkspaceList/WorkspaceList.tsx @@ -2,15 +2,14 @@ import { WorkspaceListBox } from "./styles"; import { Stack } from "@bedrock-layout/stack"; import { NavLink } from "react-router-dom"; import { MenuItem } from "../../Common/MenuItem.styled"; +import { workspaceList } from "../workspaces"; export const WorkspaceList = () => ( - - - - - + {workspaceList.map((workspace, i) => ( + + ))} ); diff --git a/src/components/Workspaces/workspaces.ts b/src/components/Workspaces/workspaces.ts new file mode 100644 index 0000000..4189823 --- /dev/null +++ b/src/components/Workspaces/workspaces.ts @@ -0,0 +1,28 @@ +export const workspaceList = [ + { + name: "Workspace 1", + id: "workspace1", + }, + { + name: "Workspace 2", + id: "workspace2", + }, + { + name: "Workspace 3", + id: "workspace3", + }, + { + name: "Workspace 4 has a longer name than the rest", + id: "workspace4", + }, +]; + +export const workspaceObject = ((list: typeof workspaceList) => { + const obj: {[key: string]: string} = {}; + list.forEach(item => { + obj[item.id] = item.name; + }); + console.log("workspaceObject", obj); + return obj; +})(workspaceList); +console.log(workspaceObject); diff --git a/src/index.tsx b/src/index.tsx index e9cb396..735b07f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -28,7 +28,7 @@ ReactDOM.render( } /> }> Workspaces Home} /> - } /> + } /> Page Not Found} /> diff --git a/src/public/images/misc/checker-40x40.png b/src/public/images/misc/checker-40x40.png new file mode 100644 index 0000000000000000000000000000000000000000..1b213216f0da6e0dc8c2b6d2576bf1164507386e GIT binary patch literal 2852 zcmV+<3)}RGP)StO&>uS)ve<0AYj>5AR{$W90N^4L=L-RlQUJ&DC0@ZjPh;=*jPLSYvv5M~MFBAl0-BNIsH z15C~g000{K(ZT*WKal6<?_01!^k@7iDG<<3=fuAC~28EsPoqkpK{9G%|Vj005J}`Hw&=0RYXHq~ibpyyzHQsFW8>#s~laM4*8xut5h5 z!4#~(4xGUqyucR%VFpA%3?#rj5JCpzfE)^;7?wd9RKPme1hudO8lVxH;SjXJF*pt9 z;1XPc>u?taU>Kgl7`%oF1VP9M6Ja4bh!J9r*dopd7nzO(B4J20l7OTj>4+3jBE`sZ zqynizYLQ(?Bl0bB6giDtK>Co|$RIL`{EECsF_eL_Q3KQhbwIhO9~z3rpmWi5G!I>X zmZEFX8nhlgfVQHi(M#xcbO3#dj$?q)F%D*o*1Pf{>6$SWH+$s3q(pv=X`qR|$iJF~TPzlc-O$C3+J1 z#CT#lv5;6stS0Uu9wDA3UMCI{Uz12A4#|?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