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

headerComponents for PaneViewReact is never used and cannot set height because harcoded to 22px #863

Open
756D61 opened this issue Feb 23, 2025 · 0 comments

Comments

@756D61
Copy link

756D61 commented Feb 23, 2025

Cannot set custom header component nor custom height for PaneViewReact. My goal is to set the height of the PaneViewHeader, seems it is hardcoded somewhere.

const PaneViewHeader = (props: IPaneviewPanelProps<{ title: string }>) => {
  const [expanded, setExpanded] = useState<boolean>(props.api.isExpanded);

  debugger;

  useEffect(() => {
    const disposable = props.api.onDidExpansionChange((event) => {
      setExpanded(event.isExpanded);
    });

    return () => {
      disposable.dispose();
    };
  }, []);

  const onClick = () => {
    props.api.setExpanded(!expanded);
  };

  return (
    <div className="bg-red-500">
      <a onClick={onClick} className={expanded ? "expanded" : "collapsed"} />
      <span>{props.params.title} sssss</span>
    </div>
  );
};

const FiltersPane = (props) => {
  const components = {
    default: (props) => {
      return (
        <div className="h-full bg-amber-400">{props.params.filterName}</div>
      );
    },
  };

  const onReady = (event: PaneviewReadyEvent) => {
    event.api.addPanel({
      id: "titleFilter",
      component: "default",
      title: "Title",
      params: {
        filterName: "titleFilter",
      },
    });
    event.api.addPanel({
      id: "contractFilter",
      component: "default",
      title: "Contract",
      params: {
        filterName: "contractFilter",
      },
    });
  };

  return (
    <PaneviewReact
      components={components}
      onReady={onReady}
      headerComponents={{ default: PaneViewHeader }}
    />
  );
};

Event though I have the debugger inside PaneViewHeader, I could not never enter there.

In any case, please improve the documentation.

@756D61 756D61 changed the title headerComponents for PaneViewReact is never used headerComponents for PaneViewReact is never used and cannot set height becaus harcoded to 22px Feb 23, 2025
@756D61 756D61 changed the title headerComponents for PaneViewReact is never used and cannot set height becaus harcoded to 22px headerComponents for PaneViewReact is never used and cannot set height because harcoded to 22px Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant