Skip to content

Commit

Permalink
add margin to onboardingchecklist when there is no scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
0XYoussefX0 committed Apr 2, 2024
1 parent 00ddece commit 48bc1c0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
@use "src/styles/breakpoints";

body[data-scroll-locked] {
.checklistPosition {
margin-right: var(--scrollbar-width);
}
}

.marginRight {
margin-right: var(--scrollbar-width);
}

.checklistPosition {
position: fixed;
inset-block-end: var(--spacing-medium);
Expand Down
21 changes: 17 additions & 4 deletions src/components/Onboarding/OnboardingChecklist/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import classNames from 'classnames';
import { useRouter } from 'next/router';
import Trans from 'next-translate/Trans';
import useTranslation from 'next-translate/useTranslation';
import { useDispatch, useSelector } from 'react-redux';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';

import OnboardingProgress from '../OnboardingProgress';
import { onboardingChecklist } from '../steps';
Expand All @@ -16,6 +16,7 @@ import usePersistPreferenceGroup from '@/hooks/auth/usePersistPreferenceGroup';
import CheckIcon from '@/icons/check.svg';
import IconClose from '@/icons/close.svg';
import IconQuestionMark from '@/icons/question-mark-icon.svg';
import { selectNavbar } from '@/redux/slices/navbar';
import {
dismissChecklist,
selectOnboarding,
Expand All @@ -42,6 +43,11 @@ const OnboardingChecklist = () => {
const { isChecklistVisible, checklistDismissals, completedGroups } =
useSelector(selectOnboarding);

const { isSearchDrawerOpen, isNavigationDrawerOpen, isSettingsDrawerOpen } = useSelector(
selectNavbar,
shallowEqual,
);

const readingPreferences = useSelector(selectReadingPreferences);
const { readingPreference } = readingPreferences;
const {
Expand Down Expand Up @@ -70,7 +76,10 @@ const OnboardingChecklist = () => {
return (
<Button
shape={ButtonShape.Circle}
className={classNames(styles.checklistPosition)}
className={classNames(styles.checklistPosition, {
[styles.marginRight]:
isSearchDrawerOpen || isNavigationDrawerOpen || isSettingsDrawerOpen,
})}
tooltip={t('onboarding:onboarding-checklist')}
onClick={openChecklist}
size={ButtonSize.Large}
Expand Down Expand Up @@ -112,7 +121,11 @@ const OnboardingChecklist = () => {
};

return (
<div className={classNames(styles.checklist, styles.checklistPosition)}>
<div
className={classNames(styles.checklist, styles.checklistPosition, {
[styles.marginRight]: isSearchDrawerOpen || isNavigationDrawerOpen || isSettingsDrawerOpen,
})}
>
<div className={styles.checklistHeader}>
<h4>
<Trans
Expand Down Expand Up @@ -161,5 +174,5 @@ const OnboardingChecklist = () => {
</div>
);
};

// eslint-disable-next-line max-lines
export default OnboardingChecklist;

0 comments on commit 48bc1c0

Please sign in to comment.