Skip to content

Commit

Permalink
fix: content section margin from the header added
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledrakhisi committed Dec 30, 2023
1 parent c9965cc commit 8b6a5a8
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 245 deletions.
20 changes: 12 additions & 8 deletions src/discussions/discussions-home/DiscussionsHome.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from 'react';
import React, { useEffect, useMemo, useRef } from 'react';

import classNames from 'classnames';
import { useSelector } from 'react-redux';
Expand Down Expand Up @@ -52,6 +52,7 @@ const DiscussionsHome = () => {
/* Display the content area if we are currently viewing/editing a post or creating one.
If the window is larger than a particular size, show the sidebar for navigating between posts/topics.
However, for smaller screens or embeds, onlyshow the sidebar if the content area isn't displayed. */
const inContext = new URLSearchParams(location.search).get('inContext') !== null;
const displayContentArea = (postId || postEditorVisible || (learnerUsername && postId));
if (displayContentArea) { displaySidebar = isOnDesktop; }

Expand All @@ -61,20 +62,23 @@ const DiscussionsHome = () => {
}
}, [path]);

return (
// eslint-disable-next-line react/jsx-no-constructed-context-values
<DiscussionContext.Provider value={{
const discussionContextValue = useMemo(() => (
{
page,
courseId,
postId,
topicId,
enableInContextSidebar,
category,
learnerUsername,
}}
>
{!enableInContextSidebar && <Header />}
<main className="container-fluid d-flex flex-column p-0 w-100" id="main" tabIndex="-1">
}
), []);

return (
// eslint-disable-next-line react/jsx-no-constructed-context-values
<DiscussionContext.Provider value={discussionContextValue}>
{!inContext && <Header />}
<main className="container-fluid d-flex flex-column p-0 w-100 mt-3" id="main" tabIndex="-1">
{!enableInContextSidebar && <CourseTabsNavigation activeTab="discussion" courseId={courseId} />}
<div
className={classNames('header-action-bar', {
Expand Down
Loading

0 comments on commit 8b6a5a8

Please sign in to comment.