diff --git a/.changeset/long-buckets-melt.md b/.changeset/long-buckets-melt.md new file mode 100644 index 00000000..a45e4f3b --- /dev/null +++ b/.changeset/long-buckets-melt.md @@ -0,0 +1,6 @@ +--- +'react-showroom': patch +'@showroomjs/ui': patch +--- + +Fix standalone view styling diff --git a/packages/react-showroom/client/components/standalone-code-live-editor-comment-popover.tsx b/packages/react-showroom/client/components/standalone-code-live-editor-comment-popover.tsx index ee4461a2..a657fc7b 100644 --- a/packages/react-showroom/client/components/standalone-code-live-editor-comment-popover.tsx +++ b/packages/react-showroom/client/components/standalone-code-live-editor-comment-popover.tsx @@ -11,9 +11,6 @@ export interface StandaloneCodeLiveEditorCommentPopoverProps children: React.ReactNode; } -/** - * @todo Fix the textarea not being auto-focused when open. Not sure why. - */ export const StandaloneCodeLiveEditorCommentPopover = React.forwardRef< HTMLTextAreaElement, StandaloneCodeLiveEditorCommentPopoverProps diff --git a/packages/react-showroom/client/components/standalone-code-live-editor-comment.tsx b/packages/react-showroom/client/components/standalone-code-live-editor-comment.tsx index 4da40786..1cbee969 100644 --- a/packages/react-showroom/client/components/standalone-code-live-editor-comment.tsx +++ b/packages/react-showroom/client/components/standalone-code-live-editor-comment.tsx @@ -44,6 +44,7 @@ const CommentItem = styled(CommentItemImpl, { fontSize: '$sm', lineHeight: '$sm', position: 'relative', + whiteSpace: 'pre-wrap', variants: { active: { true: { diff --git a/packages/react-showroom/client/components/standalone-code-live-editor.tsx b/packages/react-showroom/client/components/standalone-code-live-editor.tsx index 72d94a8d..be5c463b 100644 --- a/packages/react-showroom/client/components/standalone-code-live-editor.tsx +++ b/packages/react-showroom/client/components/standalone-code-live-editor.tsx @@ -513,6 +513,8 @@ export const StandaloneCodeLiveEditor = ({ }; setTargetCoord(elementRelative); + + setActiveComment(''); } }} ref={previewListRef} @@ -568,20 +570,27 @@ export const StandaloneCodeLiveEditor = ({ }} key={comment.id} > - { - ev.stopPropagation(); - setActiveComment(comment.id); - }} - type="button" + - - + { + ev.stopPropagation(); + setActiveComment(isActive ? '' : comment.id); + }} + type="button" + > + + + ); })} @@ -849,6 +858,8 @@ const A11yPanelRoot = styled('section', { px: '$2', paddingBottom: '$3', minHeight: 200, + maxHeight: '40vh', + overflowY: 'auto', }); const A11yPanelTitle = styled('div', { @@ -958,6 +969,8 @@ const MarkerButton = styled('button', { margin: '-10px', width: 40, height: 40, + outlineRing: '', + borderRadius: '$lg', }); const Toolbar = styled('div', { @@ -1024,13 +1037,15 @@ const MenuButton = styled('button', { const editorWrapper = css({ flex: 1, - overflow: 'hidden', + overflow: 'auto', }); const editor = css({ borderRadius: '$base', - height: '100%', - overflowY: 'auto', +}); + +const commentPopover = css({ + whiteSpace: 'pre-wrap', }); const iconClass = css({ diff --git a/packages/ui/src/components/tooltip.tsx b/packages/ui/src/components/tooltip.tsx index 2470e1fb..fc66c605 100644 --- a/packages/ui/src/components/tooltip.tsx +++ b/packages/ui/src/components/tooltip.tsx @@ -38,12 +38,24 @@ export const Tooltip = Object.assign({}, TooltipPrimitive, { Arrow: StyledArrow, }); -export const TextTooltip = (props: { +export interface TextTooltipProps + extends Pick< + TooltipPrimitive.PopperContentProps, + 'side' | 'align' | 'className' + > { children: React.ReactNode; label: string; -}) => ( - - {props.children} - {props.label} + open?: boolean; +} + +export const TextTooltip = ({ + children, + label, + open, + ...props +}: TextTooltipProps) => ( + + {children} + {label} );