From 36d4eb07670a8bedc913251adb9125d54d815c7a Mon Sep 17 00:00:00 2001 From: moklick Date: Tue, 6 Oct 2020 10:58:50 +0200 Subject: [PATCH] style(site): header flow, mobile features and showcases --- website/src/components/HeroFlow/index.js | 20 ++++++++++----- website/src/components/Showcases/index.js | 16 +++++++++--- website/src/components/Sidebar/index.js | 4 +++ website/src/components/TeaserFlow/index.js | 30 ++++++++++++++++++---- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/website/src/components/HeroFlow/index.js b/website/src/components/HeroFlow/index.js index e3112cdd..ec014e64 100644 --- a/website/src/components/HeroFlow/index.js +++ b/website/src/components/HeroFlow/index.js @@ -8,9 +8,10 @@ import ReactFlow, { import ColorPickerNode from './ColorPickerNode'; const windowWidth = typeof window !== 'undefined' ? window.innerWidth : 0; +const isSmallScreen = windowWidth < 800; const getOffset = () => { - if (windowWidth < 800) { + if (isSmallScreen) { return 0; } else if (windowWidth < 1200) { return 405; @@ -20,8 +21,10 @@ const getOffset = () => { }; const getColorNodeX = () => { - if (windowWidth < 800) { - return offsetLeft + 440; + if (windowWidth < 600) { + return offsetLeft + 250; + } else if (isSmallScreen) { + return offsetLeft + 400; } else if (windowWidth < 1000) { return offsetLeft + 300; } else if (windowWidth < 1200) { @@ -86,28 +89,31 @@ export default () => { type: 'colorpicker', data: { color: 'red', value: 105, onChange }, sourcePosition: 'right', - position: { x: offsetLeft + 50, y: 5 }, + position: { x: offsetLeft + 50, y: isSmallScreen ? 250 : 5 }, }, { id: '2', type: 'colorpicker', data: { color: 'green', value: 100, onChange }, sourcePosition: 'right', - position: { x: offsetLeft, y: 150 }, + position: { x: offsetLeft, y: isSmallScreen ? 325 : 150 }, }, { id: '3', data: { color: 'blue', value: 165, onChange }, type: 'colorpicker', sourcePosition: 'right', - position: { x: offsetLeft + 120, y: 300 }, + position: { + x: isSmallScreen ? offsetLeft + 50 : offsetLeft + 120, + y: isSmallScreen ? 400 : 300, + }, }, { id: '4', data: { label: 'rgb(105, 100, 165)' }, targetPosition: 'left', sourcePosition: 'right', - position: { x: getColorNodeX(), y: 180 }, + position: { x: getColorNodeX(), y: isSmallScreen ? 350 : 180 }, style: { background: 'rgb(105, 100, 165)', color: 'white', diff --git a/website/src/components/Showcases/index.js b/website/src/components/Showcases/index.js index 93527ec3..b03e458f 100644 --- a/website/src/components/Showcases/index.js +++ b/website/src/components/Showcases/index.js @@ -52,9 +52,14 @@ const Showcases = () => { return ( - + {showcases.map((showcase) => ( - + {showcase.title} @@ -64,7 +69,12 @@ const Showcases = () => { ))} {emptyShowCases.map((index) => ( - + react flow logo diff --git a/website/src/components/Sidebar/index.js b/website/src/components/Sidebar/index.js index b6e9960a..2429c53a 100644 --- a/website/src/components/Sidebar/index.js +++ b/website/src/components/Sidebar/index.js @@ -49,6 +49,10 @@ const MobileButton = styled(Flex)` cursor: pointer; justify-content: center; align-items: center; + + @media ${device.tablet} { + display: none; + } `; const MenuLink = styled(Link)` diff --git a/website/src/components/TeaserFlow/index.js b/website/src/components/TeaserFlow/index.js index d314bf18..88b11760 100644 --- a/website/src/components/TeaserFlow/index.js +++ b/website/src/components/TeaserFlow/index.js @@ -12,6 +12,7 @@ import ReactFlow, { import { H2, Text } from 'components/Typo'; import Icon from 'components/Icon'; import { baseColors } from 'themes'; +import { device, getThemeSpacePx } from 'utils/css-utils'; const Wrapper = styled(Flex)` justify-content: space-between; @@ -23,6 +24,11 @@ const ReactFlowWrapper = styled(Box)` height: 400px; background: ${(p) => (p.isDark ? baseColors.violet : 'white')}; border-radius: 5px; + order: 2; + + ${device.tablet} { + order: ${(p) => p.order}; + } .react-flow__controls { opacity: ${(p) => (p.isDark ? 0.5 : 1)}; @@ -35,15 +41,24 @@ const DocsLink = styled(Link)` margin-top: 16px; `; +const DescriptionWrapper = styled(Box)` + order: 1; + margin-bottom: ${getThemeSpacePx(3)}; + + ${device.tablet} { + order: ${(p) => p.order}; + } +`; + const Description = ({ title, description }) => ( - +

{title}

{description} Documentation{' '} -
+ ); export default ({ @@ -58,13 +73,18 @@ export default ({ children, }) => { const bgColor = isDark ? baseColors.violetLighten60 : baseColors.violet; + const reactFlowOrder = textPosition === 'left' ? 2 : 1; return ( {textPosition === 'left' && ( - + )} - + {children ? ( children ) : ( @@ -82,7 +102,7 @@ export default ({ )} {textPosition !== 'left' && ( - + )} );