fix buttons, help button placement (#1145)

This commit is contained in:
Steve Ruiz 2023-02-10 13:51:30 +00:00 committed by GitHub
parent b6dacdc1cd
commit a9f1a6ccc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import { styled } from '~styles/stitches.config'
export const Panel = styled('div', { export const Panel = styled('div', {
backgroundColor: '$panel', backgroundColor: '$panel',
display: 'flex', display: 'flex',
alignItems: 'center',
flexDirection: 'row', flexDirection: 'row',
boxShadow: '$panel', boxShadow: '$panel',
padding: '$2', padding: '$2',

View file

@ -61,11 +61,13 @@ interface ToolButtonWithTooltipProps extends ToolButtonProps {
label: string label: string
isLocked?: boolean isLocked?: boolean
kbd?: string kbd?: string
variant?: 'icon' | 'text' | 'circle' | 'primary'
} }
export function ToolButtonWithTooltip({ export function ToolButtonWithTooltip({
label, label,
kbd, kbd,
variant,
isLocked, isLocked,
...rest ...rest
}: ToolButtonWithTooltipProps) { }: ToolButtonWithTooltipProps) {
@ -85,7 +87,7 @@ export function ToolButtonWithTooltip({
<Tooltip label={label[0].toUpperCase() + label.slice(1)} kbd={kbd}> <Tooltip label={label[0].toUpperCase() + label.slice(1)} kbd={kbd}>
<ToolButton <ToolButton
{...rest} {...rest}
variant="primary" variant={variant}
isToolLocked={isLocked && rest.isActive} isToolLocked={isLocked && rest.isActive}
onDoubleClick={handleDoubleClick} onDoubleClick={handleDoubleClick}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
@ -203,8 +205,8 @@ export const StyledToolButton = styled('button', {
variant: 'primary', variant: 'primary',
bp: 'small', bp: 'small',
css: { css: {
height: '44px', height: '40px',
width: '44px', width: '40px',
[`& ${StyledToolButtonInner} > svg`]: { [`& ${StyledToolButtonInner} > svg`]: {
width: 20, width: 20,
height: 20, height: 20,

View file

@ -155,7 +155,7 @@ const PopoverAnchor = styled(Popover.Anchor, {
bottom: 64, bottom: 64,
}, },
small: { small: {
bottom: 10, bottom: 20,
}, },
medium: {}, medium: {},
large: {}, large: {},
@ -168,6 +168,12 @@ const PopoverAnchor = styled(Popover.Anchor, {
}, },
}, },
compoundVariants: [ compoundVariants: [
{
debug: true,
css: {
bottom: 50,
},
},
{ {
bp: 'mobile', bp: 'mobile',
side: 'bottom', side: 'bottom',
@ -181,7 +187,15 @@ const PopoverAnchor = styled(Popover.Anchor, {
side: 'bottom', side: 'bottom',
debug: true, debug: true,
css: { css: {
bottom: 50, bottom: 60,
},
},
{
bp: 'small',
side: 'bottom',
debug: true,
css: {
bottom: 60,
}, },
}, },
], ],

View file

@ -72,6 +72,7 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
label={intl.formatMessage({ id: 'select' })} label={intl.formatMessage({ id: 'select' })}
onClick={selectSelectTool} onClick={selectSelectTool}
isActive={activeTool === 'select'} isActive={activeTool === 'select'}
variant="primary"
id="TD-PrimaryTools-CursorArrow" id="TD-PrimaryTools-CursorArrow"
> >
<CursorArrowIcon /> <CursorArrowIcon />
@ -81,6 +82,7 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
label={intl.formatMessage({ id: 'draw' })} label={intl.formatMessage({ id: 'draw' })}
onClick={selectDrawTool} onClick={selectDrawTool}
isActive={activeTool === TDShapeType.Draw} isActive={activeTool === TDShapeType.Draw}
variant="primary"
id="TD-PrimaryTools-Pencil" id="TD-PrimaryTools-Pencil"
> >
<Pencil1Icon /> <Pencil1Icon />
@ -90,6 +92,7 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
label={intl.formatMessage({ id: 'eraser' })} label={intl.formatMessage({ id: 'eraser' })}
onClick={selectEraseTool} onClick={selectEraseTool}
isActive={activeTool === 'erase'} isActive={activeTool === 'erase'}
variant="primary"
id="TD-PrimaryTools-Eraser" id="TD-PrimaryTools-Eraser"
> >
<EraserIcon /> <EraserIcon />
@ -100,6 +103,7 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
label={intl.formatMessage({ id: 'arrow' })} label={intl.formatMessage({ id: 'arrow' })}
onClick={selectArrowTool} onClick={selectArrowTool}
isLocked={isToolLocked} isLocked={isToolLocked}
variant="primary"
isActive={activeTool === TDShapeType.Arrow} isActive={activeTool === TDShapeType.Arrow}
id="TD-PrimaryTools-ArrowTopRight" id="TD-PrimaryTools-ArrowTopRight"
> >
@ -110,6 +114,7 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
label={intl.formatMessage({ id: 'text' })} label={intl.formatMessage({ id: 'text' })}
onClick={selectTextTool} onClick={selectTextTool}
isLocked={isToolLocked} isLocked={isToolLocked}
variant="primary"
isActive={activeTool === TDShapeType.Text} isActive={activeTool === TDShapeType.Text}
id="TD-PrimaryTools-Text" id="TD-PrimaryTools-Text"
> >
@ -120,6 +125,7 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
label={intl.formatMessage({ id: 'sticky' })} label={intl.formatMessage({ id: 'sticky' })}
onClick={selectStickyTool} onClick={selectStickyTool}
isActive={activeTool === TDShapeType.Sticky} isActive={activeTool === TDShapeType.Sticky}
variant="primary"
id="TD-PrimaryTools-Pencil2" id="TD-PrimaryTools-Pencil2"
> >
<Pencil2Icon /> <Pencil2Icon />
@ -128,6 +134,7 @@ export const PrimaryTools = React.memo(function PrimaryTools() {
label={intl.formatMessage({ id: 'image' })} label={intl.formatMessage({ id: 'image' })}
onClick={uploadMedias} onClick={uploadMedias}
id="TD-PrimaryTools-Image" id="TD-PrimaryTools-Image"
variant="primary"
> >
<ImageIcon /> <ImageIcon />
</ToolButtonWithTooltip> </ToolButtonWithTooltip>