Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove content width toggle from popover #17775

Merged
merged 5 commits into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions frontend/src/scenes/notebooks/Notebook/NotebookPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { Notebook } from './Notebook'
import { notebookPopoverLogic } from 'scenes/notebooks/Notebook/notebookPopoverLogic'
import { LemonButton } from '@posthog/lemon-ui'
import { IconFullScreen, IconChevronRight, IconLink } from 'lib/lemon-ui/icons'
import { useEffect, useRef } from 'react'
import { useEffect, useMemo, useRef } from 'react'
import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'
import { NotebookListMini } from './NotebookListMini'
import { notebooksModel } from '~/models/notebooksModel'
import { NotebookExpandButton, NotebookSyncInfo } from './NotebookMeta'
import { notebookLogic } from './notebookLogic'
import { urls } from 'scenes/urls'
import { NotebookPopoverDropzone } from './NotebookPopoverDropzone'
import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'

export function NotebookPopoverCard(): JSX.Element | null {
const { visibility, shownAtLeastOnce, fullScreen, selectedNotebook, initialAutofocus, droppedResource } =
Expand All @@ -26,8 +27,16 @@ export function NotebookPopoverCard(): JSX.Element | null {
if (droppedResource) {
return null
}

const { ref, size } = useResizeBreakpoints({
0: 'small',
832: 'medium',
})

const contentWidthHasEffect = useMemo(() => fullScreen && size === 'medium', [fullScreen, size])

return (
<div className="NotebookPopover__content__card">
<div ref={ref} className="NotebookPopover__content__card">
<header className="flex items-center justify-between gap-2 font-semibold shrink-0 p-1 border-b">
<span className="flex items-center gap-1 text-primary-alt">
<NotebookListMini
Expand All @@ -49,7 +58,7 @@ export function NotebookPopoverCard(): JSX.Element | null {
tooltipPlacement="left"
/>

<NotebookExpandButton status="primary-alt" size="small" />
{contentWidthHasEffect && <NotebookExpandButton status="primary-alt" size="small" />}

<LemonButton
size="small"
Expand Down
Loading