Browse Source

improves mobile layout

main
Steve Ruiz 4 years ago
parent
commit
492d3e9769

+ 2
- 2
components/shared.tsx View File

@@ -40,8 +40,8 @@ export const IconButton = styled('button', {
40 40
         height: 44,
41 41
         width: 44,
42 42
         '& > svg': {
43
-          height: '16px',
44
-          width: '16px',
43
+          height: '20px',
44
+          width: '20px',
45 45
         },
46 46
       },
47 47
       large: {

+ 15
- 13
components/tools-panel/tools-panel.tsx View File

@@ -58,7 +58,7 @@ export default function ToolsPanel() {
58 58
         <Container>
59 59
           <IconButton
60 60
             name="select"
61
-            size={{ '@sm': 'small', '@md': 'large' }}
61
+            size={{ '@initial': 'small', '@sm': 'small', '@md': 'large' }}
62 62
             onClick={selectSelectTool}
63 63
             isActive={activeTool === 'select'}
64 64
           >
@@ -68,7 +68,7 @@ export default function ToolsPanel() {
68 68
         <Container>
69 69
           <IconButton
70 70
             name={ShapeType.Draw}
71
-            size={{ '@sm': 'small', '@md': 'large' }}
71
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
72 72
             onClick={selectDrawTool}
73 73
             isActive={activeTool === ShapeType.Draw}
74 74
           >
@@ -76,7 +76,7 @@ export default function ToolsPanel() {
76 76
           </IconButton>
77 77
           <IconButton
78 78
             name={ShapeType.Rectangle}
79
-            size={{ '@sm': 'small', '@md': 'large' }}
79
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
80 80
             onClick={selectRectangleTool}
81 81
             isActive={activeTool === ShapeType.Rectangle}
82 82
           >
@@ -84,7 +84,7 @@ export default function ToolsPanel() {
84 84
           </IconButton>
85 85
           <IconButton
86 86
             name={ShapeType.Circle}
87
-            size={{ '@sm': 'small', '@md': 'large' }}
87
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
88 88
             onClick={selectEllipseTool}
89 89
             isActive={activeTool === ShapeType.Ellipse}
90 90
           >
@@ -92,7 +92,7 @@ export default function ToolsPanel() {
92 92
           </IconButton>
93 93
           <IconButton
94 94
             name={ShapeType.Arrow}
95
-            size={{ '@sm': 'small', '@md': 'large' }}
95
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
96 96
             onClick={selectArrowTool}
97 97
             isActive={activeTool === ShapeType.Arrow}
98 98
           >
@@ -100,7 +100,7 @@ export default function ToolsPanel() {
100 100
           </IconButton>
101 101
           {/* <IconButton
102 102
             name={ShapeType.Circle}
103
-            size={{ '@sm': 'small', '@md': 'large' }}
103
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
104 104
             onClick={selectCircleTool}
105 105
             isActive={activeTool === ShapeType.Circle}
106 106
           >
@@ -108,7 +108,7 @@ export default function ToolsPanel() {
108 108
           </IconButton> */}
109 109
           {/* <IconButton
110 110
             name={ShapeType.Line}
111
-            size={{ '@sm': 'small', '@md': 'large' }}
111
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
112 112
             onClick={selectLineTool}
113 113
             isActive={activeTool === ShapeType.Line}
114 114
           >
@@ -116,7 +116,7 @@ export default function ToolsPanel() {
116 116
           </IconButton>
117 117
           <IconButton
118 118
             name={ShapeType.Ray}
119
-            size={{ '@sm': 'small', '@md': 'large' }}
119
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
120 120
             onClick={selectRayTool}
121 121
             isActive={activeTool === ShapeType.Ray}
122 122
           >
@@ -124,7 +124,7 @@ export default function ToolsPanel() {
124 124
           </IconButton>
125 125
           <IconButton
126 126
             name={ShapeType.Dot}
127
-            size={{ '@sm': 'small', '@md': 'large' }}
127
+            size={{ '@initial': 'medium', '@sm': 'small', '@md': 'large' }}
128 128
             onClick={selectDotTool}
129 129
             isActive={activeTool === ShapeType.Dot}
130 130
           >
@@ -133,14 +133,14 @@ export default function ToolsPanel() {
133 133
         </Container>
134 134
         <Container>
135 135
           <IconButton
136
-            size={{ '@sm': 'small', '@md': 'large' }}
136
+            size={{ '@initial': 'small', '@sm': 'small', '@md': 'large' }}
137 137
             onClick={selectToolLock}
138 138
           >
139 139
             {isToolLocked ? <LockClosedIcon /> : <LockOpen1Icon />}
140 140
           </IconButton>
141 141
           {isPenLocked && (
142 142
             <IconButton
143
-              size={{ '@sm': 'small', '@md': 'large' }}
143
+              size={{ '@initial': 'small', '@sm': 'small', '@md': 'large' }}
144 144
               onClick={selectToolLock}
145 145
             >
146 146
               <Pencil2Icon />
@@ -161,7 +161,7 @@ const OuterContainer = styled('div', {
161 161
   padding: '0 8px 12px 8px',
162 162
   width: '100%',
163 163
   display: 'flex',
164
-  alignItems: 'center',
164
+  alignItems: 'flex-end',
165 165
   justifyContent: 'center',
166 166
   flexWrap: 'wrap',
167 167
   gap: 16,
@@ -170,15 +170,17 @@ const OuterContainer = styled('div', {
170 170
 
171 171
 const Flex = styled('div', {
172 172
   display: 'flex',
173
-  justifyContent: 'space-between',
174 173
   width: '100%',
175 174
   padding: '0 4px',
175
+  justifyContent: 'space-between',
176
+  alignItems: 'flex-end',
176 177
 
177 178
   variants: {
178 179
     size: {
179 180
       small: {
180 181
         width: 'auto',
181 182
         padding: '0',
183
+        justifyContent: 'center',
182 184
         '& > *:nth-child(n+2)': {
183 185
           marginLeft: 16,
184 186
         },

+ 3
- 0
components/tools-panel/undo-redo.tsx View File

@@ -38,6 +38,7 @@ const Container = styled('div', {
38 38
   boxShadow: '0px 2px 4px rgba(0,0,0,.12)',
39 39
   display: 'flex',
40 40
   padding: 4,
41
+  flexDirection: 'column',
41 42
 
42 43
   '& svg': {
43 44
     height: 13,
@@ -48,6 +49,8 @@ const Container = styled('div', {
48 49
     size: {
49 50
       small: {
50 51
         bottom: 12,
52
+        flexDirection: 'row',
53
+        alignItems: 'center',
51 54
       },
52 55
     },
53 56
   },

+ 12
- 6
components/tools-panel/zoom.tsx View File

@@ -31,6 +31,11 @@ function ZoomCounter() {
31 31
   )
32 32
 }
33 33
 
34
+const ZoomButton = styled(IconButton, {
35
+  fontSize: '$0',
36
+  padding: 8,
37
+})
38
+
34 39
 const Container = styled('div', {
35 40
   position: 'absolute',
36 41
   left: 12,
@@ -46,6 +51,8 @@ const Container = styled('div', {
46 51
   boxShadow: '0px 2px 4px rgba(0,0,0,.12)',
47 52
   display: 'flex',
48 53
   padding: 4,
54
+  flexDirection: 'column',
55
+  alignItems: 'center',
49 56
 
50 57
   '& svg': {
51 58
     strokeWidth: 0,
@@ -55,13 +62,12 @@ const Container = styled('div', {
55 62
     size: {
56 63
       small: {
57 64
         bottom: 12,
65
+        flexDirection: 'row',
66
+        alignItems: 'center',
67
+        [`& ${ZoomButton}`]: {
68
+          width: 44,
69
+        },
58 70
       },
59 71
     },
60 72
   },
61 73
 })
62
-
63
-const ZoomButton = styled(IconButton, {
64
-  fontSize: '$0',
65
-  padding: 8,
66
-  width: 44,
67
-})

+ 0
- 4
lib/shape-utils/index.tsx View File

@@ -5,10 +5,7 @@ import {
5 5
   Corner,
6 6
   Edge,
7 7
   ShapeStyles,
8
-  ShapeHandle,
9 8
   ShapeBinding,
10
-  BaseShape,
11
-  ShapeSpecificProps,
12 9
   Mutable,
13 10
 } from 'types'
14 11
 import { v4 as uuid } from 'uuid'
@@ -26,7 +23,6 @@ import {
26 23
   getBoundsFromPoints,
27 24
   getRotatedCorners,
28 25
 } from 'utils/utils'
29
-import shape from 'components/canvas/shape'
30 26
 import {
31 27
   boundsCollidePolygon,
32 28
   boundsContainPolygon,

Loading…
Cancel
Save