ISSUE-005 - Added a scrolling effect to the PreviewWindow. Added scroll functionality to overflow-y for the WorkspaceList box.
This commit is contained in:
1 parent
ab4c8eefa6
commit
7c2654ba51
6 files changed
+61
-12
No files matched your search
@@ -18,8 +18,8 @@ export const Workspace = () => {
|
|||||||
maxWidth="80%"
|
maxWidth="80%"
|
||||||
centerChildren
|
centerChildren
|
||||||
>
|
>
|
||||||
<H2>{workspaceId ? workspaceObject[workspaceId] : ""}</H2>
|
<H2>{workspaceId ? workspaceObject[workspaceId] : "Unknown"}</H2>
|
||||||
<PreviewWindow height={600} width={800}>
|
<PreviewWindow height={600} width={800} animatedBG>
|
||||||
<MockupBlock
|
<MockupBlock
|
||||||
color="#415bad"
|
color="#415bad"
|
||||||
height="300px"
|
height="300px"
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
import styled from "styled-components";
|
import styled, { css, keyframes } from "styled-components";
|
||||||
import { PadBox } from "@bedrock-layout/padbox";
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
|
|
||||||
import bg from "../../../public/images/misc/checker-40x40.png";
|
import bg from "../../../public/images/misc/checker-40x40.png";
|
||||||
|
|
||||||
|
const scrollAnimation = keyframes`
|
||||||
|
from { background-position: 0 0; }
|
||||||
|
to { background-position: 80px -40px; }
|
||||||
|
`;
|
||||||
|
|
||||||
export type PreviewWindowProps = {
|
export type PreviewWindowProps = {
|
||||||
height: number,
|
height: number,
|
||||||
width: number,
|
width: number,
|
||||||
|
animatedBG?: boolean,
|
||||||
};
|
};
|
||||||
export const PreviewWindow = styled(PadBox).attrs(() => ({
|
export const PreviewWindow = styled(PadBox).attrs(() => ({
|
||||||
padding: "lg",
|
padding: "lg",
|
||||||
@@ -17,8 +23,15 @@ export const PreviewWindow = styled(PadBox).attrs(() => ({
|
|||||||
height: ${({ height }) => height}px;
|
height: ${({ height }) => height}px;
|
||||||
width: ${({ width }) => width}px;
|
width: ${({ width }) => width}px;
|
||||||
|
|
||||||
border-radius: 2em;
|
border-radius: 1em;
|
||||||
|
|
||||||
background-image: url("${bg}");
|
background-image: url("${bg}");
|
||||||
|
background-position: 0px 0px;
|
||||||
|
background-repeat: repeat;
|
||||||
|
|
||||||
|
${({ animatedBG }) => animatedBG && css`
|
||||||
|
animation: ${scrollAnimation} 5s linear infinite;
|
||||||
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const H2 = styled.h2`
|
export const H2 = styled.h2`
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ import { NavLink } from "react-router-dom";
|
|||||||
import { MenuItem } from "../../Common/MenuItem.styled";
|
import { MenuItem } from "../../Common/MenuItem.styled";
|
||||||
import { workspaceList } from "../workspaces";
|
import { workspaceList } from "../workspaces";
|
||||||
|
|
||||||
export const WorkspaceList = () => (
|
type WorkspaceListProps = {
|
||||||
<WorkspaceListBox>
|
headerOffset?: number,
|
||||||
|
};
|
||||||
|
export const WorkspaceList = ({ headerOffset }: WorkspaceListProps) => (
|
||||||
|
<WorkspaceListBox headerOffset={headerOffset}>
|
||||||
<Stack as="ul" gutter="md">
|
<Stack as="ul" gutter="md">
|
||||||
{workspaceList.map((workspace, i) => (
|
{workspaceList.map((workspace, i) => (
|
||||||
<WorkspaceListNavLink key={i} to={workspace.id} label={workspace.name} />
|
<WorkspaceListNavLink key={i} to={workspace.id} label={workspace.name} />
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import { PadBox } from "@bedrock-layout/padbox";
|
import { PadBox } from "@bedrock-layout/padbox";
|
||||||
|
|
||||||
|
type WorkspaceListBoxProps = {
|
||||||
|
headerOffset?: number,
|
||||||
|
};
|
||||||
export const WorkspaceListBox = styled(PadBox).attrs(() => ({
|
export const WorkspaceListBox = styled(PadBox).attrs(() => ({
|
||||||
padding: ["lg", "md"],
|
padding: ["lg", "md"],
|
||||||
}))`
|
}))<WorkspaceListBoxProps>`
|
||||||
height: 100%;
|
height: calc(100vh - ${({ headerOffset = 0 }) => `${headerOffset}px`});
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-image: linear-gradient(to bottom, #f0f0f0, #fff);
|
background-image: linear-gradient(to bottom, #f0f0f0, #fff);
|
||||||
border-right: 1px solid ${p => p.theme.colors.darkGrey};
|
border-right: 1px solid ${p => p.theme.colors.darkGrey};
|
||||||
|
overflow-y: scroll;
|
||||||
`;
|
`;
|
||||||
|
WorkspaceListBox.displayName = "WorkspaceListBox";
|
||||||
@@ -12,9 +12,9 @@ export default function Workspaces() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<FullScreenContainer minHeight={700} minWidth={900} heightCutoff={height}>
|
<FullScreenContainer minHeight={700} minWidth={900} heightCutoff={height}>
|
||||||
<LayoutGrid columns={["180px", 5]} rows={1}>
|
<LayoutGrid columns={["180px", 1]} rows={1}>
|
||||||
<LayoutGridItem column={1} row={1}>
|
<LayoutGridItem column={1} row={1}>
|
||||||
<WorkspaceList />
|
<WorkspaceList headerOffset={height} />
|
||||||
</LayoutGridItem>
|
</LayoutGridItem>
|
||||||
<LayoutGridItem column={2} row={1}>
|
<LayoutGridItem column={2} row={1}>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
|
|||||||
@@ -15,6 +15,36 @@ export const workspaceList = [
|
|||||||
name: "Workspace 4 has a longer name than the rest",
|
name: "Workspace 4 has a longer name than the rest",
|
||||||
id: "workspace4",
|
id: "workspace4",
|
||||||
},
|
},
|
||||||
|
{ name: "blah", id: "blah0" },
|
||||||
|
{ name: "blah", id: "blah1" },
|
||||||
|
{ name: "blah", id: "blah2" },
|
||||||
|
{ name: "blah", id: "blah3" },
|
||||||
|
{ name: "blah", id: "blah4" },
|
||||||
|
{ name: "blah", id: "blah5" },
|
||||||
|
{ name: "blah", id: "blah6" },
|
||||||
|
{ name: "blah", id: "blah7" },
|
||||||
|
{ name: "blah", id: "blah8" },
|
||||||
|
{ name: "blah", id: "blah9" },
|
||||||
|
{ name: "blah", id: "blah10" },
|
||||||
|
{ name: "blah", id: "blah11" },
|
||||||
|
{ name: "blah", id: "blah12" },
|
||||||
|
{ name: "blah", id: "blah13" },
|
||||||
|
{ name: "blah", id: "blah14" },
|
||||||
|
{ name: "blah", id: "blah15" },
|
||||||
|
{ name: "blah", id: "blah16" },
|
||||||
|
{ name: "blah", id: "blah17" },
|
||||||
|
{ name: "blah", id: "blah18" },
|
||||||
|
{ name: "blah", id: "blah19" },
|
||||||
|
{ name: "blah", id: "blah20" },
|
||||||
|
{ name: "blah", id: "blah21" },
|
||||||
|
{ name: "blah", id: "blah22" },
|
||||||
|
{ name: "blah", id: "blah23" },
|
||||||
|
{ name: "blah", id: "blah24" },
|
||||||
|
{ name: "blah", id: "blah25" },
|
||||||
|
{ name: "blah", id: "blah26" },
|
||||||
|
{ name: "blah", id: "blah27" },
|
||||||
|
{ name: "blah", id: "blah28" },
|
||||||
|
{ name: "blah", id: "blah29" },
|
||||||
];
|
];
|
||||||
|
|
||||||
export const workspaceObject = ((list: typeof workspaceList) => {
|
export const workspaceObject = ((list: typeof workspaceList) => {
|
||||||
@@ -22,7 +52,5 @@ export const workspaceObject = ((list: typeof workspaceList) => {
|
|||||||
list.forEach(item => {
|
list.forEach(item => {
|
||||||
obj[item.id] = item.name;
|
obj[item.id] = item.name;
|
||||||
});
|
});
|
||||||
console.log("workspaceObject", obj);
|
|
||||||
return obj;
|
return obj;
|
||||||
})(workspaceList);
|
})(workspaceList);
|
||||||
console.log(workspaceObject);
|
|
||||||
Reference in new issue
Block a user