overleaf/services/web/frontend/js/features/review-panel-new/components/review-panel.tsx
ilkin-overleaf 8bc374c916 Merge pull request #21115 from overleaf/ii-bs5-review-panel
[web] BS5 review panel new

GitOrigin-RevId: c65d17d0053858bd74984ba746a620b89d900606
2024-10-21 08:04:37 +00:00

41 lines
1.4 KiB
TypeScript

import { FC, memo, useMemo } from 'react'
import ReviewPanelTabs from './review-panel-tabs'
import ReviewPanelHeader from './review-panel-header'
import ReviewPanelCurrentFile from './review-panel-current-file'
import { ReviewPanelOverview } from './review-panel-overview'
import classnames from 'classnames'
import { useReviewPanelStyles } from '@/features/review-panel-new/hooks/use-review-panel-styles'
import { useReviewPanelViewContext } from '../context/review-panel-view-context'
const ReviewPanel: FC<{ mini?: boolean }> = ({ mini = false }) => {
const choosenSubView = useReviewPanelViewContext()
const activeSubView = useMemo(
() => (mini ? 'cur_file' : choosenSubView),
[choosenSubView, mini]
)
const style = useReviewPanelStyles(mini)
const className = classnames('review-panel-new', 'review-panel-container', {
'review-panel-mini': mini,
'review-panel-subview-overview': activeSubView === 'overview',
})
return (
<div className={className} style={style}>
<div id="review-panel-inner" className="review-panel-inner">
{!mini && <ReviewPanelHeader />}
{activeSubView === 'cur_file' && <ReviewPanelCurrentFile />}
{activeSubView === 'overview' && <ReviewPanelOverview />}
<div className="review-panel-footer">
<ReviewPanelTabs />
</div>
</div>
</div>
)
}
export default memo(ReviewPanel)