ISSUE-005 - Implemented a PreviewWindow component. Improvements to the way that the workspaces are generated. Using mock components.
This commit is contained in:
1 parent
5dcc3f3940
commit
ab4c8eefa6
9 files changed
+109
-9
No files matched your search
@@ -4,6 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bedrock-layout/appboundary": "^2.2.4",
|
"@bedrock-layout/appboundary": "^2.2.4",
|
||||||
|
"@bedrock-layout/center": "^2.2.5",
|
||||||
"@bedrock-layout/columns": "^2.3.4",
|
"@bedrock-layout/columns": "^2.3.4",
|
||||||
"@bedrock-layout/cover": "^2.2.5",
|
"@bedrock-layout/cover": "^2.2.5",
|
||||||
"@bedrock-layout/frame": "^2.2.4",
|
"@bedrock-layout/frame": "^2.2.4",
|
||||||
|
|||||||
@@ -1,7 +1,32 @@
|
|||||||
import { useParams } from "react-router-dom";
|
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 = () => {
|
export const Workspace = () => {
|
||||||
const params = useParams();
|
const { workspaceId } = useParams();
|
||||||
return <h1>{params.workspaceName}</h1>;
|
return (
|
||||||
|
<Stack
|
||||||
|
gutter="lg"
|
||||||
|
as={Center}
|
||||||
|
maxWidth="80%"
|
||||||
|
centerChildren
|
||||||
|
>
|
||||||
|
<H2>{workspaceId ? workspaceObject[workspaceId] : ""}</H2>
|
||||||
|
<PreviewWindow height={600} width={800}>
|
||||||
|
<MockupBlock
|
||||||
|
color="#415bad"
|
||||||
|
height="300px"
|
||||||
|
width="400px"
|
||||||
|
>Preview Item</MockupBlock>
|
||||||
|
</PreviewWindow>
|
||||||
|
<WorkspaceControls />
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { MockupBlock } from "../../Common/MockupBlock.styled";
|
||||||
|
|
||||||
|
export const WorkspaceControls = () => (
|
||||||
|
<MockupBlock
|
||||||
|
color="#aa5a5a"
|
||||||
|
width="400px"
|
||||||
|
height="80px"
|
||||||
|
>
|
||||||
|
WorkspaceControls
|
||||||
|
</MockupBlock>
|
||||||
|
);
|
||||||
@@ -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",
|
||||||
|
}))<PreviewWindowProps>`
|
||||||
|
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;
|
||||||
|
`;
|
||||||
@@ -2,15 +2,14 @@ import { WorkspaceListBox } from "./styles";
|
|||||||
import { Stack } from "@bedrock-layout/stack";
|
import { Stack } from "@bedrock-layout/stack";
|
||||||
import { NavLink } from "react-router-dom";
|
import { NavLink } from "react-router-dom";
|
||||||
import { MenuItem } from "../../Common/MenuItem.styled";
|
import { MenuItem } from "../../Common/MenuItem.styled";
|
||||||
|
import { workspaceList } from "../workspaces";
|
||||||
|
|
||||||
export const WorkspaceList = () => (
|
export const WorkspaceList = () => (
|
||||||
<WorkspaceListBox>
|
<WorkspaceListBox>
|
||||||
<Stack as="ul" gutter="md">
|
<Stack as="ul" gutter="md">
|
||||||
<WorkspaceListNavLink to="workspace1" label="Workspace 1" />
|
{workspaceList.map((workspace, i) => (
|
||||||
<WorkspaceListNavLink to="workspace2" label="Workspace 2" />
|
<WorkspaceListNavLink key={i} to={workspace.id} label={workspace.name} />
|
||||||
<WorkspaceListNavLink to="workspace3" label="Workspace 3" />
|
))}
|
||||||
<WorkspaceListNavLink to="workspace4" label="Workspace 4" />
|
|
||||||
<WorkspaceListNavLink to="workspace5" label="Workspace 5 is longer than the rest" />
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</WorkspaceListBox>
|
</WorkspaceListBox>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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);
|
||||||
+1
-1
@@ -28,7 +28,7 @@ ReactDOM.render(
|
|||||||
<Route path="broadcast" element={<Broadcast />} />
|
<Route path="broadcast" element={<Broadcast />} />
|
||||||
<Route path="workspaces" element={<Workspaces />}>
|
<Route path="workspaces" element={<Workspaces />}>
|
||||||
<Route index element={<h1>Workspaces Home</h1>} />
|
<Route index element={<h1>Workspaces Home</h1>} />
|
||||||
<Route path=":workspaceName" element={<Workspace />} />
|
<Route path=":workspaceId" element={<Workspace />} />
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="*" element={<h1>Page Not Found</h1>} />
|
<Route path="*" element={<h1>Page Not Found</h1>} />
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -1081,6 +1081,13 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@bedrock-layout/spacing-constants" "^2.5.1"
|
"@bedrock-layout/spacing-constants" "^2.5.1"
|
||||||
|
|
||||||
|
"@bedrock-layout/center@^2.2.5":
|
||||||
|
version "2.2.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/center/-/center-2.2.5.tgz#a559215267ae6e008cadc790b8b287c74d99dcd0"
|
||||||
|
integrity sha512-Y3fXSFdwcxZh1A+VED/itwT5gAmlfuD0+5/hGV1/iHPvR8qCtZ7fbx/YyjA3Jb0P+NRX6sXrq5dCWv54fxvNMQ==
|
||||||
|
dependencies:
|
||||||
|
"@bedrock-layout/spacing-constants" "^2.5.1"
|
||||||
|
|
||||||
"@bedrock-layout/columns@^2.3.4":
|
"@bedrock-layout/columns@^2.3.4":
|
||||||
version "2.3.4"
|
version "2.3.4"
|
||||||
resolved "https://registry.yarnpkg.com/@bedrock-layout/columns/-/columns-2.3.4.tgz#805de442f9c5962dd9609d8ef8a05dd9768d7bd1"
|
resolved "https://registry.yarnpkg.com/@bedrock-layout/columns/-/columns-2.3.4.tgz#805de442f9c5962dd9609d8ef8a05dd9768d7bd1"
|
||||||
|
|||||||
Reference in new issue
Block a user