From 492d3e976946cac0a8a61477e53f6042330619bb Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Wed, 2 Jun 2021 17:11:42 +0100 Subject: [PATCH] improves mobile layout --- components/shared.tsx | 4 ++-- components/tools-panel/tools-panel.tsx | 28 ++++++++++++++------------ components/tools-panel/undo-redo.tsx | 3 +++ components/tools-panel/zoom.tsx | 18 +++++++++++------ lib/shape-utils/index.tsx | 4 ---- 5 files changed, 32 insertions(+), 25 deletions(-) diff --git a/components/shared.tsx b/components/shared.tsx index ae63dfeae..1472d7f1e 100644 --- a/components/shared.tsx +++ b/components/shared.tsx @@ -40,8 +40,8 @@ export const IconButton = styled('button', { height: 44, width: 44, '& > svg': { - height: '16px', - width: '16px', + height: '20px', + width: '20px', }, }, large: { diff --git a/components/tools-panel/tools-panel.tsx b/components/tools-panel/tools-panel.tsx index 39229f040..5e5122ed6 100644 --- a/components/tools-panel/tools-panel.tsx +++ b/components/tools-panel/tools-panel.tsx @@ -58,7 +58,7 @@ export default function ToolsPanel() { @@ -68,7 +68,7 @@ export default function ToolsPanel() { @@ -76,7 +76,7 @@ export default function ToolsPanel() { @@ -84,7 +84,7 @@ export default function ToolsPanel() { @@ -92,7 +92,7 @@ export default function ToolsPanel() { @@ -100,7 +100,7 @@ export default function ToolsPanel() { {/* @@ -108,7 +108,7 @@ export default function ToolsPanel() { */} {/* @@ -116,7 +116,7 @@ export default function ToolsPanel() { @@ -124,7 +124,7 @@ export default function ToolsPanel() { @@ -133,14 +133,14 @@ export default function ToolsPanel() { {isToolLocked ? : } {isPenLocked && ( @@ -161,7 +161,7 @@ const OuterContainer = styled('div', { padding: '0 8px 12px 8px', width: '100%', display: 'flex', - alignItems: 'center', + alignItems: 'flex-end', justifyContent: 'center', flexWrap: 'wrap', gap: 16, @@ -170,15 +170,17 @@ const OuterContainer = styled('div', { const Flex = styled('div', { display: 'flex', - justifyContent: 'space-between', width: '100%', padding: '0 4px', + justifyContent: 'space-between', + alignItems: 'flex-end', variants: { size: { small: { width: 'auto', padding: '0', + justifyContent: 'center', '& > *:nth-child(n+2)': { marginLeft: 16, }, diff --git a/components/tools-panel/undo-redo.tsx b/components/tools-panel/undo-redo.tsx index ee81a1886..d89429bba 100644 --- a/components/tools-panel/undo-redo.tsx +++ b/components/tools-panel/undo-redo.tsx @@ -38,6 +38,7 @@ const Container = styled('div', { boxShadow: '0px 2px 4px rgba(0,0,0,.12)', display: 'flex', padding: 4, + flexDirection: 'column', '& svg': { height: 13, @@ -48,6 +49,8 @@ const Container = styled('div', { size: { small: { bottom: 12, + flexDirection: 'row', + alignItems: 'center', }, }, }, diff --git a/components/tools-panel/zoom.tsx b/components/tools-panel/zoom.tsx index f339631c0..f7186ab0b 100644 --- a/components/tools-panel/zoom.tsx +++ b/components/tools-panel/zoom.tsx @@ -31,6 +31,11 @@ function ZoomCounter() { ) } +const ZoomButton = styled(IconButton, { + fontSize: '$0', + padding: 8, +}) + const Container = styled('div', { position: 'absolute', left: 12, @@ -46,6 +51,8 @@ const Container = styled('div', { boxShadow: '0px 2px 4px rgba(0,0,0,.12)', display: 'flex', padding: 4, + flexDirection: 'column', + alignItems: 'center', '& svg': { strokeWidth: 0, @@ -55,13 +62,12 @@ const Container = styled('div', { size: { small: { bottom: 12, + flexDirection: 'row', + alignItems: 'center', + [`& ${ZoomButton}`]: { + width: 44, + }, }, }, }, }) - -const ZoomButton = styled(IconButton, { - fontSize: '$0', - padding: 8, - width: 44, -}) diff --git a/lib/shape-utils/index.tsx b/lib/shape-utils/index.tsx index 6a0354034..75b77d6f9 100644 --- a/lib/shape-utils/index.tsx +++ b/lib/shape-utils/index.tsx @@ -5,10 +5,7 @@ import { Corner, Edge, ShapeStyles, - ShapeHandle, ShapeBinding, - BaseShape, - ShapeSpecificProps, Mutable, } from 'types' import { v4 as uuid } from 'uuid' @@ -26,7 +23,6 @@ import { getBoundsFromPoints, getRotatedCorners, } from 'utils/utils' -import shape from 'components/canvas/shape' import { boundsCollidePolygon, boundsContainPolygon,