[fix] mobile layout (#845)

* fix buttons on ios size

* Update ToolButton.tsx
This commit is contained in:
Steve Ruiz 2022-07-23 09:33:45 +01:00 committed by GitHub
parent aa5554df70
commit 014b07d417
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 9 deletions

View file

@ -112,6 +112,8 @@ export const StyledToolButtonInner = styled('div', {
userSelect: 'none', userSelect: 'none',
boxSizing: 'border-box', boxSizing: 'border-box',
border: '1px solid transparent', border: '1px solid transparent',
'-webkit-tap-highlight-color': 'transparent',
'tap-highlight-color': 'transparent',
}) })
export const StyledToolButton = styled('button', { export const StyledToolButton = styled('button', {
@ -130,6 +132,8 @@ export const StyledToolButton = styled('button', {
border: 'none', border: 'none',
height: '40px', height: '40px',
width: '40px', width: '40px',
'-webkit-tap-highlight-color': 'transparent',
'tap-highlight-color': 'transparent',
[`&:disabled ${StyledToolButtonInner}`]: { [`&:disabled ${StyledToolButtonInner}`]: {
opacity: 0.618, opacity: 0.618,
@ -184,7 +188,9 @@ export const StyledToolButton = styled('button', {
false: {}, false: {},
}, },
bp: { bp: {
mobile: {}, mobile: {
padding: 0,
},
small: {}, small: {},
}, },
}, },
@ -193,8 +199,8 @@ export const StyledToolButton = styled('button', {
variant: 'primary', variant: 'primary',
bp: 'mobile', bp: 'mobile',
css: { css: {
height: '40px', height: 40,
width: '40px', width: 36,
[`& ${StyledToolButtonInner} > svg`]: { [`& ${StyledToolButtonInner} > svg`]: {
width: 16, width: 16,
height: 16, height: 16,

View file

@ -88,13 +88,16 @@ const HelpButton = styled('button', {
borderRadius: '100%', borderRadius: '100%',
position: 'fixed', position: 'fixed',
right: 10, right: 10,
display: 'grid', padding: 0,
placeItems: 'center', display: 'flex',
alignItems: 'center',
justifyContent: 'center',
border: 'none', border: 'none',
backgroundColor: 'white', backgroundColor: 'white',
cursor: 'pointer', cursor: 'pointer',
boxShadow: '$panel', boxShadow: '$panel',
bottom: 10, bottom: 10,
color: '$text',
variants: { variants: {
debug: { debug: {
true: {}, true: {},

View file

@ -14,6 +14,8 @@ import { ToolButtonWithTooltip } from '~components/Primitives/ToolButton'
import { Panel } from '~components/Primitives/Panel' import { Panel } from '~components/Primitives/Panel'
import { ShapesMenu } from './ShapesMenu' import { ShapesMenu } from './ShapesMenu'
import { EraserIcon } from '~components/Primitives/icons' import { EraserIcon } from '~components/Primitives/icons'
import { styled } from '~styles/stitches.config'
import { breakpoints } from '~components/breakpoints'
const activeToolSelector = (s: TDSnapshot) => s.appState.activeTool const activeToolSelector = (s: TDSnapshot) => s.appState.activeTool
const toolLockedSelector = (s: TDSnapshot) => s.appState.isToolLocked const toolLockedSelector = (s: TDSnapshot) => s.appState.isToolLocked
@ -59,7 +61,12 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
const panelStyle = dockPosition === 'bottom' || dockPosition === 'top' ? 'row' : 'column' const panelStyle = dockPosition === 'bottom' || dockPosition === 'top' ? 'row' : 'column'
return ( return (
<Panel side="center" id="TD-PrimaryTools" style={{ flexDirection: panelStyle }}> <StyledPanel
side="center"
id="TD-PrimaryTools"
style={{ flexDirection: panelStyle }}
bp={breakpoints}
>
<ToolButtonWithTooltip <ToolButtonWithTooltip
kbd={'1'} kbd={'1'}
label={intl.formatMessage({ id: 'select' })} label={intl.formatMessage({ id: 'select' })}
@ -120,6 +127,20 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
<ToolButtonWithTooltip label="Image" onClick={uploadMedias} id="TD-PrimaryTools-Image"> <ToolButtonWithTooltip label="Image" onClick={uploadMedias} id="TD-PrimaryTools-Image">
<ImageIcon /> <ImageIcon />
</ToolButtonWithTooltip> </ToolButtonWithTooltip>
</Panel> </StyledPanel>
) )
}) })
const StyledPanel = styled(Panel, {
variants: {
bp: {
mobile: {
padding: '$0',
borderRadius: '$3',
},
small: {
padding: '$2',
},
},
},
})

View file

@ -51,7 +51,7 @@ const StyledToolsPanelContainer = styled('div', {
width: '100%', width: '100%',
minWidth: 0, minWidth: 0,
maxWidth: '100%', maxWidth: '100%',
height: '64px', height: 64,
gap: '$4', gap: '$4',
display: 'flex', display: 'flex',
justifyContent: 'center', justifyContent: 'center',
@ -96,7 +96,7 @@ const StyledToolsPanelContainer = styled('div', {
side: 'top', side: 'top',
bp: 'large', bp: 'large',
css: { css: {
top: '10px', top: 10,
}, },
}, },
{ {