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
@@ -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 <h1>{params.workspaceName}</h1>;
|
||||
|
||||
const { workspaceId } = useParams();
|
||||
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 { NavLink } from "react-router-dom";
|
||||
import { MenuItem } from "../../Common/MenuItem.styled";
|
||||
import { workspaceList } from "../workspaces";
|
||||
|
||||
export const WorkspaceList = () => (
|
||||
<WorkspaceListBox>
|
||||
<Stack as="ul" gutter="md">
|
||||
<WorkspaceListNavLink to="workspace1" label="Workspace 1" />
|
||||
<WorkspaceListNavLink to="workspace2" label="Workspace 2" />
|
||||
<WorkspaceListNavLink to="workspace3" label="Workspace 3" />
|
||||
<WorkspaceListNavLink to="workspace4" label="Workspace 4" />
|
||||
<WorkspaceListNavLink to="workspace5" label="Workspace 5 is longer than the rest" />
|
||||
{workspaceList.map((workspace, i) => (
|
||||
<WorkspaceListNavLink key={i} to={workspace.id} label={workspace.name} />
|
||||
))}
|
||||
</Stack>
|
||||
</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);
|
||||
Reference in new issue
Block a user