Skip to content

Commit

Permalink
Sticky headers for collapsable panels
Browse files Browse the repository at this point in the history
Differential Revision: D64938295

fbshipit-source-id: 0a646f29eba98e1721616263960abf061b7e3304
  • Loading branch information
antonk52 authored and facebook-github-bot committed Oct 25, 2024
1 parent 750b679 commit 533f088
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions desktop/flipper-plugin/src/ui/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ import {TrackingScope} from './Tracked';
import {useLocalStorageState} from '../utils/useLocalStorageState';
import {useCallback} from 'react';
import styled from '@emotion/styled';
import {css} from '@emotion/css';
import {Spacing, theme} from './theme';
import {Layout} from './Layout';

const stickyHeader = css`
& .ant-collapse-header {
position: sticky !important;
top: 0;
}
`;

export const Panel: React.FC<{
title: string;
/**
Expand All @@ -28,6 +36,7 @@ export const Panel: React.FC<{
collapsed?: boolean;
pad?: Spacing;
gap?: Spacing;
stickyHeader?: boolean;
extraActions?: React.ReactElement | null;
className?: string;
}> = (props) => {
Expand All @@ -52,6 +61,7 @@ export const Panel: React.FC<{
onChange={toggle}>
<Collapse.Panel
key={props.title}
className={props.stickyHeader ? stickyHeader : undefined}
header={
props.extraActions ? (
<Layout.Right center>
Expand Down

0 comments on commit 533f088

Please sign in to comment.